changeset 1694:fdf01f9f3143

Use OtherWiki: as abbreviation for an interwiki link to a TwinPage, fix bug for interwiki links with empty pagename
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sat, 02 Dec 2006 22:32:44 +0100
parents 2014428d99ca
children 9ae9f564380e
files MoinMoin/parser/text_moin_wiki.py MoinMoin/wikiutil.py docs/CHANGES
diffstat 3 files changed, 15 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/parser/text_moin_wiki.py	Sat Dec 02 18:10:30 2006 +0100
+++ b/MoinMoin/parser/text_moin_wiki.py	Sat Dec 02 22:32:44 2006 +0100
@@ -89,7 +89,7 @@
 (?P<tableZ>\|\| $)
 (?P<table>(?:\|\|)+(?:<[^>]*?>)?(?!\|? $))
 (?P<heading>^\s*(?P<hmarker>=+)\s.*\s(?P=hmarker) $)
-(?P<interwiki>[A-Z][a-zA-Z]+\:(%(q_string)s|([^\s'\"\:\<\|]([^\s%(punct)s]|([%(punct)s][^\s%(punct)s]))+)))
+(?P<interwiki>[A-Z][a-zA-Z]+\:(%(q_string)s|([^\s'\"\:\<\|]([^\s%(punct)s]|([%(punct)s][^\s%(punct)s]))+))?)
 (?P<word>%(word_rule)s)
 (?P<url_bracket>\[((%(url)s)\:|#|\:)[^\s\]]+(\s[^\]]+)?\])
 (?P<url>%(url_rule)s)
@@ -178,6 +178,8 @@
         # TODO: maybe support [wiki:Page http://wherever/image.png] ?
         scheme, rest = target_and_text.split(':', 1)
         wikiname, pagename, text = wikiutil.split_wiki(rest)
+        if not pagename:
+            pagename = self.formatter.page.page_name
         if not text:
             text = pagename
         #self.request.log("interwiki: split_wiki -> %s.%s.%s" % (wikiname,pagename,text))
--- a/MoinMoin/wikiutil.py	Sat Dec 02 18:10:30 2006 +0100
+++ b/MoinMoin/wikiutil.py	Sat Dec 02 22:32:44 2006 +0100
@@ -616,11 +616,14 @@
             wikiname, rest = wikiurl.split("/", 1) # for what is this used?
         except ValueError:
             wikiname, rest = 'Self', wikiurl
-    first_char = rest[0]
-    if first_char in QUOTE_CHARS: # quoted pagename
-        pagename_linktext = rest[1:].split(first_char, 1)
-    else: # not quoted, split on whitespace
-        pagename_linktext = rest.split(None, 1)
+    if rest:
+        first_char = rest[0]
+        if first_char in QUOTE_CHARS: # quoted pagename
+            pagename_linktext = rest[1:].split(first_char, 1)
+        else: # not quoted, split on whitespace
+            pagename_linktext = rest.split(None, 1)
+    else:
+        pagename_linktext = "", ""
     if len(pagename_linktext) == 1:
         pagename, linktext = pagename_linktext[0], ""
     else:
--- a/docs/CHANGES	Sat Dec 02 18:10:30 2006 +0100
+++ b/docs/CHANGES	Sat Dec 02 22:32:44 2006 +0100
@@ -122,7 +122,6 @@
     * smileys moved from MoinMoin.config to MoinMoin.theme
     * removed all _ magic in URLs and filenames
       TODO: write mig script for data_dir
-      TODO: make blanks in interwiki pagelinks possible
     * request.action now has the action requested, default: 'show'.
     * Cleaned up duplicated http_headers code and DEPRECATED this function
       call (it was sometimes confused with setHttpHeaders call) - it will
@@ -272,6 +271,10 @@
     * cfg.quicklinks_default and cfg.subscribed_pages_default can be used to
       preload new user profiles with configurable values.
     * added support for ircs: URLs (secure IRC)
+    * it is allowed now to use interwiki links with empty pagename, like
+      MoinMoin: (no page name after the colon). MoinMoin then uses the current
+      page name as the default. This is a useful abbreviation for TwinPages in
+      other wikis.
 
   Bugfixes:
     * on action "info" page, "revert" link will not be displayed for empty page