From f71ad2ac6970ad89657f8de57f1bb01bf9c1665f Mon Sep 17 00:00:00 2001 From: "AzureAD\\SylvainDUVERNAY" Date: Sat, 30 May 2026 14:13:12 +0200 Subject: [PATCH] Fix process documentation navigation --- .../purchase_trade/process_documentation.py | 29 ++++++++++++++++--- .../purchase_trade/process_documentation.xml | 4 +-- 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/modules/purchase_trade/process_documentation.py b/modules/purchase_trade/process_documentation.py index 87b39cf..cb591fc 100644 --- a/modules/purchase_trade/process_documentation.py +++ b/modules/purchase_trade/process_documentation.py @@ -104,9 +104,10 @@ def _inline(markdown, current_file): else: parts.append(label) elif resolved.endswith('.md'): - parts.append('%s' % ( - html.escape(_anchor(resolved), quote=True), label)) - elif resolved.startswith(('#', 'http://', 'https://', 'mailto:')): + parts.append(_internal_link(_anchor(resolved), label)) + elif resolved.startswith('#'): + parts.append(_internal_link(resolved.lstrip('#'), label)) + elif resolved.startswith(('http://', 'https://', 'mailto:')): parts.append('%s' % ( html.escape(resolved, quote=True), label)) else: @@ -167,10 +168,16 @@ def _markdown_to_html(markdown, current_file): if current_file != 'README.md': body.insert( - 0, '

Back to index

') + 0, '

%s

' % _internal_link('doc-README-md', 'Back to index')) return '\n'.join(body) +def _internal_link(anchor, label): + anchor = html.escape(anchor, quote=True) + return '%s' % ( + anchor, anchor, label) + + def _render_table(lines, current_file): rows = [ [cell.strip() for cell in line.strip('|').split('|')] @@ -242,6 +249,20 @@ HTML_TEMPLATE = '''
%(content)s
+ ''' diff --git a/modules/purchase_trade/process_documentation.xml b/modules/purchase_trade/process_documentation.xml index 4a09602..c3b381b 100644 --- a/modules/purchase_trade/process_documentation.xml +++ b/modules/purchase_trade/process_documentation.xml @@ -45,9 +45,9 @@ this repository contains the full copyright notices and license terms. -->