Anonymous avatar Anonymous committed 77d47b2

0.12.2dev: Allow the underscore in link schemes, even though it's not RFC:2396 compliant, as it seems to be in widespread use in InterMapTxt.

Comments (0)

Files changed (3)

trac/wiki/parser.py

     ENDBLOCK_TOKEN = r"\}\}\}"
     ENDBLOCK = "}}}"
     
-    LINK_SCHEME = r"[a-zA-Z][-a-zA-Z0-9+.]*" # as per RFC 2396
+    LINK_SCHEME = r"[a-zA-Z][-a-zA-Z0-9+._]*" # as per RFC 2396 + '_'
     INTERTRAC_SCHEME = r"[a-zA-Z.+-]*?" # no digits (for shorthand links)
 
     QUOTED_STRING = r"'[^']+'|\"[^\"]+\""

trac/wiki/tests/formatter.py

         # -- safe schemes
         self.env.config.set('wiki', 'safe_schemes',
                             'file,ftp,http,https,svn,svn+ssh,'
-                            'rfc-2396.compatible')
+                            'rfc-2396.compatible,rfc-2396+under_score')
 
         # TODO: remove the following lines in order to discover
         #       all the places were we should use the req.href

trac/wiki/tests/wiki-tests.txt

 [svn+ssh://secureserver.org SVN link]
 rfc-2396.compatible://link
 [rfc-2396.compatible://link RFC 2396]
+rfc-2396+under_score://link
+[rfc-2396+under_score://link underscore]
 unsafe://scheme is not rendered
 ------------------------------
 <p>
 <a class="ext-link" href="svn+ssh://secureserver.org"><span class="icon"> </span>SVN link</a>
 <a class="ext-link" href="rfc-2396.compatible://link"><span class="icon"> </span>rfc-2396.compatible://link</a>
 <a class="ext-link" href="rfc-2396.compatible://link"><span class="icon"> </span>RFC 2396</a>
+<a class="ext-link" href="rfc-2396+under_score://link"><span class="icon"> </span>rfc-2396+under_score://link</a>
+<a class="ext-link" href="rfc-2396+under_score://link"><span class="icon"> </span>underscore</a>
 unsafe://scheme is not rendered
 </p>
 ------------------------------
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.