Discussion:
[Docutils-users] CSS class CamelCase
Thyfate
2013-12-13 19:34:10 UTC
Permalink
Hi to all,

I am using RestructuredText to generate the page contents of my website using
the :class: directive to add styles to elements. However, I cannot use the
animation css classes from https://daneden.me/animate/ because the css class
names are camelcased and docutils converts the class names to lowercase.

Is there an easy way to prevent this behavior ?

Thanks in advance!
Guenter Milde
2013-12-17 07:57:37 UTC
Permalink
Post by Thyfate
Hi to all,
I am using RestructuredText to generate the page contents of my website
using the :class: directive to add styles to elements. However, I
cannot use the animation css classes from https://daneden.me/animate/
because the css class names are camelcased and docutils converts the
class names to lowercase.
Is there an easy way to prevent this behavior ?
Unfortunately not. Class arguments are normalized to conform to the
regular expression [a-z](-?[a-z0-9]+)* by converting

alphabetic characters to lowercase,
accented characters to the base character,
non-alphanumeric characters to hyphens,
consecutive hyphens into one hyphen.

http://docutils.sourceforge.net/docs/ref/rst/directives.html#class

Options are:

* Use a local copy of the css stylesheet with lowercase class names,
* post-process the html file,
* use raw HTML (ugly),
* modify the docutils code (find out where the normalization is done, write
an normalization function that skips the downcasing, call this function
instead of the default one in the "class" directive or wherever it is
called, ... ),
* ...(?)

Günter

Loading...