Conditional images

39 views
Skip to first unread message

William Abernathy

unread,
Feb 24, 2021, 10:27:37 PM2/24/21
to sphinx...@googlegroups.com
I have a product with a "split personality." I want the documentation to provide one diagram (with "product A" in the diagram) for when I am generating documentation for product A and a different diagram (with "product B" in the image) for when I am generating documentation for product B. I have two such images.

I have established that I cannot include a substitution in an .. image:: declaration. It appears that our .. only:: declaration is already occupied with html-vs.-pdf outputs. I have been experimenting fruitlessly with .. ifconfig:: declarations, which give me a lot of this warning:

Warning, treated as error:
/home/docs/docsource/operation/Architecture/index.rst:14:Exception occured in ifconfig expression:
  File "<string>", line 2
    .. image:: ../Graphics/product_A_hi-level_2.0.*


I am not sufficiently skilled to build an extension to resolve this. Is there an easy or obvious way to make this work? (I believe we're still on Sphinx 1.8.3 in a containerized build environment)

Thanks,
--


William Abernathy

Sr. Tech Writer

San Francisco

Komiya Takeshi

unread,
Feb 25, 2021, 8:32:58 AM2/25/21
to sphinx...@googlegroups.com
Hi,

I guess you need to install a blank line before the image directive. All directives expect a blank line between the declarative line and its contents.
In this case, the consecutive line that contains the image directive call is considered as a part of conditions of the only directive.

Thanks,
Takeshi KOMIYA

2021年2月25日(木) 12:27 'William Abernathy' via sphinx-users <sphinx...@googlegroups.com>:
--
You received this message because you are subscribed to the Google Groups "sphinx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sphinx-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sphinx-users/CAHz33vWZ5hx%3DxYeQm37vJpjF6cweNmE0fooe8%2Bq4yGMYeAzYfw%40mail.gmail.com.

William Abernathy

unread,
Feb 25, 2021, 10:53:47 AM2/25/21
to sphinx...@googlegroups.com
Arregato gozai-mas!

Thank you very much! You have solved my problem!

--William

Reply all
Reply to author
Forward
0 new messages