Skip to content

Commit da7eb85

Browse files
authored
Merge pull request #11693 from albert-github/feature/bug_tblr_verbatim
Possibility to use verbatim parts in `tblr` tables.
2 parents 9fb5dd5 + e37d3cd commit da7eb85

File tree

2 files changed

+33
-7
lines changed

2 files changed

+33
-7
lines changed

src/latexdocvisitor.cpp

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -476,9 +476,18 @@ void LatexDocVisitor::operator()(const DocVerbatim &s)
476476
m_t << "}";
477477
break;
478478
case DocVerbatim::Verbatim:
479-
m_t << "\\begin{DoxyVerb}";
480-
m_t << s.text();
481-
m_t << "\\end{DoxyVerb}\n";
479+
if (isTableNested(s.parent())) // in table
480+
{
481+
m_t << "\\begin{DoxyCode}{0}";
482+
filter(s.text(), true);
483+
m_t << "\\end{DoxyCode}\n";
484+
}
485+
else
486+
{
487+
m_t << "\\begin{DoxyVerb}";
488+
m_t << s.text();
489+
m_t << "\\end{DoxyVerb}\n";
490+
}
482491
break;
483492
case DocVerbatim::HtmlOnly:
484493
case DocVerbatim::XmlOnly:
@@ -632,9 +641,18 @@ void LatexDocVisitor::operator()(const DocInclude &inc)
632641
m_t << inc.text();
633642
break;
634643
case DocInclude::VerbInclude:
635-
m_t << "\n\\begin{DoxyVerbInclude}\n";
636-
m_t << inc.text();
637-
m_t << "\\end{DoxyVerbInclude}\n";
644+
if (isTableNested(inc.parent())) // in table
645+
{
646+
m_t << "\\begin{DoxyCode}{0}";
647+
filter(inc.text(), true);
648+
m_t << "\\end{DoxyCode}\n";
649+
}
650+
else
651+
{
652+
m_t << "\n\\begin{DoxyVerbInclude}\n";
653+
m_t << inc.text();
654+
m_t << "\\end{DoxyVerbInclude}\n";
655+
}
638656
break;
639657
case DocInclude::Snippet:
640658
case DocInclude::SnippetWithLines:

src/latexgen.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2515,7 +2515,15 @@ void filterLatexString(TextStream &t,const QCString &str,
25152515
break;
25162516
case '\'': t << "\\textquotesingle{}";
25172517
break;
2518-
case '\n': if (retainNewline) t << "\\newline"; else t << ' ';
2518+
case '\n': if (retainNewline)
2519+
{
2520+
t << "\\newline";
2521+
if (insideTable) t << " ";
2522+
}
2523+
else
2524+
{
2525+
t << ' ';
2526+
}
25192527
break;
25202528
case ' ': if (keepSpaces) { if (insideTabbing) t << "\\>"; else t << '~'; } else t << ' ';
25212529
break;

0 commit comments

Comments
 (0)