Doxygen 并将属性值添加到输出文档
ServiceStack 使用 C# 属性标记 Web 服务的静态路径。
例如,
[RestService("/hello1")]
[RestService("/hello2")]
public class Hello
我想让 Doxygen 在 Hello 类的 doxygen 输出中包含 RestService 属性的值。如果输出文档中包含带括号的整行,我不太关心漂亮的格式。
有什么建议吗?
一个快速而肮脏的技巧比编写 Doxygen 扩展更好;)
干杯
Tymek
====编辑
的 Python 版本(因此可以轻松地在 Windows 上工作)将是:
#!/usr/bin/env python
import sys
import re
if (len(sys.argv) < 2):
print "No input file"
else:
f = open(sys.argv[1])
line = f.readline()
while line:
re1 = re.compile("\[RestService\(\"(.*)\",.*\"(.*)\"\)]")
re1.search(line)
sys.stdout.write(re1.sub(r"/** \\b RestService: \2 \1\\n */\n", line))
#sys.stdout.write(line)
line = f.readline()
f.close()
doxygen 用户的答案 DOXYFILE 将具有:
INPUT_FILTER = "doxygenFilter.py"
ServiceStack marks rest paths for web services using c# attributes.
For example
[RestService("/hello1")]
[RestService("/hello2")]
public class Hello
I would like to make Doxygen include values of the RestService attribute in the doxygen output for the Hello class. I'm not concerned too much with pretty formattin if the full line with brackets is included in the output document.
Any suggestions?
A quick and dirty trick would be a preferable to writing a Doxygen extension ;)
Cheers
Tymek
====EDIT
The Python version (so will work on Windows easily) of doxygen user's answer would be:
#!/usr/bin/env python
import sys
import re
if (len(sys.argv) < 2):
print "No input file"
else:
f = open(sys.argv[1])
line = f.readline()
while line:
re1 = re.compile("\[RestService\(\"(.*)\",.*\"(.*)\"\)]")
re1.search(line)
sys.stdout.write(re1.sub(r"/** \\b RestService: \2 \1\\n */\n", line))
#sys.stdout.write(line)
line = f.readline()
f.close()
and the DOXYFILE would have:
INPUT_FILTER = "doxygenFilter.py"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以制作一个输入过滤器,将一行转换为
like
,例如,通过将以下 perl 魔法放入名为
filter.pl
的文件中:并将其与
INPUT_FILTER
一起使用Doxyfile 中的标签:You could make an input filter that converts a line with
to
like for instance by putting following piece of perl magic in a file called
filter.pl
:and use that with the
INPUT_FILTER
tag in the Doxyfile:对我来说,使用 C# 来代替 python 或 perl 脚本更有意义。
作为一个额外的好处,属性的内联 xml 文档也将添加到文档中。
示例:
将 C# 控制台项目命名为“AttributesDocumenter”,并将生成的二进制文件与 Doxyfile 中的 INPUT_FILTER 标记一起使用:
INPUT_FILTER = "AttributesDocumenter.exe"
Instead of using a python or perl scrip, it made more sense to me to do it in C#
As an added bonus inline xml documentation for attributes will also be added to the documentation.
Example:
Name the C# console project "AttributesDocumenter" and use the resulting binary with the INPUT_FILTER tag in the Doxyfile:
INPUT_FILTER = "AttributesDocumenter.exe"