[ocamlweb-devel] syntax highlighting

Christophe TROESTLER Christophe.Troestler at umons.ac.be
Tue Jan 8 05:21:10 GMT 2013


Hi Maxence,

Thanks for your suggestions.

On Wed, 19 Dec 2012 16:10:17 +0100, Maxence Guesdon wrote:
> 
> Looking at the source of main page, I see that highlighting requires
> adding attributes to <pre> nodes:
>   <pre class="listing" ml:content="ocaml noeval">
>    ...
>   </pre>

Only the “ml:content="ocaml noeval"”, the other one is inherited from
the HTML of the tutorials.  You can remove the “noeval” if you wan the
code to be evaluated in the toplevel.

> I find it quite heavy to type all this each time a piece of ocaml code
> is to be included. Is there a lighter way ?

Not for know.

> Another question: Is there a way to include an ocaml file ?

There was a couple of days ago but I removed if — it enabled to select
lines but it was considered too brittle.

> And more generally: Is there a way to define some kind of rewrite rules
> on nodes ? For example to we able to define that
>   <ocaml>...</ocaml>
> should be rewritten
>   <pre class="listing" ml:content="ocaml noeval">...</pre>
> ?

Not for now.  One of the original goal of weberizer was to be HTML
compatible so that visual tools can be used to edit the file without
messing the code.  Now, the build runs a function of type html → html
on all files so that is easy enough to do rewriting if we want to.  I
wonder though if it is not better then to pursue the idea further and
allow (part of) the documents to be written in an extensible WIKI
syntax (the extension would for example make possible to define
buttons).  Not sure which way to go yet.

Best,
C.



More information about the Infrastructure mailing list