Skip to content

Commit

Permalink
Errors printed in admonitions instead of plaintext for html with hdl_…
Browse files Browse the repository at this point in the history
…diagram

Signed-off-by: Michael Riegert <[email protected]>
  • Loading branch information
nobodywasishere committed Apr 21, 2021
1 parent 1095a38 commit 6c7e615
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions sphinxcontrib_hdl_diagrams/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ def render_diagram(self, code, options, format, skin, yosys_script):
module = options['module']
elif source_ext == '.vhd' or source_ext == '.vhdl':
if yosys == "yowasp":
raise HDLDiagramError("Cannot use YoWASP for VHDL")
raise HDLDiagramError("Cannot use YoWASP for VHDL (yet)")
module = options['module']
ilfn = path.join(self.builder.outdir, self.builder.imagedir, options['outname'] + '.v')
vhdl_to_verilog(source_path, ilfn, module, self.builder.config.hdl_diagram_ghdl, yosys)
Expand Down Expand Up @@ -499,8 +499,10 @@ def render_diagram_html(
# raise nodes.SkipNode

if diagram_error:
self.body.append("WARNING: hdl_diagram code '{file}': {err}".format(
file=self.encode(code).strip(), err=diagram_error_message))
self.body.append('<div class="admonition warning">'
'<paragraph class="admonition-title">{title}: </paragraph>'
'<paragraph>hdl_diagram code <code>{file}</code>: {message}</paragraph>'
'</div>'.format(title="Warning", file=code, message=diagram_error_message))
elif fname is None:
self.body.append(self.encode(code))
else:
Expand Down

0 comments on commit 6c7e615

Please sign in to comment.