Comment 2 for bug 492277

Revision history for this message
Jan Thor (jan-janthor) wrote :

Unfortunately, no users of Adobe or Corel etc. came forward, but I think this would be tremendously helpful for Inkscape users. On the other hand, I think there are other use cases where one would assign prefixes to the id's of those elements with special meaning: for example, I could prefix the id's of those elements I want to use in scripts with 'jan:' or 'jan_', like, say, id="jan:page01", id="jan:page02" and so on.

Or perhaps I use the auto-generated id's Inkscape provides, write a script, and now I have a list of id's I use within my script and want to have protected. Therefore, I would propose we make several different mechanisms available, like this:

"""
--protect-ids-noninkscape
Don't remove id's which don't end with a digit (Inkscape auto-generated stock id's always end with digits, so only such id's get removed).

--protect-ids-list=comma_separated_list
Don't remove id's from this comma-separated list of protected id's.

--protect-ids-prefix=prefix
Don't remove id's which start with the given prefix. It is possible to provide more than one protective prefix by separating them with commas.

It is possible to combine these protections.
"""

Using these new options only makes sense if --enable-id-stripping has been set. I'm unsure which one is the least confusing addendum:

"""
Setting at least one of these three protection options automatically enables id stripping (as if --enable-id-stripping had been set).
"""

Or, instead, simply:

"""
Setting any of these three options only has an effect if --enable-id-stripping has been set.
"""

If there is interest, I'm willing to write a patch.

(We could also allow the users to provide a regular expression against which id's are matched, which would be a far more flexible approach, but I'm not sure that that would be the most helpful one.)