mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-04-22 10:01:45 +00:00
doc: wikiparser: Fix issue with some URL containing dup. lang part
When getting context in included images, the original context might already have a language component. Don't add it again if it does. Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
parent
0296cfc97f
commit
95452c1313
@ -1986,6 +1986,12 @@ def get_context(file_path, file_title=None):
|
||||
{'path': PosixPath('manual/es/some-page'), \
|
||||
'name': 'some-page', \
|
||||
'language': 'es', \
|
||||
'title': 'es/FreedomBox/some-page'}
|
||||
|
||||
>>> get_context(Path('manual/es/some-page'), 'es/FreedomBox/some-page')
|
||||
{'path': PosixPath('manual/es/some-page'), \
|
||||
'name': 'some-page', \
|
||||
'language': 'es', \
|
||||
'title': 'es/FreedomBox/some-page'}
|
||||
"""
|
||||
page_name = Path(file_path.stem).stem
|
||||
@ -2001,7 +2007,8 @@ def get_context(file_path, file_title=None):
|
||||
break
|
||||
|
||||
title = file_title or f'FreedomBox/Manual/{page_name}'
|
||||
if language != DEFAULT_LANGUAGE:
|
||||
if title.partition('/')[0] not in LANGUAGES and \
|
||||
language != DEFAULT_LANGUAGE:
|
||||
title = f'{language}/{title}'
|
||||
|
||||
context = {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user