July 30, 2003

Testing MT - what HTML can I use?

This entry is only for me to check what happens to HTML I type in, and how it's stored in MT's database. Here goes...

entities followed by the actual symbol:
right angle bracket; > >
left angle bracket; < <
ampersand; & &
angle brackets; ><>< ><><
writing an entity by encoding the ampersand; &gt; &amp; &lt; should be the code to display < & >
basic tags; strong text
paragraphs, with <p> tags;

This is a sentence of text. The sentence is a building block of the paragraph. This is a sentence of text. The sentence is a building block of the paragraph.


paragraphs, without <p> tags;
This is a sentence of text. The sentence is a building block of the paragraph. This is a sentence of text. The sentence is a building block of the paragraph.

this text is formatted using the <pre> tag. It also contains html
this text is formatted using the <code> tag. It also contains html this text is formatted using the <code> tag. It also contains html. Finally it has a lang="html" attribute.
this text is formatted using the <blockquote> tag. It also contains html, and a cite url attribute

now to get really funky:
Japanese, straight text;
Romanji 日本語 カタカナ
日本語 fat letters Japanese romanji

Japanese wrapped in a <p> tag with lang="ja";

Romanji 日本語 カタカナ
日本語 fat letters Japanese romanji

I'll publish with "convert line breaks" and see what happens. Read on for the results...

Results:


"Convert Line Breaks" replaces them with <br /> tags. With "None" no additional HTML formatting is applied.
Entities and standard symbols (like < and &) are not converted, unlike Geeklog (yay!)
Tags are also not converted, and so they'll be applied when the page is displayed (again yay!)
<code>, <pre> and <blockquote> tags are all rendered as expected, with any contained html also being rendered.
Japanese displays fine!
Making wack tags like <?> without using entities leads to a very unhelpful parse error (why doesn't it display the line of code containing the error? dumb)

This seems a lot better than the Geeklog system of converting all code to entities, entities' ampersands to ampersand entities, marking apostrophies and line breaks as \' and \r, and using a code tag for block level html that you want to display as code. Much better!
When I want to display HTML I just have to entity all the angle brackets in tags, and entity the ampersands when I want to display entity codes. Just like usual. The result is also much more portable - stripping Geeklog's cruft out of my old articles has taken ages!

Posted by Oli at July 30, 2003 06:47 PM
Comments
Post a comment









Remember personal info?