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 108 dl = map(parse, sl) 109 nl = map(serialise, dl) 110 111 for s, n in zip(sl, nl): 112 print n == s 113 print "----" 114 print n 115 print "----" 116 117 for d in dl: 118 print 119 print "----" 120 print serialise(d, HTMLSerialiser) 121 print "----" 122 123 for d in dl: 124 print 125 print "----" 126 print d.prettyprint() 127 print "----" 128 129 # vim: tabstop=4 expandtab shiftwidth=4