sphinx-tabs
sphinx-tabs copied to clipboard
Support having the same content in multiple grouped tabs without duplicating it
It's common to have the same contents in multiple grouped tabs. Consider the following example:
.. group-tab:: Linux
Copy the files using ``cp``.
.. group-tab:: Mac
Copy the files using ``cp``.
.. group-tab:: Windows
Copy the files using ``copy``.
It would be nice to have a way of not duplicating the same line in Linux and Mac.
Ah, so something like allowing tab directives to properly support .. include::
directives and/or sphinx/rst substitutions within them?
I haven't tested those out within tab directives just yet, so I don't know what functionality works or is ignored, but these would seem like the ones to work on introducing support for.
I'd reckon maybe something like:
.. group-tab:: Linux
:duplicate: Mac; Other1; Other2
Copy the files using ``cp``.
.. group-tab:: Windows
Copy the files using ``copy``.
I've used and I'm still using the include::
directive for duplicated content, it makes also code more readable and maintainable, plus you can reuse content also outside tabs.
BTW, @chrisjsewell thanks for picking the project up, although a bit too late for me... :-)
@stefanodavid thanks for providing that workaround. I think it's really useful and will definitely try it out. However, for short documents or short commands inside the tab, I believe that @chrisjsewell 's proposal can be convenient.
@chrisjsewell, feel free to email me when you implement the feature -- I can help with documenting it.