annotate MoinMoin/script/migration/_conv160_wiki.py @ 2604:27f06531a91b

1.6 converter: improve content conversion, give request obj to converter
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sun, 05 Aug 2007 00:42:20 +0200
parents c61c10e3fcde
children 482f0a9e555c
rev   line source
2599
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
1 # -*- coding: iso-8859-1 -*-
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
2 """
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
3 MoinMoin - convert content in wiki markup
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
4
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
5 Assuming we have this "renames" map:
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
6 -------------------------------------------------------
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
7 'PAGE', 'some_page' -> 'some page'
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
8 'FILE', 'with%20blank.txt' -> 'with blank.txt'
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
9
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
10 Markup transformations needed:
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
11 -------------------------------------------------------
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
12 ["some_page"] -> ["some page"] # renamed
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
13 [:some_page:some text] -> ["some page" some text] # NEW: free link with link text
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
14 [:page:text] -> ["page" text] # NEW: free link with link text
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
15 (with a page not being renamed)
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
16
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
17 attachment:with%20blank.txt -> attachment:"with blank.txt"
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
18 attachment:some_page/with%20blank.txt -> attachment:"some page/with blank.txt"
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
19 The attachment processing should also urllib.unquote the filename (or at
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
20 least replace %20 by space) and put it into "quotes" if it contains spaces.
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
21
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
22 @copyright: 2007 MoinMoin:JohannesBerg,
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
23 2007 MoinMoin:ThomasWaldmann
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
24 @license: GNU GPL, see COPYING for details.
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
25 """
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
26
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
27 import re, codecs
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
28 from MoinMoin import i18n
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
29 i18n.wikiLanguages = lambda : []
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
30 from MoinMoin import config, wikiutil
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
31 from MoinMoin.parser.text_moin_wiki import Parser
2602
b601db2e4d34 1.6 converter: improve content conversion, add test for it
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2599
diff changeset
32 from MoinMoin.action import AttachFile
2599
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
33
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
34 class Converter(Parser):
2604
27f06531a91b 1.6 converter: improve content conversion, give request obj to converter
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2603
diff changeset
35 def __init__(self, pagename, raw, renames):
27f06531a91b 1.6 converter: improve content conversion, give request obj to converter
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2603
diff changeset
36 self.request = None
2602
b601db2e4d34 1.6 converter: improve content conversion, add test for it
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2599
diff changeset
37 self.pagename = pagename
2599
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
38 self.raw = raw
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
39 self.renames = renames
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
40 self.in_pre = False
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
41 self._ = None
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
42
2602
b601db2e4d34 1.6 converter: improve content conversion, add test for it
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2599
diff changeset
43 def _replace(self, key):
2599
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
44 """ replace a item_name if it is in the renames dict """
2602
b601db2e4d34 1.6 converter: improve content conversion, add test for it
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2599
diff changeset
45 if key[0] == 'PAGE':
b601db2e4d34 1.6 converter: improve content conversion, add test for it
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2599
diff changeset
46 item_name = key[1] # pagename
b601db2e4d34 1.6 converter: improve content conversion, add test for it
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2599
diff changeset
47 elif key[0] == 'FILE':
b601db2e4d34 1.6 converter: improve content conversion, add test for it
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2599
diff changeset
48 item_name = key[2] # filename, key[1] is pagename
2599
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
49 try:
2602
b601db2e4d34 1.6 converter: improve content conversion, add test for it
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2599
diff changeset
50 return self.renames[key] # new pagename or new filename
2599
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
51 except KeyError:
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
52 return item_name
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
53
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
54 def return_word(self, word):
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
55 return word
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
56 _remark_repl = return_word
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
57 _table_repl = return_word
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
58 _tableZ_repl = return_word
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
59 _emph_repl = return_word
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
60 _emph_ibb_repl = return_word
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
61 _emph_ibi_repl = return_word
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
62 _emph_ib_or_bi_repl = return_word
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
63 _u_repl = return_word
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
64 _strike_repl = return_word
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
65 _sup_repl = return_word
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
66 _sub_repl = return_word
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
67 _small_repl = return_word
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
68 _big_repl = return_word
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
69 _tt_repl = return_word
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
70 _tt_bt_repl = return_word
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
71 _notword_repl = return_word
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
72 _rule_repl = return_word
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
73 _smiley_repl = return_word
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
74 _smileyA_repl = return_word
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
75 _ent_repl = return_word
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
76 _ent_numeric_repl = return_word
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
77 _ent_symbolic_repl = return_word
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
78 _heading_repl = return_word
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
79 _email_repl = return_word
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
80 _macro_repl = return_word
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
81 _word_repl = return_word
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
82 _indent_repl = return_word
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
83 _li_none_repl = return_word
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
84 _li_repl = return_word
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
85 _ol_repl = return_word
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
86 _dl_repl = return_word
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
87 _comment_repl = return_word
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
88
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
89 # PRE SECTION HANDLING ---------------------------------------------------
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
90
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
91 def _pre_repl(self, word):
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
92 origw = word
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
93 word = word.strip()
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
94 if word == '{{{' and not self.in_pre:
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
95 self.in_pre = True
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
96 return origw
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
97 elif word == '}}}' and self.in_pre:
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
98 self.in_pre = False
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
99 return origw
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
100 return word
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
101
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
102 def _parser_repl(self, word):
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
103 origw = word
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
104 if word.startswith('{{{'):
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
105 word = word[3:]
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
106
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
107 s_word = word.strip()
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
108 self.in_pre = True
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
109 return origw
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
110
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
111 # LINKS ------------------------------------------------------------------
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
112
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
113 def _replace_target(self, target):
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
114 target_and_anchor = target.split('#', 1)
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
115 if len(target_and_anchor) > 1:
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
116 target, anchor = target_and_anchor
2602
b601db2e4d34 1.6 converter: improve content conversion, add test for it
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2599
diff changeset
117 target = self._replace(('PAGE', target))
2599
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
118 return '%s#%s' % (target, anchor)
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
119 else:
2602
b601db2e4d34 1.6 converter: improve content conversion, add test for it
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2599
diff changeset
120 target = self._replace(('PAGE', target))
2599
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
121 return target
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
122
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
123 def interwiki(self, target_and_text, **kw):
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
124 # TODO: maybe support [wiki:Page http://wherever/image.png] ?
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
125 scheme, rest = target_and_text.split(':', 1)
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
126 wikiname, pagename, text = wikiutil.split_wiki(rest)
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
127 #self.request.log("interwiki: split_wiki -> %s.%s.%s" % (wikiname,pagename,text))
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
128
2604
27f06531a91b 1.6 converter: improve content conversion, give request obj to converter
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2603
diff changeset
129 wikiname_lower = wikiname.lower()
27f06531a91b 1.6 converter: improve content conversion, give request obj to converter
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2603
diff changeset
130 if wikiname_lower == 'self' or wikiname_lower == self.request.cfg.interwikiname: # [wiki:Self:LocalPage text] or [:LocalPage:text]
2603
c61c10e3fcde 1.6 converter: improve content conversion, more tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2602
diff changeset
131 pagename = self._replace(('PAGE', pagename))
c61c10e3fcde 1.6 converter: improve content conversion, more tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2602
diff changeset
132 if not text:
c61c10e3fcde 1.6 converter: improve content conversion, more tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2602
diff changeset
133 return '[%s]' % wikiutil.quoteName(pagename) # ["LocalPage"]
c61c10e3fcde 1.6 converter: improve content conversion, more tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2602
diff changeset
134 else:
c61c10e3fcde 1.6 converter: improve content conversion, more tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2602
diff changeset
135 return '[%s %s]' % (wikiutil.quoteName(pagename), text) # ["LocalPage" text]
2599
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
136
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
137 # check for image URL, and possibly return IMG tag
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
138 if not kw.get('pretty_url', 0) and wikiutil.isPicture(pagename):
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
139 dummy, wikiurl, dummy, wikitag_bad = wikiutil.resolve_wiki(self.request, rest)
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
140 href = wikiutil.join_wiki(wikiurl, pagename)
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
141 #self.request.log("interwiki: join_wiki -> %s.%s.%s" % (wikiurl,pagename,href))
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
142 return target_and_text # self.formatter.image(src=href)
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
143
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
144 return target_and_text # wikiname, pagename, text
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
145
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
146 def attachment(self, target_and_text, **kw):
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
147 """ This gets called on attachment URLs """
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
148 _ = self._
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
149 #self.request.log("attachment: target_and_text %s" % target_and_text)
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
150 scheme, fname, text = wikiutil.split_wiki(target_and_text)
2602
b601db2e4d34 1.6 converter: improve content conversion, add test for it
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2599
diff changeset
151 pagename, fname = AttachFile.absoluteName(fname, self.pagename)
b601db2e4d34 1.6 converter: improve content conversion, add test for it
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2599
diff changeset
152 from_this_page = pagename == self.pagename
b601db2e4d34 1.6 converter: improve content conversion, add test for it
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2599
diff changeset
153 fname = self._replace(('FILE', pagename, fname))
b601db2e4d34 1.6 converter: improve content conversion, add test for it
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2599
diff changeset
154 if '%20' in fname:
b601db2e4d34 1.6 converter: improve content conversion, add test for it
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2599
diff changeset
155 fname = fname.replace('%20', ' ')
b601db2e4d34 1.6 converter: improve content conversion, add test for it
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2599
diff changeset
156 fname = self._replace(('FILE', pagename, fname))
b601db2e4d34 1.6 converter: improve content conversion, add test for it
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2599
diff changeset
157 pagename = self._replace(('PAGE', pagename))
b601db2e4d34 1.6 converter: improve content conversion, add test for it
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2599
diff changeset
158 if from_this_page:
b601db2e4d34 1.6 converter: improve content conversion, add test for it
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2599
diff changeset
159 name = fname
b601db2e4d34 1.6 converter: improve content conversion, add test for it
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2599
diff changeset
160 else:
b601db2e4d34 1.6 converter: improve content conversion, add test for it
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2599
diff changeset
161 name = "%s/%s" % (pagename, fname)
b601db2e4d34 1.6 converter: improve content conversion, add test for it
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2599
diff changeset
162 if ' ' in name:
b601db2e4d34 1.6 converter: improve content conversion, add test for it
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2599
diff changeset
163 qname = wikiutil.quoteName(name)
b601db2e4d34 1.6 converter: improve content conversion, add test for it
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2599
diff changeset
164 else:
b601db2e4d34 1.6 converter: improve content conversion, add test for it
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2599
diff changeset
165 qname = name
2599
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
166
2602
b601db2e4d34 1.6 converter: improve content conversion, add test for it
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2599
diff changeset
167 if text:
b601db2e4d34 1.6 converter: improve content conversion, add test for it
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2599
diff changeset
168 text = ' ' + text
b601db2e4d34 1.6 converter: improve content conversion, add test for it
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2599
diff changeset
169 return "%s:%s%s" % (scheme, qname, text)
2599
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
170
2603
c61c10e3fcde 1.6 converter: improve content conversion, more tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2602
diff changeset
171 def _interwiki_repl(self, word):
c61c10e3fcde 1.6 converter: improve content conversion, more tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2602
diff changeset
172 """Handle InterWiki links."""
2604
27f06531a91b 1.6 converter: improve content conversion, give request obj to converter
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2603
diff changeset
173 wikitag, wikiurl, wikitail, wikitag_bad = wikiutil.resolve_wiki(self.request, word)
27f06531a91b 1.6 converter: improve content conversion, give request obj to converter
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2603
diff changeset
174 if wikitag_bad:
27f06531a91b 1.6 converter: improve content conversion, give request obj to converter
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2603
diff changeset
175 return word
27f06531a91b 1.6 converter: improve content conversion, give request obj to converter
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2603
diff changeset
176 else:
27f06531a91b 1.6 converter: improve content conversion, give request obj to converter
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2603
diff changeset
177 result = self.interwiki("wiki:" + word)
27f06531a91b 1.6 converter: improve content conversion, give request obj to converter
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2603
diff changeset
178 if result.startswith("wiki:"):
27f06531a91b 1.6 converter: improve content conversion, give request obj to converter
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2603
diff changeset
179 result = result[5:]
27f06531a91b 1.6 converter: improve content conversion, give request obj to converter
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2603
diff changeset
180 return result
2603
c61c10e3fcde 1.6 converter: improve content conversion, more tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2602
diff changeset
181
2599
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
182 def _url_repl(self, word):
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
183 """Handle literal URLs including inline images."""
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
184 scheme = word.split(":", 1)[0]
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
185
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
186 if scheme == "wiki":
2603
c61c10e3fcde 1.6 converter: improve content conversion, more tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2602
diff changeset
187 return self.interwiki(word)
2599
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
188
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
189 if scheme in self.attachment_schemas:
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
190 return self.attachment(word)
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
191
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
192 if wikiutil.isPicture(word):
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
193 # Get image name http://here.com/dir/image.gif -> image
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
194 name = word.split('/')[-1]
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
195 name = ''.join(name.split('.')[:-1])
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
196 return word # self.formatter.image(src=word, alt=name)
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
197 else:
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
198 return word # word, scheme
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
199
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
200 def _wikiname_bracket_repl(self, text):
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
201 """Handle special-char wikinames with link text, like:
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
202 ["Jim O'Brian" Jim's home page] or ['Hello "world"!' a page with doublequotes]i
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
203 """
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
204 word = text[1:-1] # strip brackets
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
205 first_char = word[0]
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
206 if first_char in wikiutil.QUOTE_CHARS:
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
207 # split on closing quote
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
208 target, linktext = word[1:].split(first_char, 1)
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
209 target = self._replace_target(target)
2602
b601db2e4d34 1.6 converter: improve content conversion, add test for it
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2599
diff changeset
210 target = wikiutil.quoteName(target)
2599
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
211 else: # not quoted
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
212 # split on whitespace
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
213 target, linktext = word.split(None, 1)
2602
b601db2e4d34 1.6 converter: improve content conversion, add test for it
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2599
diff changeset
214 target = self._replace_target(target)
b601db2e4d34 1.6 converter: improve content conversion, add test for it
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2599
diff changeset
215 if ' ' in target:
b601db2e4d34 1.6 converter: improve content conversion, add test for it
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2599
diff changeset
216 target = wikiutil.quoteName(target)
b601db2e4d34 1.6 converter: improve content conversion, add test for it
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2599
diff changeset
217 if linktext:
b601db2e4d34 1.6 converter: improve content conversion, add test for it
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2599
diff changeset
218 linktext = ' ' + linktext
b601db2e4d34 1.6 converter: improve content conversion, add test for it
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2599
diff changeset
219 return '[%s%s]' % (target, linktext)
2599
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
220
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
221
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
222 def _url_bracket_repl(self, word):
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
223 """Handle bracketed URLs."""
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
224 word = word[1:-1] # strip brackets
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
225
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
226 # Local extended link? [:page name:link text]
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
227 if word[0] == ':':
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
228 words = word[1:].split(':', 1)
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
229 words[0] = self._replace_target(words[0])
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
230 if len(words) == 1:
2602
b601db2e4d34 1.6 converter: improve content conversion, add test for it
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2599
diff changeset
231 link = words[0]
b601db2e4d34 1.6 converter: improve content conversion, add test for it
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2599
diff changeset
232 link = wikiutil.quoteName(link)
b601db2e4d34 1.6 converter: improve content conversion, add test for it
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2599
diff changeset
233 return '[%s]' % link # use freelink
b601db2e4d34 1.6 converter: improve content conversion, add test for it
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2599
diff changeset
234 else:
b601db2e4d34 1.6 converter: improve content conversion, add test for it
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2599
diff changeset
235 link, text = words
b601db2e4d34 1.6 converter: improve content conversion, add test for it
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2599
diff changeset
236 link = wikiutil.quoteName(link)
b601db2e4d34 1.6 converter: improve content conversion, add test for it
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2599
diff changeset
237 if text:
b601db2e4d34 1.6 converter: improve content conversion, add test for it
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2599
diff changeset
238 text = ' ' + text
b601db2e4d34 1.6 converter: improve content conversion, add test for it
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2599
diff changeset
239 return '[%s%s]' % (link, text) # use freelink with text
2599
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
240
2603
c61c10e3fcde 1.6 converter: improve content conversion, more tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2602
diff changeset
241 scheme_and_rest = word.split(":", 1)
c61c10e3fcde 1.6 converter: improve content conversion, more tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2602
diff changeset
242 if len(scheme_and_rest) == 2: # scheme given
c61c10e3fcde 1.6 converter: improve content conversion, more tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2602
diff changeset
243 scheme, rest = scheme_and_rest
c61c10e3fcde 1.6 converter: improve content conversion, more tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2602
diff changeset
244 if scheme == "wiki":
c61c10e3fcde 1.6 converter: improve content conversion, more tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2602
diff changeset
245 return self.interwiki(word, pretty_url=1)
c61c10e3fcde 1.6 converter: improve content conversion, more tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2602
diff changeset
246 if scheme in self.attachment_schemas:
c61c10e3fcde 1.6 converter: improve content conversion, more tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2602
diff changeset
247 return self.attachment(word, pretty_url=1)
2599
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
248
2603
c61c10e3fcde 1.6 converter: improve content conversion, more tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2602
diff changeset
249 words = word.split(None, 1)
c61c10e3fcde 1.6 converter: improve content conversion, more tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2602
diff changeset
250 if len(words) == 1:
c61c10e3fcde 1.6 converter: improve content conversion, more tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2602
diff changeset
251 link, text = words[0], ''
c61c10e3fcde 1.6 converter: improve content conversion, more tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2602
diff changeset
252 else:
c61c10e3fcde 1.6 converter: improve content conversion, more tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2602
diff changeset
253 link, text = words
c61c10e3fcde 1.6 converter: improve content conversion, more tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2602
diff changeset
254 if text:
c61c10e3fcde 1.6 converter: improve content conversion, more tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2602
diff changeset
255 text = ' ' + text
c61c10e3fcde 1.6 converter: improve content conversion, more tests
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2602
diff changeset
256 return '[%s%s]' % (link, text)
2599
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
257
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
258 # SCANNING ---------------------------------------------------------------
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
259 def scan(self, scan_re, line):
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
260 """ Scans one line
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
261
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
262 Append text before match, invoke replace() with match, and add text after match.
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
263 """
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
264 result = []
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
265 lastpos = 0
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
266
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
267 for match in scan_re.finditer(line):
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
268 # Add text before the match
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
269 if lastpos < match.start():
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
270 result.append(line[lastpos:match.start()])
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
271 # Replace match with markup
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
272 result.append(self.replace(match))
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
273 lastpos = match.end()
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
274
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
275 # Add remainder of the line
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
276 result.append(line[lastpos:])
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
277 return u''.join(result)
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
278
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
279 def replace(self, match):
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
280 """ Replace match using type name """
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
281 result = []
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
282 for _type, hit in match.groupdict().items():
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
283 if hit is not None and not _type in ["hmarker", ]:
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
284 # Get replace method and replace hit
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
285 replace = getattr(self, '_' + _type + '_repl')
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
286 result.append(replace(hit))
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
287 return ''.join(result)
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
288 else:
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
289 # We should never get here
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
290 import pprint
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
291 raise Exception("Can't handle match %r\n%s\n%s" % (
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
292 match,
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
293 pprint.pformat(match.groupdict()),
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
294 pprint.pformat(match.groups()),
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
295 ))
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
296
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
297 return ""
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
298
2604
27f06531a91b 1.6 converter: improve content conversion, give request obj to converter
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2603
diff changeset
299 def convert(self, request):
2599
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
300 """ For each line, scan through looking for magic
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
301 strings, outputting verbatim any intervening text.
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
302 """
2604
27f06531a91b 1.6 converter: improve content conversion, give request obj to converter
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2603
diff changeset
303 self.request = request
2599
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
304 # prepare regex patterns
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
305 rules = self.formatting_rules.replace('\n', '|')
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
306 if 1: # self.cfg.bang_meta:
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
307 rules = ur'(?P<notword>!%(word_rule)s)|%(rules)s' % {
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
308 'word_rule': self.word_rule,
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
309 'rules': rules,
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
310 }
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
311 pre_rules = self.pre_formatting_rules.replace('\n', '|')
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
312 scan_re = re.compile(rules, re.UNICODE)
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
313 pre_scan_re = re.compile(pre_rules, re.UNICODE)
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
314 eol_re = re.compile(r'\r?\n', re.UNICODE)
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
315
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
316 rawtext = self.raw
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
317
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
318 # remove last item because it's guaranteed to be empty
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
319 self.lines = eol_re.split(rawtext)[:-1]
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
320 self.in_processing_instructions = 1
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
321
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
322 # Main loop
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
323 for line in self.lines:
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
324 # ignore processing instructions
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
325 if self.in_processing_instructions:
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
326 found = False
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
327 for pi in ("##", "#format", "#refresh", "#redirect", "#deprecated",
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
328 "#pragma", "#form", "#acl", "#language"):
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
329 if line.lower().startswith(pi):
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
330 self.request.write(line + '\r\n')
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
331 found = True
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
332 break
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
333 if not found:
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
334 self.in_processing_instructions = 0
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
335 else:
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
336 continue # do not parse this line
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
337 if self.in_pre:
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
338 # still looking for processing instructions
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
339 if self.in_pre == 'search_parser':
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
340 if line.strip().startswith("#!"):
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
341 self.in_pre = True
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
342 self.request.write(line + '\r\n')
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
343 continue
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
344 else:
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
345 self.in_pre = True
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
346 else:
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
347 # Paragraph break on empty lines
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
348 if not line.strip():
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
349 self.request.write(line + '\r\n')
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
350 continue
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
351
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
352 # Scan line, format and write
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
353 scanning_re = self.in_pre and pre_scan_re or scan_re
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
354 formatted_line = self.scan(scanning_re, line)
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
355 self.request.write(formatted_line + '\r\n')
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
356
2604
27f06531a91b 1.6 converter: improve content conversion, give request obj to converter
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2603
diff changeset
357 def convert_wiki(request, pagename, intext, renames):
2599
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
358 """ Convert content written in wiki markup """
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
359 noeol = False
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
360 if not intext.endswith('\r\n'):
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
361 intext += '\r\n'
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
362 noeol = True
2604
27f06531a91b 1.6 converter: improve content conversion, give request obj to converter
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2603
diff changeset
363 p = Converter(pagename, intext, renames)
27f06531a91b 1.6 converter: improve content conversion, give request obj to converter
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2603
diff changeset
364 res = request.redirectedOutput(p.convert, request)
2599
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
365 if noeol:
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
366 res = res[:-2]
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
367 return res
13f0331f3a42 1.6 converter: add content conversion (unfinished), cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
368