spirali / nelsie

Framework for Creating Slides
MIT License
39 stars 4 forks source link

SVG files with DTD schema cannot be loaded #35

Closed ZakkProjects closed 3 months ago

ZakkProjects commented 3 months ago

SVG images exported from DrawIO cannot be used in nelsie because of DTD shema. Its probably an issue within some upstream packages ?

Resulting: error Traceback (most recent call last): File "C:\School\bachelor_mics\presentation\main.py", line 115, in @deck.slide() ^^^^^^^^^^^^ File "C:\School\bachelor_mics\presentation\venv\Lib\site-packages\nelsie\slidedeck.py", line 181, in helper fn(slide) File "C:\School\bachelor_mics\presentation\main.py", line 120, in applicationStructure_2 b.image("img/frontend_1.drawio.svg", enable_steps=True, width="100%") File "C:\School\bachelor_mics\presentation\venv\Lib\site-packages\nelsie\box.py", line 107, in image return self.box(_content=image, **box_args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\School\bachelor_mics\presentation\venv\Lib\site-packages\nelsie\box.py", line 307, in box box_id, node_id = deck._deck.new_box( ^^^^^^^^^^^^^^^^^^^ Exception: Image 'C:\School\bachelor_mics\presentation\img\frontend_1.drawio.svg' load error: XML with DTD detected

Easy, but surely not correct fix is to remove !Doctype tag from svg file. <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">

spirali commented 3 months ago

Thank you for reporting. It seems that roxmltree does not like DTD by default, but the detection can be switched off. I will fix this soon.