How to generate/serialize pretty printed HTML-output [message #1715672] |
Wed, 25 November 2015 03:07  |
Eclipse User |
|
|
|
Hello,
I generate an HTML page from my DSL.
Some sections of the generated HTML should look identical to the DSL text entered in the XText editor - including spaces and indentation. I'd also like to do syntax highlighting for the keywords of the DSL and generate hyperlinks for the cross references.
The model produced by the parser has lost some of the input information that I like to reproduce in my generated content: which keywords, whitespaces, indentations and line breaks were used in the input ("the token stream").
Example-DSL input:
Für alle x : ClassX
mit: x.wert < "100"
gilt: x.kategorie = "teuer"
The desired html output should look somewhat like this:
<div>
<span class="keyword">Für alle</span>
<span class="whitespace"> </span>
<span class="identifier">x</span>
<span class="whitespace"> </span>
<span class="keyword">:</span>
<span class="whitespace"> </span>
<span class="type"><a href="link to declaration">ClassX</a></span>
<br>
...
</div>
I wonder how to approach this?
Whould it be a good idea to create a specialized Serializer?
I would appreciate some hints to point me in the right direction,
Bernd
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.06464 seconds