从不同的toctrees引用时,生成具有不同面包屑的重复模板

时间:2015-12-15 02:32:15

标签: python-sphinx tableofcontents

我的文档结构如下:

├── common
│   └── shared.rst
├── foo
│   └── foo.rst
├── index.rst
└── zoo
    └── zoo.rst

生成的结构如下所示:

├── common
│   └── shared.html (breadcrumbs: home -> zoo -> shared)
├── foo
│   └── foo.html
├── index.html
└── zoo
    └── zoo.html

我的foo& toctree动物园看起来像:

.. toctree::
    :includehidden:

    ../common/shared

我想要使用看起来像breadcrumbs: home -> zoo -> shared的面包屑和另一个breadcrumbs: home -> foo -> shared来编译2个不同的shared.html文件。用狮身人面像可以吗?

作为参考,这是我的面包屑生成的模板代码:

<section>
  <ul class="breadcrumbs">
    <li><a href="{{ pathto(master_doc) }}">Home</a></li>
    {% for doc in parents %}
      <li><a href="{{ doc.link|e }}">{{ doc.title }}</a></li>
    {% endfor %}
    {% if title != 'LaunchKey Documentation' %}
      <li><a href="#" class="active">{{ title }}</a></li>
    {% endif %}
  </ul>
</section>

1 个答案:

答案 0 :(得分:0)

结束在shared.rst/foo中放置/zoo并使用包含来使用共享副本。

.. include:: ../common/shared.rst