Attachment 'dashes.patch'
Download 1 ---
2 MoinMoin/formatter/__init__.py | 6 ++++++
3 MoinMoin/formatter/dom_xml.py | 4 ++++
4 MoinMoin/formatter/text_html.py | 4 ++++
5 MoinMoin/formatter/text_plain.py | 5 +++++
6 MoinMoin/formatter/text_xml.py | 6 ++++++
7 MoinMoin/parser/text_moin_wiki.py | 6 ++++++
8 6 files changed, 31 insertions(+)
9
10 --- moin.orig/MoinMoin/formatter/__init__.py 2007-04-02 19:08:17.000000000 +0200
11 +++ moin/MoinMoin/formatter/__init__.py 2007-04-02 19:10:43.000000000 +0200
12 @@ -230,6 +230,12 @@ class FormatterBase:
13 def big(self, on, **kw):
14 raise NotImplementedError
15
16 + def endash(self, **kw):
17 + raise NotImplementedError
18 +
19 + def emdash(self, **kw):
20 + raise NotImplementedError
21 +
22 # special markup for syntax highlighting #############################
23
24 def code_area(self, on, code_id, **kw):
25 --- moin.orig/MoinMoin/formatter/dom_xml.py 2007-04-02 19:11:19.000000000 +0200
26 +++ moin/MoinMoin/formatter/dom_xml.py 2007-04-02 19:18:09.000000000 +0200
27 @@ -380,4 +380,8 @@ class Formatter(FormatterBase):
28 def code_token(self, on, tok_type):
29 return self._set_tag('codetoken', on, type=tok_type)
30
31 + def endash(self, **kw):
32 + return '–'
33
34 + def emdash(self, **kw):
35 + return '—'
36 --- moin.orig/MoinMoin/formatter/text_html.py 2007-04-02 19:08:11.000000000 +0200
37 +++ moin/MoinMoin/formatter/text_html.py 2007-04-02 19:13:40.000000000 +0200
38 @@ -1362,4 +1362,8 @@ document.write('<a href="#" onclick="ret
39 return self._open(tag, **kw)
40 return self._close(tag)
41
42 + def endash(self, **kw):
43 + return '–'
44
45 + def emdash(self, **kw):
46 + return '—'
47 --- moin.orig/MoinMoin/formatter/text_plain.py 2007-04-02 19:11:19.000000000 +0200
48 +++ moin/MoinMoin/formatter/text_plain.py 2007-04-02 19:10:43.000000000 +0200
49 @@ -250,3 +250,8 @@ class Formatter(FormatterBase):
50 def lang(self, on, lang_name):
51 return ''
52
53 + def endash(self, **kw):
54 + return '--'
55 +
56 + def emdash(self, **kw):
57 + return '---'
58 --- moin.orig/MoinMoin/formatter/text_xml.py 2007-04-02 19:11:19.000000000 +0200
59 +++ moin/MoinMoin/formatter/text_xml.py 2007-04-02 19:17:22.000000000 +0200
60 @@ -212,3 +212,9 @@ class Formatter(FormatterBase):
61
62 def code_token(self, on, tok_type):
63 return ('<codetoken type="%s">' % tok_type, '</codetoken')[not on]
64 +
65 + def endash(self, **kw):
66 + return '–'
67 +
68 + def emdash(self, **kw):
69 + return '—'
70 --- moin.orig/MoinMoin/parser/text_moin_wiki.py 2007-04-02 19:19:04.000000000 +0200
71 +++ moin/MoinMoin/parser/text_moin_wiki.py 2007-04-02 19:25:27.000000000 +0200
72 @@ -79,6 +79,7 @@ class Parser:
73 (?P<big>(\~\+ ?|\+\~))
74 (?P<strike>(--\(|\)--))
75 (?P<remark>(/\* ?| ?\*/))
76 +(?P<dash>-{2,3})
77 (?P<rule>-{4,})
78 (?P<comment>^\#\#.*$)
79 (?P<macro>\[\[(%%(macronames)s)(?:\(.*?\))?\]\]))
80 @@ -319,6 +320,11 @@ class Parser:
81 self.formatter.text(word[2:-2]) + \
82 self.formatter.sub(0)
83
84 + def _dash_repl(self, word):
85 + if len(word) == 2:
86 + return self.formatter.endash()
87 + else:
88 + return self.formatter.emdash()
89
90 def _rule_repl(self, word):
91 """Handle sequences of dashes."""
Attached Files
To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.You are not allowed to attach a file to this page.