Skip to content

Commit 6c7e615

Browse files
Errors printed in admonitions instead of plaintext for html with hdl_diagram
Signed-off-by: Michael Riegert <michael@eowyn.net>
1 parent 1095a38 commit 6c7e615

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

sphinxcontrib_hdl_diagrams/__init__.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ def render_diagram(self, code, options, format, skin, yosys_script):
421421
module = options['module']
422422
elif source_ext == '.vhd' or source_ext == '.vhdl':
423423
if yosys == "yowasp":
424-
raise HDLDiagramError("Cannot use YoWASP for VHDL")
424+
raise HDLDiagramError("Cannot use YoWASP for VHDL (yet)")
425425
module = options['module']
426426
ilfn = path.join(self.builder.outdir, self.builder.imagedir, options['outname'] + '.v')
427427
vhdl_to_verilog(source_path, ilfn, module, self.builder.config.hdl_diagram_ghdl, yosys)
@@ -499,8 +499,10 @@ def render_diagram_html(
499499
# raise nodes.SkipNode
500500

501501
if diagram_error:
502-
self.body.append("WARNING: hdl_diagram code '{file}': {err}".format(
503-
file=self.encode(code).strip(), err=diagram_error_message))
502+
self.body.append('<div class="admonition warning">'
503+
'<paragraph class="admonition-title">{title}: </paragraph>'
504+
'<paragraph>hdl_diagram code <code>{file}</code>: {message}</paragraph>'
505+
'</div>'.format(title="Warning", file=code, message=diagram_error_message))
504506
elif fname is None:
505507
self.body.append(self.encode(code))
506508
else:

0 commit comments

Comments
 (0)