简体   繁体   English

Pdoc - 以编程方式更改模板目录

[英]Pdoc - Change template directory programatically

I have a script that generates documentation using pdoc for all of my classes in my project.我有一个脚本,它使用 pdoc 为我的项目中的所有类生成文档。 I want to further customize my documentation by making changes to pdoc templates.我想通过更改 pdoc 模板来进一步自定义我的文档。 I want to do this inside of my project so I can track changes in git, therefor I need to change --template-dir.我想在我的项目中执行此操作,以便我可以跟踪 git 中的更改,因此我需要更改 --template-dir。 This is easy enough as a cmd line argument but I have not been able to make this change when using pdoc inside a python script.这作为 cmd 行参数很容易,但是在 python 脚本中使用 pdoc 时我无法进行此更改。 My question is where can I pass in this argument and or if I make an object of pdoc is there a function or parameter to make this change.我的问题是我可以在哪里传递这个参数,或者如果我创建一个 pdoc 对象是否有一个函数或参数来进行这个更改。 Thanks in advance!提前致谢!

The documentation says:文档说:

If working with pdoc programmatically, prepend the directory with modified templates into the directories list of the tpl_lookup object.如果有PDOC工作程序,预先准备的目录中修改的模板进入directories的列表tpl_lookup对象。

This is the object in question so something like this should work:这是有问题对象,所以这样的事情应该可以工作:

import pdoc

pdoc.tpl_lookup.directories.insert(0, MY_TEMPLATE_DIR)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM