Skip to content

Commit

Permalink
Ignore broken items in README (#159)
Browse files Browse the repository at this point in the history
  • Loading branch information
openvmp authored Aug 5, 2024
1 parent 018f56e commit 2f69ead
Showing 1 changed file with 19 additions and 12 deletions.
31 changes: 19 additions & 12 deletions partcad/src/partcad/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -1436,23 +1436,30 @@ def add_section(name, shape, render_cfg):
):
svg_cfg = render_cfg["svg"] if "svg" in render_cfg else {}
svg_cfg = svg_cfg if svg_cfg is not None else {}
image_path = os.path.join(
svg_cfg.get("prefix", "."),
name + ".svg",
)
columns += [
'<img src="%s" width="200" height="200">'
% os.path.join(
svg_cfg.get("prefix", "."),
name + ".svg",
)
'<img src="%s" width="200" height="200">' % image_path
]
elif "png" in render_cfg:
png_cfg = render_cfg["png"]
png_cfg = png_cfg if png_cfg is not None else {}
columns += [
'<img src="%s" height="200">'
% os.path.join(
png_cfg.get("prefix", "."),
name + ".png",
)
]
image_path = os.path.join(
png_cfg.get("prefix", "."),
name + ".png",
)
columns += ['<img src="%s" height="200">' % image_path]
else:
image_path = None

if image_path is None or not os.path.exists(image_path):
pc_logging.warn(
"Skipping rendering of %s: no image found" % name
)
return []

if "desc" in config:
columns += [config["desc"]]

Expand Down

0 comments on commit 2f69ead

Please sign in to comment.