Changeset 20:0da34e6ab266 in misc
- Timestamp:
- 08/20/07 17:00:36 (5 years ago)
- Branch:
- misc
- Convert:
- svn:e60e002c-0983-44b9-b2ae-8842d539f768/misc@23
- File:
-
- 1 edited
-
wikka2doku.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wikka2doku.py
r19 r20 56 56 return l 57 57 58 def trasftable(mo): 59 columns = int(mo.groups()[0]) 60 cells = mo.groups()[1] 61 tablestr = '' 62 63 splitted_cells = cells.split(';') 64 heading = splitted_cells[:columns] 65 body = splitted_cells[columns:] 66 body = zip(*[body[i::columns] for i in range(columns)]) 67 68 tablestr = '^' + '^'.join(heading) + '^\n' 69 for cells in body: 70 tablestr += '|' + '|'.join(cells) + '|\n' 71 72 return tablestr 73 58 74 def processBodyPage(body): 59 75 link = re.compile(r'''\[\[([^\[\]]+?)\s([^\[\]]+?)\]\]''') … … 63 79 code = re.compile(r'''%%\((.*?)\)(.*?)%%''') 64 80 bold = re.compile(r'''++(.*?)++''') 81 table = re.compile(r'''{{table[ ]+columns="(.*?)".*cells="(.*?)"}}''') 82 65 83 body = body.replace('\\n', '\n') 66 84 body = body.replace('~~-', ' *') … … 76 94 body = images.sub(r'{{\1}}', body) 77 95 body = monospaced.sub(r"''\1''", body) 78 body = code.sub(r"<code \1>\2</code>", body) 79 body = bold.sub(r"<del>\1</del>", body) 96 body = code.sub(r'<code \1>\2</code>', body) 97 body = bold.sub(r'<del>\1</del>', body) 98 body = table.sub(trasftable, body) 99 80 100 return body 81 101
Note: See TracChangeset
for help on using the changeset viewer.
