Correct JavaDoc from doxygen comments indentation
Adds missing JavaDoc indentation for doxygen comments obtained from: - enum values - class methods - constructors - global functions/variables
This commit is contained in:
parent
d22ecafb36
commit
50d7f36f45
5 changed files with 46 additions and 29 deletions
|
|
@ -31,14 +31,33 @@ String *DoxygenTranslator::getDoxygenComment(Node *node) {
|
|||
return Getattr(node, "doxygen");
|
||||
}
|
||||
|
||||
/**
|
||||
* Indent all lines in the comment by given indentation string
|
||||
*/
|
||||
void DoxygenTranslator::extraIndentation(String *comment, const_String_or_char_ptr indentationString) {
|
||||
if (indentationString || Len(indentationString) > 0) {
|
||||
int len = Len(comment);
|
||||
bool trailing_newline = len > 0 && *(Char(comment) + len - 1) == '\n';
|
||||
Insert(comment, 0, indentationString);
|
||||
String *replace = NewStringf("\n%s", indentationString);
|
||||
Replaceall(comment, "\n", replace);
|
||||
if (trailing_newline) {
|
||||
len = Len(comment);
|
||||
Delslice(comment, len - 2, len); // Remove added trailing spaces on last line
|
||||
}
|
||||
Delete(replace);
|
||||
}
|
||||
}
|
||||
|
||||
String *DoxygenTranslator::getDocumentation(Node *node) {
|
||||
String *DoxygenTranslator::getDocumentation(Node *node, const_String_or_char_ptr indentationString) {
|
||||
|
||||
if (!hasDocumentation(node)) {
|
||||
return NewString("");
|
||||
}
|
||||
|
||||
return makeDocumentation(node);
|
||||
String *documentation = makeDocumentation(node);
|
||||
extraIndentation(documentation, indentationString);
|
||||
return documentation;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ public:
|
|||
* Return the documentation for a given node formated for the correct
|
||||
* documentation system.
|
||||
*/
|
||||
String *getDocumentation(Node *node);
|
||||
String *getDocumentation(Node *node, const_String_or_char_ptr indentationString);
|
||||
|
||||
/*
|
||||
* Returns truem is the specified node has comment attached.
|
||||
|
|
@ -84,6 +84,7 @@ protected:
|
|||
*/
|
||||
void printTree(const DoxygenEntityList &entityList);
|
||||
|
||||
void extraIndentation(String *comment, const_String_or_char_ptr indentationString);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -795,9 +795,7 @@ String *JavaDocConverter::makeDocumentation(Node *node) {
|
|||
|
||||
string translatedStr = indentAndInsertAsterisks(doc);
|
||||
|
||||
String *comment = NewString(translatedStr.c_str());
|
||||
// Append(comment, documentation); Replaceall(comment, "\n", "\n * ");
|
||||
return comment;
|
||||
return NewString(translatedStr.c_str());
|
||||
}
|
||||
|
||||
DoxygenEntityList entityList = parser.createTree(node, documentation);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue