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