[erlang-questions] beginner: Generating HTML with ">" from Erlang

Bengt Kleberg <>
Thu Feb 13 15:47:33 CET 2014


Thank you, new idea. Perhaps I have another bug in my copy of the
Javascript? Replacing all > with > also fixes that bug?

I will look really carefully.


bengt

On Thu, 2014-02-13 at 18:35 +0400, Сергей Прохоров wrote:
> I'm sure, that embedded Javascript understands > and < instead
> of > and < characters, so
> 
> 
> <script>
> if (a &gt b) alert("a greater than b");
> </script>
> 
> 
> should work.
> 
> 
> You may also try Mochiweb's HTML parser/serializer, which is much
> simpler and faster, than xmerl
> https://github.com/mochi/mochiweb/blob/master/src/mochiweb_html.erl
> 
> 
> 
> Tree = {<<"html">>, [{<<"lang">>, <<"en">>}],
>             [...child tags...]},
> mochiweb_html:to_html(Tree).
> 
> 
> But I'm not sure if it escapes special characters.




More information about the erlang-questions mailing list