Skip to content

Commit e813412

Browse files
authored
Support @directive, not just \directive (#6)
Co-authored-by: Noah Amsel <amsel@reservoir.com>
1 parent 14c7d70 commit e813412

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

pybind11_mkdoc/mkdoc_lib.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -109,18 +109,18 @@ def process_comment(comment):
109109

110110
# Doxygen tags
111111
cpp_group = r'([\w:]+)'
112-
param_group = r'([\[\w:\]]+)'
112+
param_group = r'([\[\w:,\]]+)'
113113

114114
s = result
115-
s = re.sub(r'\\c\s+%s' % cpp_group, r'``\1``', s)
116-
s = re.sub(r'\\a\s+%s' % cpp_group, r'*\1*', s)
117-
s = re.sub(r'\\e\s+%s' % cpp_group, r'*\1*', s)
118-
s = re.sub(r'\\em\s+%s' % cpp_group, r'*\1*', s)
119-
s = re.sub(r'\\b\s+%s' % cpp_group, r'**\1**', s)
120-
s = re.sub(r'\\ingroup\s+%s' % cpp_group, r'', s)
121-
s = re.sub(r'\\param%s?\s+%s' % (param_group, cpp_group),
115+
s = re.sub(r'[\\@]c\s+%s' % cpp_group, r'``\1``', s)
116+
s = re.sub(r'[\\@]a\s+%s' % cpp_group, r'*\1*', s)
117+
s = re.sub(r'[\\@]e\s+%s' % cpp_group, r'*\1*', s)
118+
s = re.sub(r'[\\@]em\s+%s' % cpp_group, r'*\1*', s)
119+
s = re.sub(r'[\\@]b\s+%s' % cpp_group, r'**\1**', s)
120+
s = re.sub(r'[\\@]ingroup\s+%s' % cpp_group, r'', s)
121+
s = re.sub(r'[\\@]param%s?\s+%s' % (param_group, cpp_group),
122122
r'\n\n$Parameter ``\2``:\n\n', s)
123-
s = re.sub(r'\\tparam%s?\s+%s' % (param_group, cpp_group),
123+
s = re.sub(r'[\\@]tparam%s?\s+%s' % (param_group, cpp_group),
124124
r'\n\n$Template parameter ``\2``:\n\n', s)
125125

126126
for in_, out_ in {
@@ -136,22 +136,22 @@ def process_comment(comment):
136136
'throw': 'Throws',
137137
'throws': 'Throws'
138138
}.items():
139-
s = re.sub(r'\\%s\s*' % in_, r'\n\n$%s:\n\n' % out_, s)
139+
s = re.sub(r'[\\@]%s\s*' % in_, r'\n\n$%s:\n\n' % out_, s)
140140

141-
s = re.sub(r'\\details\s*', r'\n\n', s)
142-
s = re.sub(r'\\brief\s*', r'', s)
143-
s = re.sub(r'\\short\s*', r'', s)
144-
s = re.sub(r'\\ref\s*', r'', s)
141+
s = re.sub(r'[\\@]details\s*', r'\n\n', s)
142+
s = re.sub(r'[\\@]brief\s*', r'', s)
143+
s = re.sub(r'[\\@]short\s*', r'', s)
144+
s = re.sub(r'[\\@]ref\s*', r'', s)
145145

146-
s = re.sub(r'\\code\s?(.*?)\s?\\endcode',
146+
s = re.sub(r'[\\@]code\s?(.*?)\s?[\\@]endcode',
147147
r"```\n\1\n```\n", s, flags=re.DOTALL)
148148

149149
# HTML/TeX tags
150150
s = re.sub(r'<tt>(.*?)</tt>', r'``\1``', s, flags=re.DOTALL)
151151
s = re.sub(r'<pre>(.*?)</pre>', r"```\n\1\n```\n", s, flags=re.DOTALL)
152152
s = re.sub(r'<em>(.*?)</em>', r'*\1*', s, flags=re.DOTALL)
153153
s = re.sub(r'<b>(.*?)</b>', r'**\1**', s, flags=re.DOTALL)
154-
s = re.sub(r'\\f\$(.*?)\\f\$', r'$\1$', s, flags=re.DOTALL)
154+
s = re.sub(r'[\\@]f\$(.*?)[\\@]f\$', r'$\1$', s, flags=re.DOTALL)
155155
s = re.sub(r'<li>', r'\n\n* ', s)
156156
s = re.sub(r'</?ul>', r'', s)
157157
s = re.sub(r'</li>', r'\n\n', s)

0 commit comments

Comments
 (0)