Fixed Mermaid SVG image width attribute

This commit is contained in:
Bartek Kryza
2023-09-10 13:26:58 +02:00
parent bf29ceb2df
commit de5625a474
2 changed files with 5 additions and 1 deletions

View File

@@ -157,7 +157,7 @@ docs:
doxygen: docs
cp CONTRIBUTING.md docs/contributing.md
cp CHANGELOG.md docs/changelog.md
cp docs/diagrams/*.svg docs/doxygen/html/
cp docs/diagrams/plantuml/*.svg docs/doxygen/html/
mkdir -p docs/doxygen/html/test_cases
cp docs/test_cases/*.svg docs/doxygen/html/test_cases/
../doxygen/_build/bin/doxygen

View File

@@ -36,6 +36,10 @@ def main(argv):
# Parse SVG XML
tree = etree.fromstring(bytes(xml, encoding='utf8'))
if not tree.attrib['width'] or tree.attrib['width'].endswith('%'):
# Make sure the width is equal to the viewBox width
tree.attrib['width'] = tree.attrib['viewBox'].split(' ')[2]
# Add style color for <a> links
defs = tree.xpath('//svg:defs', namespaces={'svg':'http://www.w3.org/2000/svg'})
if not defs: