Dateianhang 'isbn.patch'
Herunterladen
Zeilennummern ein/ausschalten
1 --- text_moin_wiki.py-orig 2009-08-20 21:40:10.000000000 +0200
2 +++ text_moin_wiki.py 2009-08-25 23:09:41.000000000 +0200
3 @@ -301,6 +301,10 @@
4 ` # teletype (using a backtick) on
5 (?P<tt_bt_text>.*?) # capture the text
6 ` # off
7 +)|(?P<isbn>
8 + ISBN[: ]?([0-9- xX]{10,14})
9 +)|(?P<asin>
10 + ASIN[: ]?(\w{10,10})
11 )|(?P<interwiki>
12 %(interwiki_rule)s # OtherWiki:PageName
13 )|(?P<word> # must come AFTER interwiki rule!
14 @@ -912,6 +916,19 @@
15 _link_desc_repl = _link_repl
16 _link_params_repl = _link_repl
17
18 + def _isbn_repl(self, word, groups):
19 + """Handle ISBN numbers."""
20 + raw_nr = re.sub(r'ISBN[: ]+', '', word.strip())
21 + raw_nr = re.sub(r'-', '', raw_nr)
22 + return (self.formatter.url(1, ('http://www.amazon.de/dp/%s/?tag=larpwiki-21') % (raw_nr)) +
23 + self.formatter.text("ISBN " + raw_nr) + self.formatter.url(0))
24 + #_asin_repl = _isbn_repl
25 +
26 + def _asin_repl(self, word, groups):
27 + """Handle Amazons's ASIN numbers."""
28 + raw_nr = re.sub(r'ASIN[: ]+', '', word)
29 + return (self.formatter.url(1, ('http://www.amazon.de/dp/%s/?tag=larpwiki-21') % (raw_nr)) + self.formatter.text("ASIN " + raw_nr) + self.formatter.url(0))
30 +
31 def _email_repl(self, word, groups):
32 """Handle email addresses (without a leading mailto:)."""
33 return (self.formatter.url(1, "mailto:%s" % word, css='mailto') +