TOPIC: Books, Eval, Asup, etc...
#776
Books, Eval, Asup, etc... 3 Years, 5 Months ago
1) On a previous discussion, you were thinking about dropping Eval for Asup or InvertHtml. Looking at the InvertHtml code, I've noticed that id does not eval() (unlike Asup). So are you thinking of using Asup w/InvertHtml, or a combo of Eval w/InvertHtml? How much would such a change break (besides suneidoc's use of BookMenuPage)?

2) Looking at following code fragement of BookCheck
Code:

text = x.text.Eval()
if not String?(text) or not text.Prefix?('<')
   Window(text, show: false).Destroy()


Can the book page contain Window control? If so, this may impact #1, and there may need to be a couple of changes in BookExport, BookExportOne and BookPrint to account for that fact.
 
 
#777
Re:Books, Eval, Asup, etc... 3 Years, 5 Months ago
InvertHtml converts an HTML page with embedded Suneido code into Suneido code with embedded HTML. You have to Eval the result of InvertHtml to get the resulting HTML page. It seems strange but the advantage is that you can do things like putting loops and if's into your page. For example:

Code:

InvertHtml("<table>
<$ for (i in Seq(5)) { -$>
<tr><td><$= i $></tr></td>
<$ } -$>
</table>"').Eval()



This is similar to Ruby on Rails .rb templates. I am not sure if we need this ability for Books, Asup may be sufficient - it is simpler and probably faster.

If we remove Eval I think the only change we would need to make to suneidoc is to change BookMenuPage(...) to <$ BookMenuPage(...) $> (including pages that add text before/after BookMenuPage).

The code for handling controls is for "program" books rather than "help" books. Look at Getting Started for a simple example. Print is normally not available on program books.
 
 
andrew