Re: camelCase directives not working

David Goodger <[email protected]>
Newsgroups gmane.text.docutils.user
Message-ID <CABiJP=KRH+bbjApt5xeSENYeG93qM+NWB+n9_mFksq8AqcKHSw@mail.gmail.com>
This is a feature, or at least part of the spec. According to
http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#directives:

"Directive types are case-insensitive single
words (alphanumerics plus isolated internal hyphens, underscores,
plus signs, colons, and periods; no whitespace)."

The directive "type" is its name. What "case-insensitive" means here
is that in documents, you can refer to your directive as
"eventListner" or "EventListner" or "eventlistner" or "eVeNtLiStNeR"
or whatever. This is achieved by normalizing the directive name in the
document to "eventlistner", all lowercase. To match, the directive
name must also be all-lowercase at registration time; no normalization
happens then. Registering your directive as "eventListner", with mixed
case, made it impossible to match the name to its use in documents.

Directive names are effectively case-sensitive at registration time,
and must be lowercase. We could add name normalization code to ensure
that this is always true, or a check to warn if it isn't true. As this
is the first time I've seen this, I don't know if it's worth the
effort, small as it may be. I wouldn't object to such a change.

David Goodger
<http://python.net/~goodger>


On Sun, Oct 22, 2017 at 6:33 AM, Robin Shannon <[email protected]> wrote:
>
> I created a custom directive called 'eventListner'. After registering it and
> trying out a test reST document docutils told me that this was an unknown
> directive. Much confusion later, I finally figured out that if I renamed the
> directive to 'eventlistner' everything worked fine. Is this a feature or a
> bug? I looked through the list archive but couldn't find anything obvious
> about this.
>
> I admit that camelCase as a directive name is probably generally not a good
> idea, but since this is a shortcut for the javascript function
> 'eventListner' it seemed appropriate.
>
> Cheers,
> Robin.
>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Docutils-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/docutils-users
>
> Please use "Reply All" to reply to the list.
>

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.