mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-04-29 10:10:19 +00:00
doc: wikiparser: Handle wiki links starting with a /
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
c7afe8c688
commit
4fd5d0e73b
@ -558,6 +558,10 @@ def resolve_url(url, context):
|
|||||||
url = url[3:]
|
url = url[3:]
|
||||||
page_title = page_title.rpartition('/')[0]
|
page_title = page_title.rpartition('/')[0]
|
||||||
|
|
||||||
|
url = f'{BASE_URL}{page_title}/{url}'
|
||||||
|
elif url.startswith('/'):
|
||||||
|
page_title = context.get('title', '') if context else ''
|
||||||
|
url = url.lstrip('/')
|
||||||
url = f'{BASE_URL}{page_title}/{url}'
|
url = f'{BASE_URL}{page_title}/{url}'
|
||||||
else:
|
else:
|
||||||
url = f'{BASE_URL}{url}'
|
url = f'{BASE_URL}{url}'
|
||||||
@ -1606,6 +1610,11 @@ Features introduction</ulink>'
|
|||||||
'<ulink url="https://wiki.debian.org/FreedomBox/Contribute#">\
|
'<ulink url="https://wiki.debian.org/FreedomBox/Contribute#">\
|
||||||
Contribute</ulink>'
|
Contribute</ulink>'
|
||||||
|
|
||||||
|
>>> generate_inner_docbook([Link('/Code', \
|
||||||
|
[PlainText('Code')])], context={'title': 'FreedomBox/Contribute'})
|
||||||
|
'<ulink url="https://wiki.debian.org/FreedomBox/Contribute/Code#">\
|
||||||
|
Code</ulink>'
|
||||||
|
|
||||||
>>> generate_inner_docbook([Link('DebianBug:1234', [PlainText('Bug')])])
|
>>> generate_inner_docbook([Link('DebianBug:1234', [PlainText('Bug')])])
|
||||||
'<ulink url="https://bugs.debian.org/1234#">Bug</ulink>'
|
'<ulink url="https://bugs.debian.org/1234#">Bug</ulink>'
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user