glades
glades

Reputation: 4924

Include whole text sections from other *.rst - files into this file?

I'm using Sphinx and I want to "copy" over a given section from one *.rst file into multiple other ones automatically, so that when I adapt the text section in the first file the changes are automatically reflected in the copied parts of the other files.

E.g.:

base.rst:

This is a section/paragraph I want to see in other *.rst - files.

derivate.rst:

Here is some text. But the following paragraph should be the paragraph from above ^^:

<that paragraph from above>

Here the file continues.

How can I do that with Sphinx and reStructuredText?

Upvotes: 9

Views: 3562

Answers (1)

Steve Piercy
Steve Piercy

Reputation: 15105

Use the include directive.

Here is some text. But the following paragraph should be the paragraph from above ^^:

.. include:: base.rst

Here the file continues.

Upvotes: 11

Related Questions