From 19a2072302dd2f10be7ee3f6f43e7826c5f4e10c Mon Sep 17 00:00:00 2001 From: Naum Spaseski Date: Wed, 10 Dec 2025 02:09:33 +0100 Subject: [PATCH 1/3] Corrected internal links generation --- spec2md.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/spec2md.py b/spec2md.py index c2f9d58..3fcf969 100644 --- a/spec2md.py +++ b/spec2md.py @@ -953,17 +953,19 @@ def processDocuments(documents:list[str], # Map internal references # _definitionExpression = re.compile(r'^[`]?\[([\d]+|i.[\d]+)\]([^`]*)[`]?') - _referenceExpression = re.compile(r'([^>])\[([\d]+|i.[\d]+)\](?!)') + _referenceExpression = re.compile(r'([^>])\[([\d]+|i.[\d]+)\](?!|\(#_ref_)') for i in range(len(lines)): line = lines[i] if (m := _definitionExpression.match(line)) is not None: - lines[i] = f'- [{m.group(1)}]{m.group(2)}' + # Use HTML anchor for definitions with span wrapper: [1] + lines[i] = f'- [{m.group(1)}]{m.group(2)}' def _repl(m:re.Match) -> str|None: if m.group(1) == '"': return None - return f'{m.group(1)}[{m.group(2)}]' + # Use markdown link format: [\[1\]](#_ref_1) + return f'{m.group(1)}[\\[{m.group(2)}\\]](#_ref_{m.group(2)})' for i in range(len(lines)): line = lines[i] @@ -1063,7 +1065,7 @@ def processDocuments(documents:list[str], _print(f'Converting EMF file: {fn} to "{format}"', highlight = False) if (res := subprocess.run(cmd, shell = True, capture_output = True)).returncode != 0: _print(f'[red]Error running command: {res.stderr.decode("utf-8")}') - _print(f'[red]Please check the configuration file -> section "\[media]" for the converter command: {converter}') + _print(f'[red]Please check the configuration file -> section "[media]" for the converter command: {converter}') break if not skipImageConversion: -- GitLab From 9a4476a82775af8cb94d2d1616e9a4a8010c0f02 Mon Sep 17 00:00:00 2001 From: Naum Spaseski Date: Thu, 18 Dec 2025 14:30:13 +0100 Subject: [PATCH 2/3] Corrected references links --- spec2md.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec2md.py b/spec2md.py index 3fcf969..d05a777 100644 --- a/spec2md.py +++ b/spec2md.py @@ -959,7 +959,7 @@ def processDocuments(documents:list[str], line = lines[i] if (m := _definitionExpression.match(line)) is not None: # Use HTML anchor for definitions with span wrapper: [1] - lines[i] = f'- [{m.group(1)}]{m.group(2)}' + lines[i] = f'- [{m.group(1)}] {m.group(2).strip()}' def _repl(m:re.Match) -> str|None: if m.group(1) == '"': -- GitLab From c2efcd518774dda44f1ffe52b5fe728423ed7cd5 Mon Sep 17 00:00:00 2001 From: Naum Spaseski Date: Thu, 18 Dec 2025 14:30:49 +0100 Subject: [PATCH 3/3] Corrected references links --- spec2md.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec2md.py b/spec2md.py index d05a777..99c8429 100644 --- a/spec2md.py +++ b/spec2md.py @@ -959,7 +959,7 @@ def processDocuments(documents:list[str], line = lines[i] if (m := _definitionExpression.match(line)) is not None: # Use HTML anchor for definitions with span wrapper: [1] - lines[i] = f'- [{m.group(1)}] {m.group(2).strip()}' + lines[i] = f'[{m.group(1)}] {m.group(2).strip()}' def _repl(m:re.Match) -> str|None: if m.group(1) == '"': -- GitLab