Skip to content

Commit 47ed440

Browse files
authored
doxygen2man: fix printing of lines starting with '.' (#431)
if a line starts with a '.' (eg the '...' in qbarray.h) then nroff thinks it's looking for a macro called '..'. The easiest solution is to add a dummy format at the start of the line (just adding \ seems not to work).
1 parent 5b16d50 commit 47ed440

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

doxygen2man/doxygen2man.c

+8-1
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,14 @@ static cstring_t get_codeline(xmlNode *this_tag)
222222
buffer = cstring_append_chars(buffer, " ");
223223
}
224224
if (strcmp((char*)sub_tag->name, "text") == 0) {
225-
buffer = cstring_append_chars(buffer, (char*)sub_tag->content);
225+
// If the line starts with a dot then escape the first one to
226+
// stop nroff thinking it's a macro
227+
char *tmp = (char*)sub_tag->content;
228+
if (tmp[0] == '.') {
229+
buffer = cstring_append_chars(buffer, (char*)"\\[char46]");
230+
tmp += 1;
231+
}
232+
buffer = cstring_append_chars(buffer, tmp);
226233
}
227234
if (strcmp((char*)sub_tag->name, "ref") == 0) {
228235
// Handled by the child recusion below

0 commit comments

Comments
 (0)