I have a question about link parsing in creoleparser.
The specification for Creole 1.0 (http://
webcache.googleusercontent.com/search?
q=cache:Jpl0oAlTLW4J:www.wikicreole.org/wiki/Creole1.0+http://
wikicreole.org/wiki/Creole1.0&cd=1&hl=en&ct=clnk&client=iceweasel-a)
says about links:
Creole:
[[link]]
Recommended XHTML:
<a href="http://www.examplewiki.com/link">link</a>
my creolepaser output looks like:
<a href="link">link</a>
so if I embed [[link]] in a page (MainPage for example) link redirects
you to MainPage/link instead of /link.
Is there a way to modify this behavior, so that the link href looks
like /link?
yours, flo
You need to create a custom "dialect" for this, as follows:
>>> from creoleparser.dialects import create_dialect, creole11_base
>>> from creoleparser.core import Parser
>>> my_dialect = create_dialect(creole11_base,wiki_links_base_url='/')
>>> parser = Parser(dialect=my_dialect)
>>> parser('[[link]]')
'<p><a href="/link">link</a></p>\n'
In addition to 'wiki_links_base_url', there are a bunch of other
parameters you may find useful:
For a general overview of customization:
http://creoleparser.googlecode.com/svn/docs/usage.html
Hope this helps!
Steve
On Apr 12, 7:26 pm, shday <stephen.h....@gmail.com> wrote:
>
> '<p><a href="/link">link</a></p>\n'
>
> In addition to 'wiki_links_base_url', there are a bunch of other
> parameters you may find useful:
>
> http://creoleparser.googlecode.com/svn/docs/modules/dialects.html#cre...
>
> For a general overview of customization:
>
> http://creoleparser.googlecode.com/svn/docs/usage.html
>
> Hope this helps!
>
Thanks, your post helped a lot, exactly what I was looking for
Flo