1 #!/usr/bin/env python 2 3 from moinformat import parse 4 from moinformat.serialisers import serialise, HTMLSerialiser 5 6 sl = [] 7 8 sl.append("""\ 9 Hello 10 {{{{#!wiki 11 A region 12 {{{ 13 Another 14 }}} 15 End 16 }}}} 17 XXX 18 """) 19 20 sl.append("""\ 21 XXX 22 * Item 1 23 * Item 1.1 24 * Item 2 25 . Item 3 26 . Item 3.1 27 XXX 28 """) 29 30 sl.append("""\ 31 XXX 32 a. Appendix 33 34 i. Romanus eunt domus! 35 I. What did they do for us? 36 """) 37 38 sl.append("""\ 39 term:: item 40 not a term:: nor an item 41 term:: 42 :: item 43 ::non-item 44 """) 45 46 sl.append("""\ 47 Hello 48 {{{{#!xxx 49 A region 50 {{{ 51 Another 52 }}} 53 End 54 }}}} 55 XXX 56 """) 57 58 sl.append("""\ 59 Hello 60 {{{{ 61 Start 62 }}} 63 Still in region 64 }}}} 65 End 66 """) 67 68 sl.append("""\ 69 Hello {{{world}}} again""") 70 71 sl.append("""\ 72 XXX 73 74 YYY""") 75 76 sl.append("""\ 77 XXX 78 ---- 79 YYY 80 ----still a rule 81 also still a rule---- 82 EOF""") 83 84 sl.append("""\ 85 = Level 1 = 86 Text 87 == Level 2 Heading == 88 Text 89 Not == a heading == 90 == Not a heading == either 91 = Mismatched heading == 92 == Another mismatched heading = 93 === Heading __Underlined__ === 94 """) 95 96 sl.append("""\ 97 ''Some'' emphasised text. ''Emphasised''''text''. 98 99 '''Strong ''and italic'' text.''' 100 101 ''Italic and '''strong'''''. '''''Both'', strong'''. '''''Both''', italic''. 102 103 '''Strong''''''text'''. 104 105 Some `monospace` text. `Mono, '''strong'''`, __underlined__, __''under''lined__. 106 107 H,,2,,O + CO,,2,, 108 109 == e = mc^2^ == 110 111 ~+Larger...+~ and ~-smaller-~ 112 """) 113 114 sl.append("""\ 115 || Cell 1 || Cell 2 || 116 || Cell 3 || Cell 4 || 117 118 || Not a table 119 || Also not a table 120 || Almost a table || ... 121 || A table, trailing space || 122 """) 123 124 dl = map(parse, sl) 125 nl = map(serialise, dl) 126 127 for s, n in zip(sl, nl): 128 print n == s 129 print "----" 130 print n 131 print "----" 132 133 for d in dl: 134 print 135 print "----" 136 print serialise(d, HTMLSerialiser) 137 print "----" 138 139 for d in dl: 140 print 141 print "----" 142 print d.prettyprint() 143 print "----" 144 145 # vim: tabstop=4 expandtab shiftwidth=4