Skip to content

Commit

Permalink
feat: support @n command
Browse files Browse the repository at this point in the history
  • Loading branch information
sdkrystian committed Jun 3, 2024
1 parent c476746 commit 0d821e2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
11 changes: 10 additions & 1 deletion src/lib/AST/ParseJavadoc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -768,6 +768,15 @@ visitInlineCommandComment(

switch(unsigned ID = cmd->getID())
{
// Newline
case CommandTraits::KCI_n:
{
if(! goodArgCount(0, *C))
return;
last_child_ = nullptr;
emplaceText<doc::Text>(true, "\n");
return;
}
// Emphasis
case CommandTraits::KCI_a:
case CommandTraits::KCI_e:
Expand Down Expand Up @@ -1163,7 +1172,6 @@ visitBlockCommandComment(
case CommandTraits::KCI_memberof:
case CommandTraits::KCI_msc:
case CommandTraits::KCI_mscfile:
case CommandTraits::KCI_n:
case CommandTraits::KCI_name:
case CommandTraits::KCI_namespace:
case CommandTraits::KCI_noop:
Expand Down Expand Up @@ -1257,6 +1265,7 @@ visitBlockCommandComment(
case CommandTraits::KCI_a:
case CommandTraits::KCI_e:
case CommandTraits::KCI_em:
case CommandTraits::KCI_n:
case CommandTraits::KCI_copybrief:
case CommandTraits::KCI_copydetails:
case CommandTraits::KCI_copydoc:
Expand Down
7 changes: 5 additions & 2 deletions src/lib/Gen/adoc/AdocCorpus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ operator()(
for(auto const& child : children.subspan(1))
{
if(non_empty)
dest_.push_back(' ');
dest_.push_back('\n');
non_empty = write(*child, *this);
}
dest_.push_back('\n');
Expand Down Expand Up @@ -227,7 +227,7 @@ operator()(
for(auto const& child : children.subspan(1))
{
if(non_empty)
dest_.push_back(' ');
dest_.push_back('\n');
non_empty = write(*child, *this);
}
dest_.push_back('\n');
Expand Down Expand Up @@ -265,6 +265,9 @@ operator()(doc::Text const& I)
// Asciidoc text must not have leading
// else they can be rendered up as code.
std::string_view s = trim(I.string);
// Render empty lines as paragraph delimiters.
if(s.empty())
s = "\n";
dest_.append(escapeAdoc(s));
}

Expand Down

0 comments on commit 0d821e2

Please sign in to comment.