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 """) 94 95 dl = map(parse, sl) 96 nl = map(serialise, dl) 97 98 for s, n in zip(sl, nl): 99 print n == s 100 print "----" 101 print n 102 print "----" 103 104 for d in dl: 105 print 106 print "----" 107 print serialise(d, HTMLSerialiser) 108 print "----" 109 110 for d in dl: 111 print 112 print "----" 113 print d.prettyprint() 114 print "----" 115 116 # vim: tabstop=4 expandtab shiftwidth=4