如何创建 phpdoc 教程/扩展页面来补充注释代码
我正在尽一切努力让 phpdocumentor 允许我使用 DocBook 教程格式来补充它创建的文档:
- 我正在使用 Eclipse
- 我已经通过 PEAR 在 OSX 计算机上安装了 phpDocumentor
- 我可以从我的计算机上运行并自动生成代码php 类
- 它不会格式化教程 - 我找不到解决方案
我尝试在整个文件结构中移动 .pkg 示例文件,在子文件夹中使用与代码中引用的包类似的名称。我真的很茫然 - 如果有人可以解释他们将 .pkg 和其他 DocBook 文件放置在与他们正在记录的代码相关的位置以及他们如何触发 phpdoc 对其进行格式化,我将不胜感激,我正在使用它片刻:
phpdoc -o HTML:Smarty:HandS
-d "/path/to/code/classes/", "/path/to/code/docs/tutorials/"
-t /path/to/output
I'm trying everything I can to get phpdocumentor to allow me to use the DocBook tutorial format to supplement the documentation it creates:
- I am using Eclipse
- I've installed phpDocumentor via PEAR on an OSX machine
- I can run and auto generate code from my php classes
- It won't format Tutorials - I can't find a solution
I've tried moving the .pkg example file all over the file structure, in subfolders using a similar name to the package that is being referenced within the code .. I'm really at a loss - if someone could explain WHERE they place the .pkg and other DocBook files in relation to the code they are documenting and how they trigger phpdoc to format it I would appreciate it, I'm using this at the moment:
phpdoc -o HTML:Smarty:HandS
-d "/path/to/code/classes/", "/path/to/code/docs/tutorials/"
-t /path/to/output
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我没想到会回答我自己的问题,但是经过两天的绞尽脑汁的痛苦和一个周末的实验,似乎这就是问题所在:
教程和我的示例应该有效,但是似乎是 phpdoc 解释开关值的方式中的一个小缺陷。 这是我一直在使用的:
但是,如果您使用以下内容:
它将正确格式化您的教程和扩展文档,我所做的就是删除目录路径周围的双引号。 单引号根本不起作用 - 因为如果没有空格,phpdoc 本身会将目录用双引号括起来...这看起来确实是 phpdoc 的一个错误,并且基于 Web 的界面也发生了相同的行为,所以它是一个内部问题。 我最初的尝试应该有效,但没有成功,我将联系开发人员并提请他们注意。
问题解决了。
I didn't expect to be answering my own question, but after 2 days of mind bending pain and a weekend to experiment it seems this is the problem:
The tutorial and my examples should work, but there seems to be a minor flaw in the way phpdoc interprets the switch values. Here is what I've been using:
However if you use the following:
It will correctly format your tutorials and extending docs, all I did was drop the double quotes surrounding the directory paths. Single quotes don't work at all - as phpdoc itself wraps the directories in double quotes if there are no spaces ... this does seem like a bug with phpdoc, and the same behaviour occurred with the web based interface, so its an internal issue. my original attempt should have worked but didn't I will contact the developers and bring it to their attention.
Problem solved.
您读过此吗?
它建议以下路径方案:tutorials/package/package.pkg 其中package是你的包的名称,你是这样做的吗?
Have you read this?
It suggest the following path scheme: tutorials/package/package.pkg where package is the name of your package, did you do it this way?
我在使用 .ini 进行配置时遇到了同样的问题,但对我来说,问题是我在逗号和目录之间放置了一个空格,这导致目录没有“链接”到 -d 参数。
不工作:
工作:
希望这可以解决其他人的问题!
I was experiencing the same issue using an .ini for configuration, but with me the problem was that I put a space in between the comma and the directory, which resulted in the directory not being 'linked' to the -d parameter.
Not working:
Working:
Hope this solves the problem for someone else!
是的,您对双引号的使用可能会导致 phpDocumentor 的内部运行时参数解析失败,导致
-d /path/to/code/classes
成为一对参数/值,而不包含/path /to/code/docs/tutorials
作为附加目录值。通常,我还看到过另外两个与未创建教程有关的问题。 第一,教程目录不是 phpDocumentor 所期望的。 第二,执行中不包含实际的 PHP 代码文件。 我记得在手册中添加了专门针对这两种情况的措辞 。
Yes, your usage of the double quotes probably threw off phpDocumentor's internal runtime argument parsing, causing
-d /path/to/code/classes
to be one arg/value pair, without including/path/to/code/docs/tutorials
as an additional directory value.Typically, I've seen two other issues around tutorials not being created. One, the tutorial directory isn't what phpDocumentor expects. Two, no actual PHP code files are included in the execution. I remember adding verbiage to the manual specifically for these two scenarios.