Exception when combining figure with .. only:: directive
I have asked this question on stackoverflow but as requested in the exception also wanted to report this here.
I am trying to use the numfig extension while generating both HTML and PDF documentation and so far this has worked great.
Now, I would like to use PDF figures in the latex version and PNG figures in the html version. I tried to use the .. only:: directive as follows
.. _import-dmmetamodel: .. only:: html .. figure:: _static/dataext/DM-Example.png My caption for the figure. .. only:: latex .. figure:: _static/dataext/DM-Example.pdf My caption for the figure.
I get this error message:
Exception occurred: File "/MyPath/Documentation/sphinxext/numfig.py", line 76, in doctree_resolved target_doc = app.builder.env.figid_docname_map[target] KeyError: u'import-dmmetamodel' The full traceback has been saved in /var/folders/h7/qxg81k7c8xj6ws001s7mslb00000gn/T/sphinx-err-fyu24Y.log, if you want to report the issue to the developers. Please also report this if it was a user error, so that a better error message can be provided next time. Either send bugs to the mailing list at <http://groups.google.com/group/sphinx-users/>, or report them in the tracker at <http://bitbucket.org/birkenfeld/sphinx/issues/>. Thanks! make: *** [html] Error 1
I am not sure whether this is a bug or user error. Could you please let me know? Thank you.