wireviz / WireViz

Easily document cables and wiring harnesses.
GNU General Public License v3.0
4.41k stars 225 forks source link

Escape Characters are not Documented #266

Open jacobian91 opened 2 years ago

jacobian91 commented 2 years ago

I cannot find a location in the documentation explaining the need to escape certain characters like "&". Graphviz throws an error when using these symbols. I found that the proper way to escape the ampersand is &. I think it would be helpful to mention this in the WireViz docs. I haven't tested any other characters that might need escaping.

The error thrown is:

Error: not well-formed (invalid token) in line 37 
... asdf&asdf</td> ...
in label of node W1
Warning: node W1, port w1 unrecognized
Warning: node W1, port w1 unrecognized
Traceback (most recent call last):
  File "C:\Users\jacob\Envs\wireviz\Scripts\wireviz-script.py", line 33, in <module>
    sys.exit(load_entry_point('wireviz==0.3.dev0', 'console_scripts', 'wireviz')())
  File "C:\Users\jacob\Envs\wireviz\lib\site-packages\wireviz-0.3.dev0-py3.9.egg\wireviz\wireviz.py", line 268, in main
    parse(yaml_input, file_out=file_out.resolve())
  File "C:\Users\jacob\Envs\wireviz\lib\site-packages\wireviz-0.3.dev0-py3.9.egg\wireviz\wireviz.py", line 187, in parse
    harness.output(filename=file_out, fmt=('png', 'svg'), view=False)
  File "C:\Users\jacob\Envs\wireviz\lib\site-packages\wireviz-0.3.dev0-py3.9.egg\wireviz\Harness.py", line 372, in output
    graph.render(filename=filename, view=view, cleanup=cleanup)
  File "C:\Users\jacob\Envs\wireviz\lib\site-packages\graphviz\files.py", line 243, in render
    rendered = backend.render(self._engine, format, filepath,
  File "C:\Users\jacob\Envs\wireviz\lib\site-packages\graphviz\backend.py", line 223, in render
    run(cmd, capture_output=True, cwd=cwd, check=True, quiet=quiet)
  File "C:\Users\jacob\Envs\wireviz\lib\site-packages\graphviz\backend.py", line 183, in run
    raise CalledProcessError(proc.returncode, cmd,
graphviz.backend.CalledProcessError: Command '['dot', '-Kdot', '-Tpng', '-O', 'minamp']' returned non-zero exit status 1. [stderr: b'Error: not well-formed (invalid token) in line 37 \r\n... asdfa&amp</td> ...\r\nin label of node W1\r\nWarning: node W1, port w1 unrecognized\r\nWarning: node W1, port w1 unrecognized\r\n']

My code to replicate:

cables:
  W1:
    notes: asdfa&asdf
    wirecount: 1

connectors:
  C1:
    pincount: 2

connections:
  - - C1: [1,2]
    - W1: [1,1]
kvid commented 2 years ago

This issue seems to be related to #230.