Doxygen并将一个属性值添加到输出文档中

tym*_*tam 8 c# documentation doxygen servicestack

ServiceStack使用c#属性标记Web服务的休息路径.

例如

[RestService("/hello1")]
[RestService("/hello2")]
public class Hello
Run Code Online (Sandbox Code Playgroud)

我想在Hello类的doxygen输出中使Doxygen包含RestService属性的值.如果带有括号的完整行包含在输出文档中,我并不太关心漂亮的formattin.

有什么建议?

一个快速而肮脏的技巧比编写Doxygen扩展更好;)

干杯

Tymek

====编辑

doxygen用户答案的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()
Run Code Online (Sandbox Code Playgroud)

并且DOXYFILE将具有:

INPUT_FILTER           = "doxygenFilter.py"
Run Code Online (Sandbox Code Playgroud)

dox*_*gen 10

您可以创建一个转换行的输入过滤器

[RestService("/hello1")]
Run Code Online (Sandbox Code Playgroud)

/** \b RestService: "/hello1"\n */
Run Code Online (Sandbox Code Playgroud)

例如,将以下一段perl魔法放在一个名为的文件中filter.pl:

open(F, "<", $ARGV[0]);
while(<F>) { /^\s*\[RestService\((.*)\)\]\s*$/ ? 
             print "/** \\b RestService: $1\\n */\n" : print $_; }
Run Code Online (Sandbox Code Playgroud)

并将其与INPUT_FILTERDoxyfile中的标记一起使用:

INPUT_FILTER           = "perl filter.pl"
Run Code Online (Sandbox Code Playgroud)