Channel MOTD Markup Language


(Thomion) #1

I’m trying to parse a channel MOTD but it seems to be a bit more complex and I could not find any documentation.

Here the example I got via XML API, truncated for this purpose:

    <br>
    <b><i><fontsize=24>
            <color=0xffffffff>
            Awesome MOTD
    </fontsize></b></i>
    <br>
    <u><fontsize=14>
           Some Title</color>
    </u>
    <br>
    <loc>
        <url=http://www.example.org/>
        NEW EXAMPLE WEBSITE
        </url>
        </fontsize>
    </loc>
    <br>
    ....

I tried to indent the example as good as possible, but as it turns out this not XML but rather interleaved XML-ish tags.

Is there any documentation of this markup language? Is it maybe a well-known one?
Or is there even a library that can parse or transform it?


(Blacksmoke16) #2

It is probably an old markup variation of XML/HTML, best bet would be to probably make your own parser to convert the eve specific parts ie fontsize=14, to a more standard css style then assume the rest is html.

For example:

    <loc>
        <url=http://www.example.org/>
        NEW EXAMPLE WEBSITE
        </url>
        </fontsize>
    </loc>

Parse that into like:

<a href="https://www.example.org" style="fontsize: large;">NEW EXAMPLE WEBSITE </a>

(Thomion) #3

That was my first approach, but the markup is not XML structure wise and can probably also not be directly parsed into a tree/XML DOM like structure. This makes all XML parsers useless. Some html parsers are forgiving enough to work to some degree.

The best I have so far is to make extensive use of regular expressions :confused:

What might work is to lex the raw string and then transform it such that it can be parsed as a tree.

e.g.

Step 1: on out-of-order </b> tag, reorder
<b><fontsize=14><i>Hello</b></fontsize></i>
                          ^
Step 2: on out-of-order </b> tag, reorder
<b><fontsize=14><i>Hello</i></b></fontsize>
                              ^                                                  
Result: What I'd call 'CCP XML-ish'
<b><fontsize=14><i>Hello</i></fontsize></b>

Step3: Now we have proper XML structure, convert to HTML
<b><font size="14"><i>Hello</i></font></b>

But for that I’d need to write a proper lexer and transformator :frowning:


(Blacksmoke16) #4

:confused: Hmm.