I've decided to try getafreelancer.com to complete the rest of the
implementation. See
https://www.getafreelancer.com/projects/Python-CSS/Implement-SVG-CSS-profile
-Python.html.
Comments below.
> -----Original Message-----
> From: cssu...@googlegroups.com [mailto:cssu...@googlegroups.com] On
> Behalf Of see
>
> yes, exactly as I imagined it may be done. (BTW, any suggestions if
> this way is easy enough.)
It would have been nice to have a How-To (and maybe there is one, but I
didn't see it in my natural course). It could be as simple as a couple of
comments at the heading of profile.py that describes what needs to be done
to add an additional profile. Of course, this use-case is probably so rare
that a how-to is probably unneeded.
One thing I did encounter since my initial implementation. It appears that
macro names must not have underscores. Is that correct? When I created
unit_identifier macro in my code, it didn't seem to match properly. Renamed
it to unitidentifier and it worked fine.
I also noticed that in profiles.py, it appears positivenum allows for
negative floating-point numbers. Is that a mistake?
'positivenum': r'\d+|[-]?\d*\.\d+',
> macros = {
> 'paint': 'none|currentColor|{color}',
> # spec actually says length, but our length macro requires units,
> so
> use positivenum
> 'dasharray': '{positivenum}(\s*,\s*{positivenum})*',
> }
>
> Another thing: cssutils.profiles._MACROS defines a "length" macro,
> maybe you want to use that?.
The _MACROS['length'] requires the unitidentifiers, so I needed to override
it in the SVG macros. (see the updated source for details). It could be
that the CSS2 MACRO should be updated as well.
> Also {color} does not yet define all SVG colors (these seem quite a
> list last time I checked). You might want to defined your own colors
> macro.
Thanks for pointing that out; I hope the freelancer is able to implement all
of these.
I hadn't checked the docs; I read the code instead. Reading the docs would
have been a good idea :)
> lenghts in CSS (AFAIK) require a unit except if they are "0".
> Different for your needs?
Yes. For some reason, the SVG spec defines length as having an optional
unit for any number, and this is strictly necessary too, for relative
lengths, such as the dashed line.