Discussion:
[Docutils-users] Suppress warnings from all non-existing directives/roles
Vinicius Kwiecien Ruoso
2015-08-11 00:38:44 UTC
Permalink
Hi all,

I'm looking for a way to read a reST file with non-standard
directives/roles and suppress its error/warning messages. The ideia is
to not generate error **only** when those non-existing
directives/roles appear, but continue to report errors about other
matters.

To read the file it is used the docutils publish_doctree method. I see
I can use settings_overrides={'report_level':'none'} to suppress all
messages. Can this be done to suppress only that kind of message?
Taking a quick look at the code I tend to say no, but I want to be
sure.

Thanks,
Vinicius
Guenter Milde
2015-08-11 09:49:34 UTC
Permalink
Post by Vinicius Kwiecien Ruoso
Hi all,
I'm looking for a way to read a reST file with non-standard
directives/roles and suppress its error/warning messages. The ideia is
to not generate error **only** when those non-existing
directives/roles appear, but continue to report errors about other
matters.
AFAIK, this is not possible without changes/additions.

The simplest method would be to add/register "mock" directives in a
custom wrapper, using either a sensible fallback
from the existing directives or "mock" directive functions.

See http://docutils.sourceforge.net/docs/howto/rst-directives.html

Günter

Loading...