diff --git a/config.ini b/config.ini index e7fe449beea548fb00fc1b27bec0a433084a21ca..991a5751156b4ada5348b4bd2988c5193652330e 100644 --- a/config.ini +++ b/config.ini @@ -100,6 +100,13 @@ ff0c = 2c20 d7 = 78 ; Ligature "fi" fb01 = 6669 +; "<=" +f0fd = 3c3d +; "=>" +f0e0 = 3e3d +; "<=>" +f0df = 3c3d3e + [media] diff --git a/spec2md.py b/spec2md.py index b8a1da72e74e573da2c33c115b5af507e7e4c833..b4a82a17e7c7cc65c83fc60f25481aa57120041b 100644 --- a/spec2md.py +++ b/spec2md.py @@ -402,9 +402,22 @@ def processDocuments(documents:list[str], outDirectory:str, skipImageConversion: pass # ignore a soft hyphen character which has no meaning in Markdown and zero-width case 'sym': - _symError = f'unknown font+symbol: {element.attrib["{"+wns+"}font"]} - "{element.attrib["{"+wns+"}char"]}"' - _print(f'[yellow]{_symError}') - _result += f'<mark>{_symError}</mark>' + def _symError(ch:str) -> str: + nonlocal _result + _symError = f'unknown font+symbol: {element.attrib["{"+wns+"}font"]} - "{element.attrib["{"+wns+"}char"]} ({ch})"' + _print(f'[yellow]{_symError}') + _result += f'<mark>{_symError}</mark>' + try: + _ch = '????' + _ch = int(element.attrib["{"+wns+"}char"], 16) + if _ch in docConfig.characters: + if (rch := docConfig.characters[_ch]) == chr(0): + rch = '' + _result += rch + else: + _symError(_ch) + except ValueError as e: + _symError(_ch) # ignore deleted test case 'del': @@ -791,7 +804,7 @@ def processDocuments(documents:list[str], outDirectory:str, skipImageConversion: for i in range(len(lines)): line = lines[i] if _captionMarker in line: - _print(f'[yellow]Unresolved figure caption : \[{i}] "{line}"') + _print(f'[yellow]Unresolved / unreferenced figure caption : \[{i}] "{line}"') # # Write produced Markdown file