2024-03-29 20:08:34 -04:00
import Template , { ErrorTemplate } from './templates' ;
import './styles.css' ;
2025-01-25 02:02:18 -05:00
import { parse } from 'gift-pegjs' ;
const multiple = parse ( `
Who 's buried in Grant' s tomb ? { ~ % - 50 % Grant = % 50 % Jefferson = % 50 % no one # # # # Not sure ? There are many answers for this question so do not fret . Not sure ? There are many answers for this question so do not fret . }
Grant is _____ in Grant ' s tomb . { = buried # No one is buried there . = entombed ~ living }
Grant is buried in Grant ' s tomb . { FALSE }
Who 's buried in Grant' s tomb ? { = no one = nobody }
When was Ulysses S . Grant born ? { # 1822 :5 }
What is the capital of Canada ? { = Canada - > Ottawa = Italy - > Rome = Japan - > Tokyo }
` );
2024-03-29 20:08:34 -04:00
const items = multiple . map ( ( item ) = > Template ( item , { theme : 'dark' } ) ) . join ( '' ) ;
const errorItemDark = ErrorTemplate ( 'Hello' ) ;
const lightItems = multiple . map ( ( item ) = > Template ( item , { theme : 'light' } ) ) . join ( '' ) ;
const errorItem = ErrorTemplate ( 'Hello' ) ;
const app = document . getElementById ( 'app' ) ;
if ( app ) app . innerHTML = items + errorItemDark + lightItems + errorItem ;