Below is my code
from docutils.core import publish_string
from docutils.writers.html4css1 import Writer as HisWriter
args = {
'stylesheet' : '/home/wonder/lab/css/note.css',
'stylesheet-path' : None,
}
src = 'ccav'
print publish_string(src, writer=HisWriter(), settings_overrides=args)
I got the following error:
AssertionError: stylesheet and stylesheet_path are mutually exclusive.
So, I change args
to:
args = {
'stylesheet-path' : '/home/wonder/lab/css/note.css',
'stylesheet' : None,
}
Now, There is no errors. But, The stylesheet inserted into the HTML output is not the content of /home/wonder/lab/css/note.css
. It is still /usr/local/lib/python2.7/dist-packages/docutils/writers/html4css1/html4css1.css
.
That is to say, unlike specify options in command line when using publish_cmdline, the settings_overrides
argument carrying HTML-Specific Options takes no effect when using publish_string.