#!/usr/bin/python2.7 import recentrunes mediawiki = recentrunes.Parser.fromFile('static/grammars/mediawiki.js') teststring = \ """This is a paragraph with many text styles. This is ''italic'' and this is '''bold'''; this is '''''both'''''. This is underline as is this. This is '''''underlined, bold and italic'''''. This is strikethrough, as is this. Source code looks like this. Fixed width text looks like this.
This sentence is inline pre-formatted, which stops 
'''''this from being bold and italic.'''''
We can also stop this from being underlined, or just try <pre>interrupting cow style.
This is a blockquote
== Header 2 == === Header 3 ''with italics'' === ==== Header 4 ==== ===== Header 5 ===== ====== Header 6 ====== ---- * Item 1a * Item 1b ** Item 2 *** Item 3 * Item 1c # Item 1a # Item 1b ## Item 2 ### Item 3 # Item 1c ;I don't really understand what a definition is : But blockquotes are easy :: Even larger ones ::::: And really huge ones This line is pre-formatted and not interpolated This line is also pre-formatted""" result = str(mediawiki.parseFromString(teststring)) assert result == \ """

This is a paragraph with many text styles. This is italic and this is bold; this is both. This is underline as is this. This is underlined, bold and italic. This is strikethrough, as is this. Source code looks like this. Fixed width text looks like this.

This sentence is inline pre-formatted, which stops 
'''''this from being bold and italic.'''''
We can also stop <u>this from being underlined</u>, or just try <pre>interrupting cow style.</pre>
This is a blockquote

Header 2

Header 3 with italics

Header 4

Header 5
Header 6

  1. Item 1a
  2. Item 1b
    1. Item 2
      1. Item 3
  3. Item 1c
I don't really understand what a definition is
But blockquotes are easy
Even larger ones
And really huge ones
This line is pre-formatted and <del>not interpolated</del>
This line is also pre-formatted

""", result badpenny = recentrunes.Parser.fromFile('static/grammars/badpenny.js') teststring = \ """foo{{value1}}bar foo{{(container1}}contents{{)nottheend}}more contents{{)container1}}bar foo{{[repeated1}}testing{{]notthis}}{{)repeated1}}zig{{]repeated1}}bar""" result = str(badpenny.parseFromString(teststring)) assert result == \ """foobar foocontents{{)nottheend}}more contentsbar footesting{{]notthis}}{{)repeated1}}zigbar"""