Skip to content

Loading…

Only comment code added #10

Merged
merged 2 commits into from

3 participants

@Sepero

Made comments to the url regex, and re-added the old code in comment form for anyone that might wish to prefer the old code. Also changed "wiki" to "wikipedia" at another location, because not all wiki's are against using line breaks.

Sepero added some commits
@Sepero Sepero Replaced orig code, but commented, added desc
Replaced the MoinMoin code, but commented, so that devs could easily replace it if they choose to. Also added comment descriptions to the new and old regex code.
0d3fb20
@Sepero Sepero Concept clarification in comments
Creating consistency. Corrected another instance of MoinMoin implying that all wiki's are opposed to linebreaks.
146f127
@travisbot

This pull request passes (merged 146f127 into 8645a5a).

@Sepero

Hey jedie, is this pull request still open?

@jedie jedie merged commit 8d3af59 into jedie:master

1 check passed

Details default The Travis build passed
@jedie
Owner

Sorry for late response. It's noe merged ;)

@Sepero

Ah, very good. I'm still working on integrating this library in my web framework. I've modified it so that urls are represented by numbers instead of page titles. (I don't want referring links going bad if the page title is changed) If I find any other good edits to make, I'll be sure to send them your way. :) :+1:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 4, 2012
  1. @Sepero

    Replaced orig code, but commented, added desc

    Sepero committed
    Replaced the MoinMoin code, but commented, so that devs could easily replace it if they choose to. Also added comment descriptions to the new and old regex code.
  2. @Sepero

    Concept clarification in comments

    Sepero committed
    Creating consistency. Corrected another instance of MoinMoin implying that all wiki's are opposed to linebreaks.
Showing with 9 additions and 1 deletion.
  1. +1 −1 creole/creole2html/parser.py
  2. +8 −0 creole/creole2html/rules.py
View
2 creole/creole2html/parser.py
@@ -124,7 +124,7 @@ def _text_repl(self, groups):
text = groups.get('text', "")
if groups.get('space'):
- # use wiki style line breaks and seperate a new line with one space
+ # use wikipedia style line breaks and seperate a new line with one space
text = " " + text
self.parse_inline(text)
View
8 creole/creole2html/rules.py
@@ -19,11 +19,19 @@ class InlineRules(object):
All inline rules
"""
proto = r'http|https|ftp|nntp|news|mailto|telnet|file|irc'
+ # New regex for finding uris, requires uri to free stand within whitespace or lineends.
url = r'''(?P<url>
(^ | (?<=\s))
(?P<escaped_url>~)?
(?P<url_target> (?P<url_proto> %s )://[^$\s]+ )
)''' % proto
+ # Original uri matching regex inherited from MoinMoin code.
+ #url = r'''(?P<url>
+ #(^ | (?<=\s | [.,:;!?()/=]))
+ #(?P<escaped_url>~)?
+ #(?P<url_target> (?P<url_proto> %s ):\S+? )
+ #($ | (?=\s | [,.:;!?()] (\s | $)))
+ #)''' % proto
link = r'''(?P<link>
\[\[
(?P<link_target>.+?) \s*
Something went wrong with that request. Please try again.