Next: Run-Time Options
Up: Command-Line Compiler
Previous: Building an Application
Contents
The Ur/Web compiler also supports rendering of nice HTML tutorials from Ur source files, when invoked like urweb -tutorial DIR. The directory DIR is examined for files whose names end in .ur. Every such file is translated into a .html version.
These input files follow normal Ur syntax, with a few exceptions:
- The first line must be a comment like (* TITLE *), where TITLE is a string of your choice that will be used as the title of the output page.
- While most code in the output HTML will be formatted as a monospaced code listing, text in regular Ur comments is formatted as normal English text.
- A comment like (* * HEADING *) introduces a section heading, with text HEADING of your choice.
- To include both a rendering of an Ur expression and a pretty-printed version of its value, bracket the expression with (* begin eval *) and (* end *). The result of expression evaluation is pretty-printed with show, so the expression type must belong to that type class.
- To include code that should not be shown in the tutorial (e.g., to add a show instance to use with eval), bracket the code with (* begin hide *) and (* end *).
A word of warning: as for demo generation, tutorial generation calls Emacs to syntax-highlight Ur code.
Next: Run-Time Options
Up: Command-Line Compiler
Previous: Building an Application
Contents
2014-07-14