add option to check and warn or bail out on flowtext
This commit is contained in:
parent
70e6fb776e
commit
b14e801cb7
4 changed files with 162 additions and 0 deletions
|
|
@ -2880,6 +2880,14 @@ def scourString(in_string, options=None):
|
|||
global numBytesSavedInTransforms
|
||||
doc = xml.dom.minidom.parseString(in_string)
|
||||
|
||||
# determine number of flowRoot elements in input document
|
||||
# flowRoot elements don't render at all on current browsers (04/2016)
|
||||
cnt_flowText_el = len(doc.getElementsByTagName('flowRoot'))
|
||||
if cnt_flowText_el:
|
||||
print("SVG input document uses {} flow text elements, which won't render on browsers!".format(cnt_flowText_el))
|
||||
if options.error_on_flowtext:
|
||||
sys.exit(1)
|
||||
|
||||
# remove <metadata> if the user wants to
|
||||
if options.remove_metadata:
|
||||
removeMetadataElements(doc)
|
||||
|
|
@ -3225,6 +3233,10 @@ _option_group_ids.add_option("--protect-ids-prefix",
|
|||
help="don't remove IDs starting with the given prefix")
|
||||
_options_parser.add_option_group(_option_group_ids)
|
||||
|
||||
_option_group_compatibility = optparse.OptionGroup(_options_parser, "SVG compatibility checks")
|
||||
_option_group_compatibility.add_option("--error-on-flowtext",
|
||||
action="store_true", dest="error_on_flowtext", default=False,
|
||||
help="In case the input SVG uses flow text, bail out with error. Otherwise only warn. (default: False)")
|
||||
|
||||
|
||||
def maybe_gziped_file(filename, mode="r"):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue