mecker. mecker. mecker.

SHPAML – XML-Preprocessor

SHPAML ist ein verdammt schneller und einfacher HTML/XML-Prepro­ces­sor. Die Syntax lehnt sich an Haml an und er­mög­licht ein einfaches Pro­gram­mie­ren einer Website. Für SHPAML gibt es kein Syntax-High­light­ing (obwohl das Python-High­light­ing imho ausreicht) was auch nicht nötig ist, da die Syntax auf einfachen Key-Symbolen und Ein­rü­ckung basiert.

Python

>>> from shpaml import convert_text
>>> print convert_text("b | foo")
>>> '<b>foo</b>

Diese Markup-Sprache nutze ich mitt­ler­wei­le in diversen Projekten, allen voran lilith und pastebin. Als offenes Beispiel gebe ich mal die \<entry>-Spe­zi­fi­ka­ti­on eines Atom-Feeds an. Das Beispiel benötigt pro Durchlauf gerade einmal 243.54 µsec, also nicht mal eine Mil­li­se­kun­de, sodass man SHPAML einfach überall nutzen muss.

entry
    title | Some meaningful title
    > link rel=alternate type=text/html href=http://example.com/
    id | http://localhost/
    updated | 2011-05-14T09:31:47Z
    author
        name | posativ
        uri | http://blog.posativ.org/
        email | info@posativ.org
    content type=html | ${content}

<entry>
    <title>Some meaningful title</title>
    <link rel="alternate" type="text/html" href="http://example.com/" />
    <id>http://localhost/</id>
    <updated>2011-05-14T09:31:47Z</updated>
    <author>
        <name>posativ</name>
        <uri>http://blog.posativ.org/</uri>
        <email>info@posativ.org</email>
    </author>
    <content type="html">${content}</content>
</entry>
blog comments powered by Disqus