2
0
mirror of https://github.com/pyrogram/pyrogram synced 2025-08-23 02:17:21 +00:00

Add referenced modules on generated toctrees

This commit is contained in:
Dan 2018-01-06 12:16:29 +01:00
parent 7d94ad340c
commit 26016eddd5
2 changed files with 5 additions and 0 deletions

View File

@ -85,18 +85,21 @@ def generate(source_path, base):
if k != base: if k != base:
inner_path = base + "/" + k + "/index" + ".rst" inner_path = base + "/" + k + "/index" + ".rst"
module = "pyrogram.api.{}.{}".format(base, k)
else: else:
for i in list(all_entities)[::-1]: for i in list(all_entities)[::-1]:
if i != base: if i != base:
entities.insert(0, "{0}/index".format(i)) entities.insert(0, "{0}/index".format(i))
inner_path = base + "/index" + ".rst" inner_path = base + "/index" + ".rst"
module = "pyrogram.api.{}".format(base)
with open(destination + "/" + inner_path, "w") as f: with open(destination + "/" + inner_path, "w") as f:
f.write( f.write(
toctree.format( toctree.format(
title=k.title(), title=k.title(),
title_markup="=" * len(k), title_markup="=" * len(k),
module=module,
entities="\n ".join(entities) entities="\n ".join(entities)
) )
) )

View File

@ -1,5 +1,7 @@
{title} {title}
{title_markup} {title_markup}
.. module:: {module}
.. toctree:: .. toctree::
{entities} {entities}