NetBeans IDE 中 phpDocumentor 中的特殊 HTML 字符
如您所知,NetBeans IDE 将根据 phpDocumentor 语法在 PHP 源中弹出内联文档。
我发现,当我在 phpDocumentor 文档中使用特殊 HTML 字符时,它们在 NetBeans 中被视为 HTML,但在 phpDocumentor 生成的 HTMl 文档中被视为文本。
例如:
/**
* Add a new <link> to the <head> of the document.
*/
在 phpDocumentor 生成的 HTML 中,会显示为:
Add a new <link> to the <head> of the document.
但在 NetBeans IDE 中会显示为:
Add a new <link> to the <head> of the document.
哪个是正确的?在 phpDocumentor 注释中嵌入特殊 HTML 字符的正确方法是什么?
As you know the NetBeans IDE will pop you inline documentation in your PHP sources based on the phpDocumentor syntax.
What I found out is that when I use special HTML characters in my phpDocumentor documentation they are treated as HTML in NetBeans but as text in the HTMl doc generated by phpDocumentor.
For example:
/**
* Add a new <link> to the <head> of the document.
*/
In the HTML generated by phpDocumentor, will be shown as:
Add a new <link> to the <head> of the document.
But in the NetBeans IDE it will be shown as:
Add a new <link> to the <head> of the document.
Which one is right? What is the correct way to embed special HTML characters in your phpDocumentor comments?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我本以为 phpDocumentor 的定义肯定是正确的?毕竟这是他们的格式。
在这个阶段进行 HTML 解码似乎是非常不可取的;像这样的文本标记系统的整体思想是避免 HTML 细节,例如实体引用转义。您输入的任何文本 HTML 会发生什么情况,NetBeans 是否会尝试呈现它?
I would have thought surely phpDocumentor are right by definition? It's their format after all.
It does seem pretty undesirable to be doing an HTML-decode at this stage; the whole idea of text-markup systems like this is to avoid HTML details like entity reference escaping. What happens to any literal HTML you put in, does NetBeans try to render it?
在处理特殊字符方面,做任何事情的正确方法是使用您想要的实际字符并在需要时转换它们。
因此正确的方法是使用实际的< > &您评论中的字符和 phpDoc 插件需要将它们转换为 .HTML 文件的 HTML 编码版本,如果它不这样做,那么无论他们做了什么或说什么,都是他们错了。
Well the right way to do anything, in regards to handling special characters, is to use the actual characters you want and convert them at the moment you need to.
Therefor the correct way is to use actual < > & characters in your comments and the phpDoc addon needs to convert them to the HTML encoded versions for the .HTML files, if it doesn't do that, then it's them who is wrong, despite what they do or say.
经过一番研究后,phpDocumentor/NetBeans 似乎必须解释 some
标签。正如您在维基百科此处所看到的,只有
以下标签应解释为 HTML:
所有其他标签应显示为纯文本。目前 NetBeans 解释所有标签。在我看来,这是一个错误,因为 phpDocumentor docBuilder 仅解释某些标签。
我在 NetBeans 网站上提出了一个问题 (180636)。
希望它能尽快修复...
After some reseach it seems that phpDocumentor/NetBeans must interpret some
tags. As you can see on Wikipedia here, only the
following tags should be interpreted as HTML:
All others tags should be displayed as plain text. Currently NetBeans interpret all tags. This is a bug IMO since phpDocumentor docBuilder only interpret some tags.
I opened an issue (180636) on the NetBeans website.
Hopefully it will be fixed soon...