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 a. Appendix 29 30 i. Romanus eunt domus! 31 I. What did they do for us? 32 """) 33 34 sl.append("""\ 35 Hello 36 {{{{#!xxx 37 A region 38 {{{ 39 Another 40 }}} 41 End 42 }}}} 43 XXX 44 """) 45 46 sl.append("""\ 47 Hello 48 {{{{ 49 Start 50 }}} 51 Still in region 52 }}}} 53 End 54 """) 55 56 sl.append("""\ 57 Hello {{{world}}} again""") 58 59 sl.append("""\ 60 XXX 61 62 YYY""") 63 64 sl.append("""\ 65 XXX 66 ---- 67 YYY 68 ----still a rule 69 also still a rule---- 70 EOF""") 71 72 sl.append("""\ 73 = Level 1 = 74 Text 75 == Level 2 Heading == 76 Text 77 Not == a heading == 78 == Not a heading == either 79 = Mismatched heading == 80 == Another mismatched heading = 81 """) 82 83 dl = map(parse, sl) 84 nl = map(serialise, dl) 85 86 for s, n in zip(sl, nl): 87 print n == s 88 print "----" 89 print n 90 print "----" 91 92 for d in dl: 93 print 94 print "----" 95 print serialise(d, HTMLSerialiser) 96 print "----" 97 98 for d in dl: 99 print 100 print "----" 101 print d.prettyprint() 102 print "----" 103 104 # vim: tabstop=4 expandtab shiftwidth=4