Skip to content

Commit

Permalink
Fixed paragraphs disappearing when end-of-line style doc comments are…
Browse files Browse the repository at this point in the history
… used. Fixes #38.
  • Loading branch information
lawmurray committed Feb 4, 2024
1 parent 15bba35 commit 93451ee
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 5 additions & 1 deletion demo/parsing.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,14 @@ int b;

///
/// Documented with `///` style preceding comment that wraps across multiple
/// lines.
/// lines and has multiple paragraphs.
///
///This is the second paragraph.
///
/// @ingroup parsing
///
/// This is the third paragraph.
///
int c;

int d; ///< Documented after entity with `///` comment @ingroup parsing
Expand Down
6 changes: 6 additions & 0 deletions src/Parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,12 @@ void Parser::translate(const std::string_view& comment, Entity& entity) {
token = tokenizer.next();
}
if (file) {
/* discard */
entity.docs.clear();
} else {
/* always add a new line, as multiple doc comments may appear before an
* entity (e.g. multiple end-of-line style comments) and these should be
* separated with new lines */
entity.docs.append("\n");
}
}

0 comments on commit 93451ee

Please sign in to comment.