Draft: Fix SVG generation for label objects

Label objects would produce invalid SVG XML, because the stroke-linecap
property was added as if it was a style (with : and ;), but it was
inserted in the XML tag directly, rather than inside the style attribute
value. The invalid SVG prevented for example a TechDraw draft view from
rendering when it contained a label.

This was added in commit 6a7912d399 (Draft: Using square endcaps for
lines in SVG output).

This stroke-linecap is supported both as a presentation attribute inside
the style or a XML attribute, so for consistency with the surrounding
attributes, it is made a normal attribute, rather than putting it inside
the style.

See also https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-linecap
This commit is contained in:
Matthijs Kooijman
2021-06-29 15:24:03 +02:00
parent 2f05f86f6c
commit f62d0c4637

View File

@@ -615,7 +615,7 @@ def get_svg(obj,
svg_path += 'fill="none" '
svg_path += 'stroke="{}" '.format(stroke)
svg_path += 'stroke-width="{}" '.format(linewidth)
svg_path += 'stroke-linecap:square;'
svg_path += 'stroke-linecap="square" '
svg_path += 'd="{}"'.format(path_dir_str)
svg_path += '/>'
svg += svg_path