pediapress / mwlib

mediawiki parser library
103 stars 35 forks source link

link not detected #9

Closed v0lk3r closed 12 years ago

v0lk3r commented 12 years ago

In the example below (line 2) the link is not detected if the protocol is not specified. Line 3 shows the working example

In [1]: from mwlib.uparser import simpleparse as p

In [2]: p('[//toolserver.org/~geohack/geohack.php?pagename=Benutzer%3AVolker.haas/Test&language=de&params=51.4213888889_N_9.64805555556_E_dim:100_region:DE-NI_type:waterbody&title=Namentlicher+Beginn+Weser bla]')
Article
    u'['
    u'//toolserver.org/~geohack/geohack.php?pagename=Benutzer%3AVolker.haas/Test&language=de&params=51.4213888889_N_9.64805555556_E_dim'
    u':'
    u'100_region'
    u':'
    u'DE-NI_type'
    u':'
    u'waterbody&title=Namentlicher+Beginn+Weser bla'
    u']'
Out[2]: Article

In [3]: p('[http://toolserver.org/~geohack/geohack.php?pagename=Benutzer%3AVolker.haas/Test&language=de&params=51.4213888889_N_9.64805555556_E_dim:100_region:DE-NI_type:waterbody&title=Namentlicher+Beginn+Weser bla]')
Article
    NamedURL->u'http://toolserver.org/~geohack/geohack.php?pagename=Benutzer%3AVolker.haas/Test&language=de&params=51.4213888889_N_9.64805555556_E_dim:100_region:DE-NI_type:waterbody&title=Namentlicher+Beginn+Weser'
        u' bla'
Out[3]: Article
v0lk3r commented 12 years ago

added test with https://github.com/pediapress/mwlib/commit/58f64c24d54f93282ceed766a9e9d7762ed25372