我試圖用Sphinx的.. include::
directive將文件從一個文件包含在另一個文件中,以避免重複文檔的源文本。我包括的部分是configuration.rst
(它的參考文檔的配置設置的一部分),它包含了交叉引用的每個配置設置一些標籤:斯芬克斯的..包括::指令和「重複標籤」警告
.. start_config-authorization
.. _ckan.auth.anon_create_dataset:
ckan.auth.anon_create_dataset
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Example::
ckan.auth.anon_create_dataset = False
Default value: ``False``
Allow users to create datasets without registering and logging in.
.. _ckan.auth.create_unowned_dataset:
ckan.auth.create_unowned_dataset
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
.. end_config-authorization
在另一個文件(authorization.rst
)我只包括從configuration.rst
在線授權的配置設置,如:
.. include:: /configuration.rst
:start-after: start_config-authorization
:end-before: end_config-authorization
的問題是,所包含的文本中的標籤生產從獅身人面像這樣的警告:
doc/configuration.rst:224: WARNING: duplicate label ckan.auth.anon_create_dataset, other instance in doc/authorization.rst
到目前爲止交叉引用似乎並沒有被打破,如果我把:
:ref:`ckan.auth.anon_create_dataset`
在第三個文件,這會產生正確的configuration.html
(而不是包含副本的鏈接到的ckan.auth.anon_create_dataset
定義它在authorization.html
)。
簡單地忽略或沉默這些重複標籤警告是否安全?並且期望所有交叉引用鏈接到configuration.html
?或者我應該找到另一種方式來做到這一點?
不是。我認爲如果檢測到重複,它將被忽略。要麼引用沒有鏈接,要麼目標不會被創建,或者兩者都不會。 – erikbwork 2013-09-26 09:34:10