Doxygen
Loading...
Searching...
No Matches
latexdocvisitor.cpp
Go to the documentation of this file.
1/******************************************************************************
2 *
3 * Copyright (C) 1997-2022 by Dimitri van Heesch.
4 *
5 * Permission to use, copy, modify, and distribute this software and its
6 * documentation under the terms of the GNU General Public License is hereby
7 * granted. No representations are made about the suitability of this software
8 * for any purpose. It is provided "as is" without express or implied warranty.
9 * See the GNU General Public License for more details.
10 *
11 * Documents produced by Doxygen are derivative works derived from the
12 * input used in their production; they are not affected by this license.
13 *
14 */
15
16#include <algorithm>
17#include <array>
18
19#include "htmlattrib.h"
20#include "latexdocvisitor.h"
21#include "latexgen.h"
22#include "docparser.h"
23#include "language.h"
24#include "doxygen.h"
25#include "outputgen.h"
26#include "outputlist.h"
27#include "dot.h"
28#include "util.h"
29#include "message.h"
30#include "parserintf.h"
31#include "msc.h"
32#include "dia.h"
33#include "cite.h"
34#include "filedef.h"
35#include "config.h"
36#include "htmlentity.h"
37#include "emoji.h"
38#include "plantuml.h"
39#include "mermaid.h"
40#include "fileinfo.h"
41#include "regex.h"
42#include "portable.h"
43#include "codefragment.h"
44
45static const int g_maxLevels = 7;
46static const std::array<const char *,g_maxLevels> g_secLabels =
47{ "doxysection",
48 "doxysubsection",
49 "doxysubsubsection",
50 "doxysubsubsubsection",
51 "doxysubsubsubsubsection",
52 "doxysubsubsubsubsubsection",
53 "doxysubsubsubsubsubsubsection"
54};
55
56static const char *g_paragraphLabel = "doxyparagraph";
57static const char *g_subparagraphLabel = "doxysubparagraph";
58
59const char *LatexDocVisitor::getSectionName(int level) const
60{
61 bool compactLatex = Config_getBool(COMPACT_LATEX);
62 int l = level;
63 if (compactLatex) l++;
64
65 if (l < g_maxLevels)
66 {
67 l += m_hierarchyLevel; /* May be -1 if generating main page */
68 // Sections get special treatment because they inherit the parent's level
69 if (l >= g_maxLevels)
70 {
71 l = g_maxLevels - 1;
72 }
73 else if (l < 0)
74 {
75 /* Should not happen; level is always >= 1 and hierarchyLevel >= -1 */
76 l = 0;
77 }
78 return g_secLabels[l];
79 }
80 else if (l == 7)
81 {
82 return g_paragraphLabel;
83 }
84 else
85 {
87 }
88}
89
90static void insertDimension(TextStream &t, DString dimension, const char *orientationString)
91{
92 // dimensions for latex images can be a percentage, in this case they need some extra
93 // handling as the % symbol is used for comments
94 static const reg::Ex re(R"((\d+)%)");
95 std::string s = dimension.str();
96 reg::Match match;
97 if (reg::search(s,match,re))
98 {
99 bool ok = false;
100 double percent = DString(match[1].str()).toInt(&ok);
101 if (ok)
102 {
103 t << percent/100.0 << "\\text" << orientationString;
104 return;
105 }
106 }
107 t << dimension;
108}
109
110static void visitPreStart(TextStream &t, bool hasCaption, DString name, DString width, DString height, bool inlineImage = false)
111{
112 if (inlineImage)
113 {
114 t << "\n\\begin{DoxyInlineImage}%\n";
115 }
116 else
117 {
118 if (hasCaption)
119 {
120 t << "\n\\begin{DoxyImage}%\n";
121 }
122 else
123 {
124 t << "\n\\begin{DoxyImageNoCaption}%\n"
125 " \\doxymbox{";
126 }
127 }
128
129 t << "\\includegraphics";
130 if (!width.empty() || !height.empty())
131 {
132 t << "[";
133 }
134 if (!width.empty())
135 {
136 t << "width=";
137 insertDimension(t, width, "width");
138 }
139 if (!width.empty() && !height.empty())
140 {
141 t << ",";
142 }
143 if (!height.empty())
144 {
145 t << "height=";
146 insertDimension(t, height, "height");
147 }
148 if (width.empty() && height.empty())
149 {
150 /* default setting */
151 if (inlineImage)
152 {
153 t << "[height=\\baselineskip,keepaspectratio=true]";
154 }
155 else
156 {
157 t << "[width=\\textwidth,height=\\textheight/2,keepaspectratio=true]";
158 }
159 }
160 else
161 {
162 t << "]";
163 }
164
165 t << "{" << name << "}";
166
167 if (hasCaption)
168 {
169 if (!inlineImage)
170 {
171 if (Config_getBool(PDF_HYPERLINKS))
172 {
173 t << "%\n\\doxyfigcaption{";
174 }
175 else
176 {
177 t << "%\n\\doxyfigcaptionnolink{";
178 }
179 }
180 else
181 {
182 t << "%"; // to catch the caption
183 }
184 }
185}
186
187
188
189static void visitPostEnd(TextStream &t, bool hasCaption, bool inlineImage = false)
190{
191 if (inlineImage)
192 {
193 t << "%\n\\end{DoxyInlineImage}\n";
194 }
195 else
196 {
197 t << "}%\n"; // end doxymbox or caption
198 if (hasCaption)
199 {
200 t << "\\end{DoxyImage}\n";
201 }
202 else
203 {
204 t << "\\end{DoxyImageNoCaption}\n";
205 }
206 }
207}
208
210{
211 for (const auto &n : children)
212 {
213 std::visit(*this,n);
214 }
215}
216
218 const DString &langExt, int hierarchyLevel)
219 : m_t(t), m_ci(ci), m_lcg(lcg), m_insidePre(false),
220 m_insideItem(false), m_hide(false),
221 m_langExt(langExt), m_hierarchyLevel(hierarchyLevel)
222{
223}
224
225 //--------------------------------------
226 // visitor functions for leaf nodes
227 //--------------------------------------
228
230{
231 if (m_hide) return;
232 filter(w.word());
233}
234
236{
237 if (m_hide) return;
238 startLink(w.ref(),w.file(),w.anchor());
239 filter(w.word());
240 endLink(w.ref(),w.file(),w.anchor());
241}
242
244{
245 if (m_hide) return;
246 if (m_insidePre)
247 {
248 m_t << w.chars();
249 }
250 else
251 {
252 m_t << " ";
253 }
254}
255
257{
258 if (m_hide) return;
259 bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS);
260 const char *res = HtmlEntityMapper::instance().latex(s.symbol());
261 if (res)
262 {
264 {
265 if (pdfHyperlinks)
266 {
267 m_t << "\\texorpdfstring{$<$}{<}";
268 }
269 else
270 {
271 m_t << "$<$";
272 }
273 }
275 {
276 if (pdfHyperlinks)
277 {
278 m_t << "\\texorpdfstring{$>$}{>}";
279 }
280 else
281 {
282 m_t << "$>$";
283 }
284 }
285 else
286 {
287 m_t << res;
288 }
289 }
290 else
291 {
292 err("LaTeX: non supported HTML-entity found: {}\n",HtmlEntityMapper::instance().html(s.symbol(),true));
293 }
294}
295
297{
298 if (m_hide) return;
300 if (!emojiName.empty())
301 {
302 DString imageName=emojiName.mid(1,emojiName.length()-2); // strip : at start and end
303 if (m_texOrPdf != TexOrPdf::PDF) m_t << "\\doxygenemoji{";
304 filter(emojiName);
305 if (m_texOrPdf != TexOrPdf::PDF) m_t << "}{" << imageName << "}";
306 }
307 else
308 {
309 m_t << s.name();
310 }
311}
312
314{
315 if (m_hide) return;
316 if (Config_getBool(PDF_HYPERLINKS))
317 {
318 m_t << "\\href{";
319 if (u.isEmail()) m_t << "mailto:";
320 m_t << latexFilterURL(u.url()) << "}";
321 }
322 m_t << "{\\texttt{";
323 filter(u.url());
324 m_t << "}}";
325}
326
328{
329 if (m_hide) return;
330 if (m_insideItem)
331 {
332 m_t << "\\\\\n";
333 }
334 else
335 {
336 m_t << "~\\newline\n";
337 }
338}
339
341{
342 if (m_hide) return;
343 if (insideTable())
344 m_t << "\\DoxyHorRuler{1}\n";
345 else
346 m_t << "\\DoxyHorRuler{0}\n";
347}
348
350{
351 if (m_hide) return;
352 switch (s.style())
353 {
355 if (s.enable()) m_t << "{\\bfseries{"; else m_t << "}}";
356 break;
360 if (s.enable()) m_t << "\\sout{"; else m_t << "}";
361 break;
364 if (s.enable()) m_t << "\\uline{"; else m_t << "}";
365 break;
367 if (s.enable()) m_t << "{\\itshape "; else m_t << "}";
368 break;
372 if (s.enable()) m_t << "{\\ttfamily "; else m_t << "}";
373 break;
375 if (s.enable()) m_t << "\\textsubscript{"; else m_t << "}";
376 break;
378 if (s.enable()) m_t << "\\textsuperscript{"; else m_t << "}";
379 break;
381 if (s.enable()) m_t << "\\begin{center}"; else m_t << "\\end{center} ";
382 break;
384 if (s.enable()) m_t << "\n\\footnotesize "; else m_t << "\n\\normalsize ";
385 break;
387 if (s.enable()) m_t << "{\\itshape "; else m_t << "}";
388 break;
390 if (s.enable())
391 {
392 m_t << "\n\\begin{DoxyPre}";
393 m_insidePre=true;
394 }
395 else
396 {
397 m_insidePre=false;
398 m_t << "\\end{DoxyPre}\n";
399 }
400 break;
401 case DocStyleChange::Div: /* HTML only */ break;
402 case DocStyleChange::Span: /* HTML only */ break;
403 }
404}
405
407{
408 if (m_hide) return;
409 DString lang = m_langExt;
410 if (!s.language().empty()) // explicit language setting
411 {
412 lang = s.language();
413 }
414 SrcLangExt langExt = getLanguageFromCodeLang(lang);
415 switch(s.type())
416 {
418 {
419 m_ci.startCodeFragment("DoxyCode");
420 getCodeParser(lang).parseCode(m_ci,s.context(),s.text(),langExt,
421 Config_getBool(STRIP_CODE_COMMENTS),
422 CodeParserOptions().setExample(s.isExample(),s.exampleFile()));
423 m_ci.endCodeFragment("DoxyCode");
424 }
425 break;
427 filter(s.text(), true);
428 break;
430 m_t << "{\\ttfamily ";
431 filter(s.text(), true);
432 m_t << "}";
433 break;
435 if (isTableNested(s.parent())) // in table
436 {
437 m_t << "\\begin{DoxyCode}{0}";
438 filter(s.text(), true);
439 m_t << "\\end{DoxyCode}\n";
440 }
441 else
442 {
443 m_t << "\\begin{DoxyVerb}";
444 m_t << s.text();
445 m_t << "\\end{DoxyVerb}\n";
446 }
447 break;
453 /* nothing */
454 break;
456 m_t << s.text();
457 break;
458 case DocVerbatim::Dot:
459 {
460 bool exists = false;
461 auto fileName = writeInlineGraph(Config_getString(LATEX_OUTPUT)+"/inline_dotgraph_", // baseName
462 ".dot", // extension
463 s.text(), // contents
464 exists);
465 if (!fileName.empty())
466 {
467 startDotFile(fileName,s.width(),s.height(),s.hasCaption(),s.srcFile(),s.srcLine(),!exists);
468 visitChildren(s);
470 }
471 }
472 break;
473 case DocVerbatim::Msc:
474 {
475 bool exists = false;
476 auto fileName = writeInlineGraph(Config_getString(LATEX_OUTPUT)+"/inline_mscgraph_", // baseName
477 ".msc", // extension
478 "msc {"+s.text()+"}", // contents
479 exists);
480 if (!fileName.empty())
481 {
482 writeMscFile(fileName, s, !exists);
483 }
484 }
485 break;
487 {
488 DString latexOutput = Config_getString(LATEX_OUTPUT);
489 auto baseNameVector = PlantumlManager::instance().writePlantUMLSource(
490 latexOutput,s.exampleFile(),s.text(),
492 s.engine(),s.srcFile(),s.srcLine(),true);
493
494 for (const auto &baseName: baseNameVector)
495 {
496 writePlantUMLFile(baseName, s);
497 }
498 }
499 break;
501 if (Config_getBool(MERMAID_RENDER_MODE)!=MERMAID_RENDER_MODE_t::CLIENT_SIDE)
502 {
503 auto latexOutput = Config_getString(LATEX_OUTPUT);
504 auto outputFormat = MermaidManager::OutputFormat::LaTeX;
505 auto imageFormat = MermaidManager::convertToImageFormat(outputFormat);
507 latexOutput,s.exampleFile(),s.text(),imageFormat,
508 s.srcFile(),s.srcLine());
509 writeMermaidFile(baseName, s);
510 }
511 break;
512 }
513}
514
516{
517 if (m_hide) return;
518 m_t << "\\label{" << stripPath(anc.file()) << "_" << anc.anchor() << "}%\n";
519 if (!anc.file().empty() && Config_getBool(PDF_HYPERLINKS))
520 {
521 m_t << "\\Hypertarget{" << stripPath(anc.file()) << "_" << anc.anchor()
522 << "}%\n";
523 }
524}
525
527{
528 if (m_hide) return;
530 switch(inc.type())
531 {
533 {
534 m_ci.startCodeFragment("DoxyCodeInclude");
535 FileInfo cfi( inc.file().str() );
536 auto fd = createFileDef( cfi.dirPath(), cfi.fileName() );
538 inc.text(),
539 langExt,
540 inc.stripCodeComments(),
542 .setExample(inc.isExample(), inc.exampleFile())
543 .setFileDef(fd.get())
544 .setInlineFragment(true)
545 );
546 m_ci.endCodeFragment("DoxyCodeInclude");
547 }
548 break;
550 {
551 m_ci.startCodeFragment("DoxyCodeInclude");
553 inc.text(),langExt,
554 inc.stripCodeComments(),
556 .setExample(inc.isExample(), inc.exampleFile())
557 .setInlineFragment(true)
558 .setShowLineNumbers(false)
559 );
560 m_ci.endCodeFragment("DoxyCodeInclude");
561 }
562 break;
570 break;
572 m_t << inc.text();
573 break;
575 if (isTableNested(inc.parent())) // in table
576 {
577 m_t << "\\begin{DoxyCode}{0}";
578 filter(inc.text(), true);
579 m_t << "\\end{DoxyCode}\n";
580 }
581 else
582 {
583 m_t << "\n\\begin{DoxyVerbInclude}\n";
584 m_t << inc.text();
585 m_t << "\\end{DoxyVerbInclude}\n";
586 }
587 break;
590 {
591 m_ci.startCodeFragment("DoxyCodeInclude");
593 inc.file(),
594 inc.blockId(),
595 inc.context(),
597 inc.trimLeft(),
599 );
600 m_ci.endCodeFragment("DoxyCodeInclude");
601 }
602 break;
603 }
604}
605
607{
608 //printf("DocIncOperator: type=%d first=%d, last=%d text='%s'\n",
609 // op.type(),op.isFirst(),op.isLast(),qPrint(op.text()));
610 if (op.isFirst())
611 {
612 if (!m_hide) m_ci.startCodeFragment("DoxyCodeInclude");
614 m_hide = true;
615 }
617 if (locLangExt.empty()) locLangExt = m_langExt;
618 SrcLangExt langExt = getLanguageFromFileName(locLangExt);
619 if (op.type()!=DocIncOperator::Skip)
620 {
621 m_hide = popHidden();
622 if (!m_hide)
623 {
624 std::unique_ptr<FileDef> fd;
625 if (!op.includeFileName().empty())
626 {
627 FileInfo cfi( op.includeFileName().str() );
628 fd = createFileDef( cfi.dirPath(), cfi.fileName() );
629 }
630
631 getCodeParser(locLangExt).parseCode(m_ci,op.context(),op.text(),langExt,
634 .setExample(op.isExample(),op.exampleFile())
635 .setFileDef(fd.get())
636 .setStartLine(op.line())
638 );
639 }
641 m_hide=true;
642 }
643 if (op.isLast())
644 {
646 if (!m_hide) m_ci.endCodeFragment("DoxyCodeInclude");
647 }
648 else
649 {
650 if (!m_hide) m_t << "\n";
651 }
652}
653
655{
656 if (m_hide) return;
657 DString s = f.text();
658 const char *p = s.data();
659 char c = 0;
660 if (p)
661 {
662 while ((c=*p++))
663 {
664 switch (c)
665 {
666 case '\'': m_t << "\\textnormal{\\textquotesingle}"; break;
667 default: m_t << c; break;
668 }
669 }
670 }
671}
672
674{
675 if (m_hide) return;
677}
678
682
684{
685 if (m_hide) return;
686 auto opt = cite.option();
687 DString txt;
688 if (opt.noCite())
689 {
690 if (!cite.file().empty())
691 {
692 txt = cite.getText();
693 }
694 else
695 {
696 if (!opt.noPar()) txt += "[";
697 txt += cite.target();
698 if (!opt.noPar()) txt += "]";
699 }
700 m_t << "{\\bfseries ";
701 filter(txt);
702 m_t << "}";
703 }
704 else
705 {
706 if (!cite.file().empty())
707 {
708 DString anchor = cite.anchor();
710 anchor = anchor.mid(anchorPrefix.length()); // strip prefix
711
712 txt = "\\DoxyCite{" + anchor + "}";
713 if (opt.isNumber())
714 {
715 txt += "{number}";
716 }
717 else if (opt.isShortAuthor())
718 {
719 txt += "{shortauthor}";
720 }
721 else if (opt.isYear())
722 {
723 txt += "{year}";
724 }
725 if (!opt.noPar()) txt += "{1}";
726 else txt += "{0}";
727
728 m_t << txt;
729 }
730 else
731 {
732 if (!opt.noPar()) txt += "[";
733 txt += cite.target();
734 if (!opt.noPar()) txt += "]";
735 m_t << "{\\bfseries ";
736 filter(txt);
737 m_t << "}";
738 }
739 }
740}
741
742//--------------------------------------
743// visitor functions for compound nodes
744//--------------------------------------
745
747{
748 if (m_hide) return;
749 if (m_indentLevel>=maxIndentLevels-1) return;
750 if (l.isEnumList())
751 {
752 m_t << "\n\\begin{DoxyEnumerate}";
754 }
755 else
756 {
758 m_t << "\n\\begin{DoxyItemize}";
759 }
760 visitChildren(l);
761 if (l.isEnumList())
762 {
763 m_t << "\n\\end{DoxyEnumerate}";
764 }
765 else
766 {
767 m_t << "\n\\end{DoxyItemize}";
768 }
769}
770
772{
773 if (m_hide) return;
774 switch (li.itemNumber())
775 {
776 case DocAutoList::Unchecked: // unchecked
777 m_t << "\n\\item[\\DoxyUnchecked] ";
778 break;
779 case DocAutoList::Checked_x: // checked with x
780 case DocAutoList::Checked_X: // checked with X
781 m_t << "\n\\item[\\DoxyChecked] ";
782 break;
783 default:
784 m_t << "\n\\item ";
785 break;
786 }
788 visitChildren(li);
790}
791
793{
794 if (m_hide) return;
795 visitChildren(p);
796 if (!p.isLast() && // omit <p> for last paragraph
797 !(p.parent() && // and for parameter sections
798 std::get_if<DocParamSect>(p.parent())
799 )
800 )
801 {
802 if (insideTable())
803 {
804 m_t << "~\\newline\n";
805 }
806 else
807 {
808 m_t << "\n\n";
809 }
810 }
811}
812
814{
815 visitChildren(r);
816}
817
819{
820 if (m_hide) return;
821 switch(s.type())
822 {
824 m_t << "\\begin{DoxySeeAlso}{";
826 break;
828 m_t << "\\begin{DoxyReturn}{";
830 break;
832 m_t << "\\begin{DoxyAuthor}{";
833 filter(theTranslator->trAuthor(true,true));
834 break;
836 m_t << "\\begin{DoxyAuthor}{";
837 filter(theTranslator->trAuthor(true,false));
838 break;
840 m_t << "\\begin{DoxyVersion}{";
842 break;
844 m_t << "\\begin{DoxySince}{";
846 break;
848 m_t << "\\begin{DoxyDate}{";
850 break;
852 m_t << "\\begin{DoxyNote}{";
854 break;
856 m_t << "\\begin{DoxyWarning}{";
858 break;
860 m_t << "\\begin{DoxyPrecond}{";
862 break;
864 m_t << "\\begin{DoxyPostcond}{";
866 break;
868 m_t << "\\begin{DoxyCopyright}{";
870 break;
872 m_t << "\\begin{DoxyInvariant}{";
874 break;
876 m_t << "\\begin{DoxyRemark}{";
878 break;
880 m_t << "\\begin{DoxyAttention}{";
882 break;
884 m_t << "\\begin{DoxyImportant}{";
886 break;
888 m_t << "\\begin{DoxyParagraph}{";
889 break;
891 m_t << "\\begin{DoxyParagraph}{";
892 break;
893 case DocSimpleSect::Unknown: break;
894 }
895
896 if (s.title())
897 {
898 m_insideItem=true;
899 std::visit(*this,*s.title());
900 m_insideItem=false;
901 }
902 m_t << "}\n";
904 visitChildren(s);
905 switch(s.type())
906 {
908 m_t << "\n\\end{DoxySeeAlso}\n";
909 break;
911 m_t << "\n\\end{DoxyReturn}\n";
912 break;
914 m_t << "\n\\end{DoxyAuthor}\n";
915 break;
917 m_t << "\n\\end{DoxyAuthor}\n";
918 break;
920 m_t << "\n\\end{DoxyVersion}\n";
921 break;
923 m_t << "\n\\end{DoxySince}\n";
924 break;
926 m_t << "\n\\end{DoxyDate}\n";
927 break;
929 m_t << "\n\\end{DoxyNote}\n";
930 break;
932 m_t << "\n\\end{DoxyWarning}\n";
933 break;
935 m_t << "\n\\end{DoxyPrecond}\n";
936 break;
938 m_t << "\n\\end{DoxyPostcond}\n";
939 break;
941 m_t << "\n\\end{DoxyCopyright}\n";
942 break;
944 m_t << "\n\\end{DoxyInvariant}\n";
945 break;
947 m_t << "\n\\end{DoxyRemark}\n";
948 break;
950 m_t << "\n\\end{DoxyAttention}\n";
951 break;
953 m_t << "\n\\end{DoxyImportant}\n";
954 break;
956 m_t << "\n\\end{DoxyParagraph}\n";
957 break;
959 m_t << "\n\\end{DoxyParagraph}\n";
960 break;
961 default:
962 break;
963 }
965}
966
968{
969 if (m_hide) return;
970 visitChildren(t);
971}
972
974{
975 if (m_hide) return;
976 m_t << "\\begin{DoxyItemize}\n";
978 visitChildren(l);
979 m_t << "\\end{DoxyItemize}\n";
980}
981
983{
984 if (m_hide) return;
985 m_t << "\\item ";
987 if (li.paragraph())
988 {
989 visit(*this,*li.paragraph());
990 }
992}
993
995{
996 if (m_hide) return;
997 bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS);
998 if (pdfHyperlinks)
999 {
1000 m_t << "\\hypertarget{" << stripPath(s.file()) << "_" << s.anchor() << "}{}";
1001 }
1002 m_t << "\\" << getSectionName(s.level()) << "{";
1003 if (pdfHyperlinks)
1004 {
1005 m_t << "\\texorpdfstring{";
1006 }
1007 if (s.title())
1008 {
1009 if (pdfHyperlinks) m_texOrPdf = TexOrPdf::TEX;
1010 std::visit(*this,*s.title());
1012 }
1013 if (pdfHyperlinks)
1014 {
1015 m_t << "}{";
1016 if (s.title())
1017 {
1018 if (pdfHyperlinks) m_texOrPdf = TexOrPdf::PDF;
1019 std::visit(*this,*s.title());
1021 }
1022 m_t << "}";
1023 }
1024 m_t << "}\\label{" << stripPath(s.file()) << "_" << s.anchor() << "}\n";
1025 visitChildren(s);
1026}
1027
1029{
1030 if (m_hide) return;
1031 if (m_indentLevel>=maxIndentLevels-1) return;
1033 if (s.type()==DocHtmlList::Ordered)
1034 {
1035 bool first = true;
1036 m_t << "\n\\begin{DoxyEnumerate}";
1037 for (const auto &opt : s.attribs())
1038 {
1039 if (opt.name=="type")
1040 {
1041 if (opt.value=="1")
1042 {
1043 m_t << (first ? "[": ",");
1044 m_t << "label=\\arabic*";
1045 first = false;
1046 }
1047 else if (opt.value=="a")
1048 {
1049 m_t << (first ? "[": ",");
1050 m_t << "label=\\enumalphalphcnt*";
1051 first = false;
1052 }
1053 else if (opt.value=="A")
1054 {
1055 m_t << (first ? "[": ",");
1056 m_t << "label=\\enumAlphAlphcnt*";
1057 first = false;
1058 }
1059 else if (opt.value=="i")
1060 {
1061 m_t << (first ? "[": ",");
1062 m_t << "label=\\roman*";
1063 first = false;
1064 }
1065 else if (opt.value=="I")
1066 {
1067 m_t << (first ? "[": ",");
1068 m_t << "label=\\Roman*";
1069 first = false;
1070 }
1071 }
1072 else if (opt.name=="start")
1073 {
1074 m_t << (first ? "[": ",");
1075 bool ok = false;
1076 int val = opt.value.toInt(&ok);
1077 if (ok) m_t << "start=" << val;
1078 first = false;
1079 }
1080 }
1081 if (!first) m_t << "]\n";
1082 }
1083 else
1084 {
1085 m_t << "\n\\begin{DoxyItemize}";
1086 }
1087 visitChildren(s);
1088 if (m_indentLevel>=maxIndentLevels-1) return;
1089 if (s.type()==DocHtmlList::Ordered)
1090 m_t << "\n\\end{DoxyEnumerate}";
1091 else
1092 m_t << "\n\\end{DoxyItemize}";
1093}
1094
1096{
1097 if (m_hide) return;
1098 if (m_listItemInfo[indentLevel()].isEnum)
1099 {
1100 for (const auto &opt : l.attribs())
1101 {
1102 if (opt.name=="value")
1103 {
1104 bool ok = false;
1105 int val = opt.value.toInt(&ok);
1106 if (ok)
1107 {
1108 m_t << "\n\\setcounter{DoxyEnumerate" << DString::integerToRoman(indentLevel()+1,false) << "}{" << (val - 1) << "}";
1109 }
1110 }
1111 }
1112 }
1113 m_t << "\n\\item ";
1115 visitChildren(l);
1117}
1118
1119
1121{
1122 HtmlAttribList attrs = dl.attribs();
1123 auto it = std::find_if(attrs.begin(),attrs.end(),
1124 [](const auto &att) { return att.name=="class"; });
1125 if (it!=attrs.end() && it->value == "reflist") return true;
1126 return false;
1127}
1128
1129static bool listIsNested(const DocHtmlDescList &dl)
1130{
1131 bool isNested=false;
1132 const DocNodeVariant *n = dl.parent();
1133 while (n && !isNested)
1134 {
1135 if (std::get_if<DocHtmlDescList>(n))
1136 {
1137 isNested = !classEqualsReflist(std::get<DocHtmlDescList>(*n));
1138 }
1139 n = ::parent(n);
1140 }
1141 return isNested;
1142}
1143
1145{
1146 if (m_hide) return;
1147 bool eq = classEqualsReflist(dl);
1148 if (eq)
1149 {
1150 m_t << "\n\\begin{DoxyRefList}";
1151 }
1152 else
1153 {
1154 if (listIsNested(dl)) m_t << "\n\\hfill";
1155 m_t << "\n\\begin{DoxyDescription}";
1156 }
1157 visitChildren(dl);
1158 if (eq)
1159 {
1160 m_t << "\n\\end{DoxyRefList}";
1161 }
1162 else
1163 {
1164 m_t << "\n\\end{DoxyDescription}";
1165 }
1166}
1167
1169{
1170 if (m_hide) return;
1171 m_t << "\n\\item[{\\parbox[t]{\\linewidth}{";
1172 m_insideItem=true;
1173 visitChildren(dt);
1174 m_insideItem=false;
1175 m_t << "}}]";
1176}
1177
1179{
1181 if (!m_insideItem) m_t << "\\hfill";
1182 m_t << " \\\\\n";
1183 visitChildren(dd);
1185}
1186
1188{
1189 bool isNested=m_lcg.usedTableLevel()>0;
1190 while (n && !isNested)
1191 {
1193 n = ::parent(n);
1194 }
1195 return isNested;
1196}
1197
1199{
1200 if (isTableNested(n))
1201 {
1202 m_t << "\\begin{DoxyTableNested}{" << cols << "}";
1203 }
1204 else
1205 {
1206 m_t << "\n\\begin{DoxyTable}{" << cols << "}";
1207 }
1208}
1209
1211{
1212 if (isTableNested(n))
1213 {
1214 m_t << "\\end{DoxyTableNested}\n";
1215 }
1216 else
1217 {
1218 m_t << "\\end{DoxyTable}\n";
1219 }
1220}
1221
1223{
1224 if (m_hide) return;
1226 const DocHtmlCaption *c = t.caption() ? &std::get<DocHtmlCaption>(*t.caption()) : nullptr;
1227 if (c)
1228 {
1229 bool pdfHyperLinks = Config_getBool(PDF_HYPERLINKS);
1230 if (!c->file().empty() && pdfHyperLinks)
1231 {
1232 m_t << "\\hypertarget{" << stripPath(c->file()) << "_" << c->anchor()
1233 << "}{}";
1234 }
1235 m_t << "\n";
1236 }
1237
1239 if (!isTableNested(t.parent()))
1240 {
1241 // write caption
1242 m_t << "{";
1243 if (c)
1244 {
1245 std::visit(*this, *t.caption());
1246 }
1247 m_t << "}";
1248 // write label
1249 m_t << "{";
1250 if (c && (!stripPath(c->file()).empty() || !c->anchor().empty()))
1251 {
1252 m_t << stripPath(c->file()) << "_" << c->anchor();
1253 }
1254 m_t << "}";
1255 }
1256
1257 // write head row(s)
1258 m_t << "{" << t.numberHeaderRows() << "}\n";
1259
1261
1262 visitChildren(t);
1264 popTableState();
1265}
1266
1268{
1269 if (m_hide) return;
1270 visitChildren(c);
1271}
1272
1274{
1275 if (m_hide) return;
1277
1278 visitChildren(row);
1279
1280 m_t << "\\\\";
1281
1282 size_t col = 1;
1283 for (auto &span : rowSpans())
1284 {
1285 if (span.rowSpan>0) span.rowSpan--;
1286 if (span.rowSpan<=0)
1287 {
1288 // inactive span
1289 }
1290 else if (span.column>col)
1291 {
1292 col = span.column+span.colSpan;
1293 }
1294 else
1295 {
1296 col = span.column+span.colSpan;
1297 }
1298 }
1299
1300 m_t << "\n";
1301}
1302
1304{
1305 if (m_hide) return;
1306 //printf("Cell(r=%u,c=%u) rowSpan=%d colSpan=%d currentColumn()=%zu\n",c.rowIndex(),c.columnIndex(),c.rowSpan(),c.colSpan(),currentColumn());
1307
1309
1310 DString cellOpts;
1311 DString cellSpec;
1312 auto appendOpt = [&cellOpts](const DString &s)
1313 {
1314 if (!cellOpts.empty()) cellOpts+=",";
1315 cellOpts+=s;
1316 };
1317 auto appendSpec = [&cellSpec](const DString &s)
1318 {
1319 if (!cellSpec.empty()) cellSpec+=",";
1320 cellSpec+=s;
1321 };
1322 auto writeCell = [this,&cellOpts,&cellSpec]()
1323 {
1324 if (!cellOpts.empty() || !cellSpec.empty())
1325 {
1326 m_t << "\\SetCell";
1327 if (!cellOpts.empty())
1328 {
1329 m_t << "[" << cellOpts << "]";
1330 }
1331 m_t << "{" << cellSpec << "}";
1332 }
1333 };
1334
1335 // skip over columns that have a row span starting at an earlier row
1336 for (const auto &span : rowSpans())
1337 {
1338 //printf("span(r=%u,c=%u): column=%zu colSpan=%zu,rowSpan=%zu currentColumn()=%zu\n",
1339 // span.cell.rowIndex(),span.cell.columnIndex(),
1340 // span.column,span.colSpan,span.rowSpan,
1341 // currentColumn());
1342 if (span.rowSpan>0 && span.column==currentColumn())
1343 {
1344 setCurrentColumn(currentColumn()+span.colSpan);
1345 for (size_t i=0;i<span.colSpan;i++)
1346 {
1347 m_t << "&";
1348 }
1349 }
1350 }
1351
1352 int cs = c.colSpan();
1353 int ha = c.alignment();
1354 int rs = c.rowSpan();
1355 int va = c.valignment();
1356
1357 switch (ha) // horizontal alignment
1358 {
1359 case DocHtmlCell::Right:
1360 appendSpec("r");
1361 break;
1363 appendSpec("c");
1364 break;
1365 default:
1366 // default
1367 break;
1368 }
1369 if (rs>0) // row span
1370 {
1371 appendOpt("r="+DString().setNum(rs));
1372 //printf("adding row span: cell={r=%d c=%d rs=%d cs=%d} curCol=%zu\n",
1373 // c.rowIndex(),c.columnIndex(),c.rowSpan(),c.colSpan(),
1374 // currentColumn());
1376 }
1377 if (cs>1) // column span
1378 {
1379 // update column to the end of the span, needs to be done *after* calling addRowSpan()
1381 appendOpt("c="+DString().setNum(cs));
1382 }
1383 if (c.isHeading())
1384 {
1385 appendSpec("bg=\\tableheadbgcolor");
1386 appendSpec("font=\\bfseries");
1387 }
1388 switch(va) // vertical alignment
1389 {
1390 case DocHtmlCell::Top:
1391 appendSpec("h");
1392 break;
1394 appendSpec("f");
1395 break;
1397 // default
1398 break;
1399 }
1400 writeCell();
1401
1402 visitChildren(c);
1403
1404 for (int i=0;i<cs-1;i++)
1405 {
1406 m_t << "&"; // placeholder for invisible cell
1407 }
1408
1409 if (!c.isLast()) m_t << "&";
1410}
1411
1413{
1414 if (m_hide) return;
1415 visitChildren(i);
1416}
1417
1419{
1420 if (m_hide) return;
1421 if (Config_getBool(PDF_HYPERLINKS))
1422 {
1423 m_t << "\\href{";
1424 m_t << latexFilterURL(href.url());
1425 m_t << "}";
1426 }
1427 m_t << "{\\texttt{";
1428 visitChildren(href);
1429 m_t << "}}";
1430}
1431
1433{
1434 if (m_hide) return;
1435 m_t << "{\\bfseries{";
1436 visitChildren(d);
1437 m_t << "}}";
1438}
1439
1441{
1442 if (m_hide) return;
1443 m_t << "\n\n";
1444 auto summary = d.summary();
1445 if (summary)
1446 {
1447 std::visit(*this,*summary);
1448 m_t << "\\begin{adjustwidth}{1em}{0em}\n";
1449 }
1450 visitChildren(d);
1451 if (summary)
1452 {
1453 m_t << "\\end{adjustwidth}\n";
1454 }
1455 else
1456 {
1457 m_t << "\n\n";
1458 }
1459}
1460
1462{
1463 if (m_hide) return;
1464 m_t << "\\" << getSectionName(header.level()) << "*{";
1465 visitChildren(header);
1466 m_t << "}";
1467}
1468
1470{
1471 if (img.type()==DocImage::Latex)
1472 {
1473 if (m_hide) return;
1474 DString gfxName = img.name();
1475 if (gfxName.endsWith(".eps") || gfxName.endsWith(".pdf"))
1476 {
1477 gfxName=gfxName.left(gfxName.length()-4);
1478 }
1479
1480 visitPreStart(m_t,img.hasCaption(), gfxName, img.width(), img.height(), img.isInlineImage());
1481 visitChildren(img);
1483 }
1484 else // other format -> skip
1485 {
1486 }
1487}
1488
1490{
1491 if (m_hide) return;
1492 bool exists = false;
1493 std::string inBuf;
1494 if (readInputFile(df.file(),inBuf))
1495 {
1496 auto fileName = writeInlineGraph(Config_getString(LATEX_OUTPUT)+"/"+stripPath(df.file())+"_", // baseName
1497 ".dot", // extension
1498 inBuf, // contents
1499 exists);
1500 if (!fileName.empty())
1501 {
1502 startDotFile(fileName,df.width(),df.height(),df.hasCaption(),df.srcFile(),df.srcLine(),!exists);
1503 visitChildren(df);
1504 endDotFile(df.hasCaption());
1505 }
1506 }
1507}
1508
1510{
1511 if (m_hide) return;
1512 bool exists = false;
1513 std::string inBuf;
1514 if (readInputFile(df.file(),inBuf))
1515 {
1516 auto fileName = writeInlineGraph(Config_getString(LATEX_OUTPUT)+"/"+stripPath(df.file())+"_", // baseName
1517 ".msc", // extension
1518 inBuf, // contents
1519 exists);
1520 if (!fileName.empty())
1521 {
1522 startMscFile(fileName,df.width(),df.height(),df.hasCaption(),df.srcFile(),df.srcLine(),!exists);
1523 visitChildren(df);
1524 endMscFile(df.hasCaption());
1525 }
1526 }
1527}
1528
1530{
1531 if (m_hide) return;
1532 bool exists = false;
1533 std::string inBuf;
1534 if (readInputFile(df.file(),inBuf))
1535 {
1536 auto fileName = writeInlineGraph(Config_getString(LATEX_OUTPUT)+"/"+stripPath(df.file())+"_", // baseName
1537 ".dia", // extension
1538 inBuf, // contents
1539 exists);
1540 if (!fileName.empty())
1541 {
1542 startDiaFile(fileName,df.width(),df.height(),df.hasCaption(),df.srcFile(),df.srcLine(),!exists);
1543 visitChildren(df);
1544 endDiaFile(df.hasCaption());
1545 }
1546 }
1547}
1548
1550{
1551 if (m_hide) return;
1552 if (!Config_getBool(DOT_CLEANUP)) copyFile(df.file(),Config_getString(LATEX_OUTPUT)+"/"+stripPath(df.file()));
1553 startPlantUmlFile(df.file(),df.width(),df.height(),df.hasCaption(),df.srcFile(),df.srcLine());
1554 visitChildren(df);
1556}
1557
1559{
1560 if (m_hide) return;
1561 if (Config_getBool(MERMAID_RENDER_MODE)==MERMAID_RENDER_MODE_t::CLIENT_SIDE) return;
1562 if (!Config_getBool(DOT_CLEANUP)) copyFile(df.file(),Config_getString(LATEX_OUTPUT)+"/"+stripPath(df.file()));
1563 startMermaidFile(df.file(),df.width(),df.height(),df.hasCaption(),df.srcFile(),df.srcLine());
1564 visitChildren(df);
1566}
1567
1569{
1570 if (m_hide) return;
1571 startLink(lnk.ref(),lnk.file(),lnk.anchor());
1572 visitChildren(lnk);
1573 endLink(lnk.ref(),lnk.file(),lnk.anchor());
1574}
1575
1577{
1578 if (m_hide) return;
1579 // when ref.isSubPage()==true we use ref.file() for HTML and
1580 // ref.anchor() for LaTeX/RTF
1581 if (ref.isSubPage())
1582 {
1583 startLink(ref.ref(),DString(),ref.anchor());
1584 }
1585 else
1586 {
1587 if (!ref.file().empty()) startLink(ref.ref(),ref.file(),ref.anchor(),ref.refToTable(),ref.refToSection());
1588 }
1589 if (!ref.hasLinkText())
1590 {
1591 filter(ref.targetTitle());
1592 }
1593 visitChildren(ref);
1594 if (ref.isSubPage())
1595 {
1596 endLink(ref.ref(),DString(),ref.anchor());
1597 }
1598 else
1599 {
1600 if (!ref.file().empty()) endLink(ref.ref(),ref.file(),ref.anchor(),ref.refToTable(),ref.refToSection(),ref.sectionType());
1601 }
1602}
1603
1605{
1606 if (m_hide) return;
1607 m_t << "\\item \\contentsline{section}{";
1608 if (ref.isSubPage())
1609 {
1610 startLink(ref.ref(),DString(),ref.anchor());
1611 }
1612 else
1613 {
1614 if (!ref.file().empty())
1615 {
1616 startLink(ref.ref(),ref.file(),ref.anchor(),ref.refToTable());
1617 }
1618 }
1619 visitChildren(ref);
1620 if (ref.isSubPage())
1621 {
1622 endLink(ref.ref(),DString(),ref.anchor());
1623 }
1624 else
1625 {
1626 if (!ref.file().empty()) endLink(ref.ref(),ref.file(),ref.anchor(),ref.refToTable());
1627 }
1628 m_t << "}{\\ref{";
1629 if (!ref.file().empty()) m_t << stripPath(ref.file());
1630 if (!ref.file().empty() && !ref.anchor().empty()) m_t << "_";
1631 if (!ref.anchor().empty()) m_t << ref.anchor();
1632 m_t << "}}{}\n";
1633}
1634
1636{
1637 if (m_hide) return;
1638 m_t << "\\footnotesize\n";
1639 m_t << "\\begin{multicols}{2}\n";
1640 m_t << "\\begin{DoxyCompactList}\n";
1642 visitChildren(l);
1644 m_t << "\\end{DoxyCompactList}\n";
1645 m_t << "\\end{multicols}\n";
1646 m_t << "\\normalsize\n";
1647}
1648
1650{
1651 if (m_hide) return;
1652 bool hasInOutSpecs = s.hasInOutSpecifier();
1653 bool hasTypeSpecs = s.hasTypeSpecifier();
1655 switch(s.type())
1656 {
1658 m_t << "\n\\begin{DoxyParams}";
1659 if (hasInOutSpecs && hasTypeSpecs) m_t << "[2]"; // 2 extra cols
1660 else if (hasInOutSpecs || hasTypeSpecs) m_t << "[1]"; // 1 extra col
1661 m_t << "{";
1663 break;
1665 m_t << "\n\\begin{DoxyRetVals}{";
1667 break;
1669 m_t << "\n\\begin{DoxyExceptions}{";
1671 break;
1673 m_t << "\n\\begin{DoxyTemplParams}{";
1675 break;
1676 default:
1677 ASSERT(0);
1679 }
1680 m_t << "}\n";
1681 visitChildren(s);
1683 switch(s.type())
1684 {
1686 m_t << "\\end{DoxyParams}\n";
1687 break;
1689 m_t << "\\end{DoxyRetVals}\n";
1690 break;
1692 m_t << "\\end{DoxyExceptions}\n";
1693 break;
1695 m_t << "\\end{DoxyTemplParams}\n";
1696 break;
1697 default:
1698 ASSERT(0);
1700 }
1701}
1702
1704{
1705 m_t << " " << sep.chars() << " ";
1706}
1707
1709{
1710 if (m_hide) return;
1712 const DocParamSect *sect = std::get_if<DocParamSect>(pl.parent());
1713 if (sect)
1714 {
1715 parentType = sect->type();
1716 }
1717 bool useTable = parentType==DocParamSect::Param ||
1718 parentType==DocParamSect::RetVal ||
1719 parentType==DocParamSect::Exception ||
1720 parentType==DocParamSect::TemplateParam;
1721 if (!useTable)
1722 {
1723 m_t << "\\item[";
1724 }
1725 if (sect && sect->hasInOutSpecifier())
1726 {
1728 {
1729 m_t << "\\doxymbox{\\texttt{";
1730 if (pl.direction()==DocParamSect::In)
1731 {
1732 m_t << "in";
1733 }
1734 else if (pl.direction()==DocParamSect::Out)
1735 {
1736 m_t << "out";
1737 }
1738 else if (pl.direction()==DocParamSect::InOut)
1739 {
1740 m_t << "in,out";
1741 }
1742 m_t << "}} ";
1743 }
1744 if (useTable) m_t << " & ";
1745 }
1746 if (sect && sect->hasTypeSpecifier())
1747 {
1748 for (const auto &type : pl.paramTypes())
1749 {
1750 std::visit(*this,type);
1751 }
1752 if (useTable) m_t << " & ";
1753 }
1754 m_t << "{\\em ";
1755 bool first=true;
1756 for (const auto &param : pl.parameters())
1757 {
1758 if (!first) m_t << ","; else first=false;
1759 m_insideItem=true;
1760 std::visit(*this,param);
1761 m_insideItem=false;
1762 }
1763 m_t << "}";
1764 if (useTable)
1765 {
1766 m_t << " & ";
1767 }
1768 else
1769 {
1770 m_t << "]";
1771 }
1772 for (const auto &par : pl.paragraphs())
1773 {
1774 std::visit(*this,par);
1775 }
1776 if (useTable)
1777 {
1778 m_t << "\\\\\n"
1779 << "\\hline\n";
1780 }
1781}
1782
1784{
1785 bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS);
1786 if (m_hide) return;
1787 if (x.title().empty()) return;
1789 m_t << "\\begin{DoxyRefDesc}{";
1790 filter(x.title());
1791 m_t << "}\n";
1792 bool anonymousEnum = x.file()=="@";
1793 m_t << "\\item[";
1794 if (pdfHyperlinks && !anonymousEnum)
1795 {
1796 m_t << "\\doxymbox{\\hyperlink{" << stripPath(x.file()) << "_" << x.anchor() << "}{";
1797 }
1798 else
1799 {
1800 m_t << "\\textbf{ ";
1801 }
1802 m_insideItem=true;
1803 filter(x.title());
1804 m_insideItem=false;
1805 if (pdfHyperlinks && !anonymousEnum)
1806 {
1807 m_t << "}";
1808 }
1809 m_t << "}]";
1810 visitChildren(x);
1811 if (x.title().empty()) return;
1813 m_t << "\\end{DoxyRefDesc}\n";
1814}
1815
1817{
1818 if (m_hide) return;
1819 startLink(DString(),ref.file(),ref.anchor());
1820 visitChildren(ref);
1821 endLink(DString(),ref.file(),ref.anchor());
1822}
1823
1825{
1826 if (m_hide) return;
1827 visitChildren(t);
1828}
1829
1831{
1832 if (m_hide) return;
1833 m_t << "\\begin{quote}\n";
1835 visitChildren(q);
1836 m_t << "\\end{quote}\n";
1838}
1839
1843
1845{
1846 if (m_hide) return;
1847 visitChildren(pb);
1848}
1849
1850void LatexDocVisitor::filter(const DString &str, const bool retainNewLine, const bool /* citeEntry */)
1851{
1852 //printf("LatexDocVisitor::filter(%s) m_insideTabbing=%d m_insideTable=%d\n",qPrint(str),m_lcg.insideTabbing(),m_lcg.usedTableLevel()>0);
1857 m_lcg.usedTableLevel()>0, // insideTable
1858 false, // keepSpaces
1859 retainNewLine
1860 );
1861}
1862
1863void LatexDocVisitor::startLink(const DString &ref,const DString &file,const DString &anchor,
1864 bool refToTable,bool refToSection)
1865{
1866 bool pdfHyperLinks = Config_getBool(PDF_HYPERLINKS);
1867 if (ref.empty() && pdfHyperLinks) // internal PDF link
1868 {
1869 if (refToTable)
1870 {
1871 m_t << "\\doxytablelink{";
1872 }
1873 else if (refToSection)
1874 {
1875 if (m_texOrPdf == TexOrPdf::TEX) m_t << "\\protect";
1876 if (m_texOrPdf != TexOrPdf::PDF) m_t << "\\doxysectlink{";
1877 }
1878 else
1879 {
1880 if (m_texOrPdf == TexOrPdf::TEX) m_t << "\\protect";
1881 if (m_texOrPdf != TexOrPdf::PDF) m_t << "\\doxylink{";
1882 }
1883 if (refToTable || m_texOrPdf != TexOrPdf::PDF)
1884 {
1885 if (!file.empty()) m_t << stripPath(file);
1886 if (!file.empty() && !anchor.empty()) m_t << "_";
1887 if (!anchor.empty()) m_t << anchor;
1888 m_t << "}";
1889 }
1890 m_t << "{";
1891 }
1892 else if (ref.empty() && refToSection)
1893 {
1894 m_t << "\\doxysectref{";
1895 }
1896 else if (ref.empty() && refToTable)
1897 {
1898 m_t << "\\doxytableref{";
1899 }
1900 else if (ref.empty()) // internal non-PDF link
1901 {
1902 m_t << "\\doxyref{";
1903 }
1904 else // external link
1905 {
1906 m_t << "\\textbf{ ";
1907 }
1908}
1909
1910void LatexDocVisitor::endLink(const DString &ref,const DString &file,const DString &anchor,bool /*refToTable*/,bool refToSection, SectionType sectionType)
1911{
1912 m_t << "}";
1913 bool pdfHyperLinks = Config_getBool(PDF_HYPERLINKS);
1914 if (ref.empty() && !pdfHyperLinks)
1915 {
1916 m_t << "{";
1918 m_t << "}{" << file;
1919 if (!file.empty() && !anchor.empty()) m_t << "_";
1920 m_t << anchor << "}";
1921 if (refToSection)
1922 {
1923 m_t << "{" << sectionType.level() << "}";
1924 }
1925 }
1926 if (ref.empty() && pdfHyperLinks) // internal PDF link
1927 {
1928 if (refToSection)
1929 {
1930 if (m_texOrPdf != TexOrPdf::PDF) m_t << "{" << sectionType.level() << "}";
1931 }
1932 }
1933}
1934
1936 const DString &width,
1937 const DString &height,
1938 bool hasCaption,
1939 const DString &srcFile,
1940 int srcLine, bool newFile
1941 )
1942{
1943 DString baseName=makeBaseName(fileName,".dot");
1944 baseName.prepend("dot_");
1945 DString outDir = Config_getString(LATEX_OUTPUT);
1946 if (newFile) writeDotGraphFromFile(fileName,outDir,baseName,GraphOutputFormat::EPS,srcFile,srcLine,false);
1947 visitPreStart(m_t,hasCaption, baseName, width, height);
1948}
1949
1950void LatexDocVisitor::endDotFile(bool hasCaption)
1951{
1952 if (m_hide) return;
1953 visitPostEnd(m_t,hasCaption);
1954}
1955
1957 const DString &width,
1958 const DString &height,
1959 bool hasCaption,
1960 const DString &srcFile,
1961 int srcLine, bool newFile
1962 )
1963{
1964 DString baseName=makeBaseName(fileName,".msc");
1965 baseName.prepend("msc_");
1966
1967 DString outDir = Config_getString(LATEX_OUTPUT);
1968 if (newFile) writeMscGraphFromFile(fileName,outDir,baseName,MscOutputFormat::EPS,srcFile,srcLine,false);
1969 visitPreStart(m_t,hasCaption, baseName, width, height);
1970}
1971
1972void LatexDocVisitor::endMscFile(bool hasCaption)
1973{
1974 if (m_hide) return;
1975 visitPostEnd(m_t,hasCaption);
1976}
1977
1978
1979void LatexDocVisitor::writeMscFile(const DString &fileName, const DocVerbatim &s, bool newFile)
1980{
1981 DString shortName=makeBaseName(fileName,".msc");
1982 DString outDir = Config_getString(LATEX_OUTPUT);
1983 if (newFile) writeMscGraphFromFile(fileName,outDir,shortName,MscOutputFormat::EPS,s.srcFile(),s.srcLine(),false);
1984 visitPreStart(m_t, s.hasCaption(), shortName, s.width(),s.height());
1987}
1988
1990 const DString &width,
1991 const DString &height,
1992 bool hasCaption,
1993 const DString &srcFile,
1994 int srcLine, bool newFile
1995 )
1996{
1997 DString baseName=makeBaseName(fileName,".dia");
1998 baseName.prepend("dia_");
1999
2000 DString outDir = Config_getString(LATEX_OUTPUT);
2001 if (newFile) writeDiaGraphFromFile(fileName,outDir,baseName,DiaOutputFormat::EPS,srcFile,srcLine,false);
2002 visitPreStart(m_t,hasCaption, baseName, width, height);
2003}
2004
2005void LatexDocVisitor::endDiaFile(bool hasCaption)
2006{
2007 if (m_hide) return;
2008 visitPostEnd(m_t,hasCaption);
2009}
2010
2012{
2013 DString shortName = stripPath(baseName);
2014 if (s.useBitmap())
2015 {
2016 if (shortName.find('.')==DString::npos) shortName += ".png";
2017 }
2018 DString outDir = Config_getString(LATEX_OUTPUT);
2021 visitPreStart(m_t, s.hasCaption(), shortName, s.width(), s.height());
2024}
2025
2027 const DString &width,
2028 const DString &height,
2029 bool hasCaption,
2030 const DString &srcFile,
2031 int srcLine
2032 )
2033{
2034 DString outDir = Config_getString(LATEX_OUTPUT);
2035 std::string inBuf;
2036 readInputFile(fileName,inBuf);
2037
2038 bool useBitmap = inBuf.find("@startditaa") != std::string::npos;
2039 auto baseNameVector = PlantumlManager::instance().writePlantUMLSource(
2040 outDir,DString(),inBuf,
2042 DString(),srcFile,srcLine,false);
2043 bool first = true;
2044 for (const auto &bName: baseNameVector)
2045 {
2046 DString baseName = makeBaseName(bName,".pu");
2047 DString shortName = stripPath(baseName);
2048 if (useBitmap)
2049 {
2050 if (shortName.find('.')==DString::npos) shortName += ".png";
2051 }
2054 if (!first) endPlantUmlFile(hasCaption);
2055 first = false;
2056 visitPreStart(m_t,hasCaption, shortName, width, height);
2057 }
2058}
2059
2061{
2062 if (m_hide) return;
2063 visitPostEnd(m_t,hasCaption);
2064}
2065
2067{
2068 if (Config_getBool(MERMAID_RENDER_MODE)==MERMAID_RENDER_MODE_t::CLIENT_SIDE) return;
2069 auto shortName = stripPath(baseName);
2070 auto outDir = Config_getString(LATEX_OUTPUT);
2071 auto outputFormat = MermaidManager::OutputFormat::LaTeX;
2072 auto imageFormat = MermaidManager::convertToImageFormat(outputFormat);
2073 auto imgExt = MermaidManager::imageExtension(imageFormat);
2074 if (shortName.find('.')==DString::npos) shortName += "." + imgExt;
2075 MermaidManager::instance().generateMermaidOutput(baseName,outDir,imageFormat,false);
2076 visitPreStart(m_t, s.hasCaption(), shortName, s.width(), s.height());
2079}
2080
2082 const DString &width,
2083 const DString &height,
2084 bool hasCaption,
2085 const DString &srcFile,
2086 int srcLine
2087 )
2088{
2089 if (Config_getBool(MERMAID_RENDER_MODE)==MERMAID_RENDER_MODE_t::CLIENT_SIDE) return;
2090 DString outDir = Config_getString(LATEX_OUTPUT);
2091 std::string inBuf;
2092 readInputFile(fileName,inBuf);
2093 auto outputFormat = MermaidManager::OutputFormat::LaTeX;
2094 auto imageFormat = MermaidManager::convertToImageFormat(outputFormat);
2095 auto imgExt = MermaidManager::imageExtension(imageFormat);
2097 outDir,DString(),inBuf,imageFormat,
2098 srcFile,srcLine);
2099 auto shortName = stripPath(baseName);
2100 if (shortName.find('.')==DString::npos) shortName += "." + imgExt;
2101 MermaidManager::instance().generateMermaidOutput(baseName,outDir,imageFormat,false);
2102 visitPreStart(m_t,hasCaption, shortName, width, height);
2103}
2104
2106{
2107 if (m_hide) return;
2108 visitPostEnd(m_t,hasCaption);
2109}
2110
2112{
2113 return std::min(m_indentLevel,maxIndentLevels-1);
2114}
2115
2117{
2118 m_indentLevel++;
2120 {
2121 err("Maximum indent level ({}) exceeded while generating LaTeX output!\n",maxIndentLevels-1);
2122 }
2123}
2124
2126{
2127 if (m_indentLevel>0)
2128 {
2129 m_indentLevel--;
2130 }
2131}
2132
static CitationManager & instance()
Definition cite.cpp:87
DString anchorPrefix() const
Definition cite.cpp:128
static CodeFragmentManager & instance()
void parseCodeFragment(OutputCodeList &codeOutList, const DString &fileName, const DString &blockId, const DString &scopeName, bool showLineNumbers, bool trimLeft, bool stripCodeComments)
virtual void parseCode(OutputCodeList &codeOutList, const DString &scopeName, const DString &input, SrcLangExt lang, bool stripCodeComments, const CodeParserOptions &options)=0
Parses a source file or fragment with the goal to produce highlighted and cross-referenced output.
A String class for use with Doxygen wrapping std::string and adding some additional functionality off...
Definition dstring.h:88
DString mid(size_t index, size_t len=npos) const
Definition dstring.h:322
bool empty() const
Returns true iff the string is empty (std::string compatible alias for isEmpty()).
Definition dstring.h:152
static DString integerToRoman(int n, bool upper=true)
Definition dstring.cpp:634
static constexpr size_t npos
value used to indicate 'not found' or 'to the end of the string', matching std::string::npos
Definition dstring.h:182
DString & prepend(const char *s)
Definition dstring.h:519
size_t find(char c, size_t pos=0) const
Definition dstring.h:243
int toInt(bool *ok=nullptr, int base=10) const
Definition dstring.cpp:187
DString left(size_t len) const
Definition dstring.h:310
const std::string & str() const
Definition dstring.h:649
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string.
Definition dstring.h:161
bool endsWith(const char *s) const
Definition dstring.h:621
size_t length() const
Returns the length of the string, not counting the 0-terminator.
Definition dstring.h:155
Node representing an anchor.
Definition docnode.h:229
DString anchor() const
Definition docnode.h:232
DString file() const
Definition docnode.h:233
Node representing an auto List.
Definition docnode.h:571
bool isEnumList() const
Definition docnode.h:580
Node representing an item of a auto list.
Definition docnode.h:595
int itemNumber() const
Definition docnode.h:598
Node representing a citation of some bibliographic reference.
Definition docnode.h:245
DString getText() const
Definition docnode.cpp:977
DString anchor() const
Definition docnode.h:251
CiteInfoOption option() const
Definition docnode.h:253
DString target() const
Definition docnode.h:252
DString file() const
Definition docnode.h:248
Node representing a dia file.
Definition docnode.h:731
DString file() const
Definition docnode.h:685
DString srcFile() const
Definition docnode.h:691
DString width() const
Definition docnode.h:688
int srcLine() const
Definition docnode.h:692
bool hasCaption() const
Definition docnode.h:687
DString height() const
Definition docnode.h:689
Node representing a dot file.
Definition docnode.h:713
Node representing an emoji.
Definition docnode.h:341
int index() const
Definition docnode.h:345
DString name() const
Definition docnode.h:344
Node representing an item of a cross-referenced list.
Definition docnode.h:529
DString text() const
Definition docnode.h:533
Node representing a Hypertext reference.
Definition docnode.h:832
DString url() const
Definition docnode.h:839
Node representing a horizontal ruler.
Definition docnode.h:216
Node representing an HTML blockquote.
Definition docnode.h:1296
Node representing a HTML table caption.
Definition docnode.h:1233
DString file() const
Definition docnode.h:1239
DString anchor() const
Definition docnode.h:1240
Node representing a HTML table cell.
Definition docnode.h:1198
Valignment valignment() const
Definition docnode.cpp:1983
uint32_t rowSpan() const
Definition docnode.cpp:1921
Alignment alignment() const
Definition docnode.cpp:1945
bool isLast() const
Definition docnode.h:1207
bool isHeading() const
Definition docnode.h:1205
uint32_t colSpan() const
Definition docnode.cpp:1933
Node representing a HTML description data.
Definition docnode.h:1186
Node representing a Html description list.
Definition docnode.h:910
const HtmlAttribList & attribs() const
Definition docnode.h:914
Node representing a Html description item.
Definition docnode.h:897
Node Html details.
Definition docnode.h:866
const DocNodeVariant * summary() const
Definition docnode.h:873
Node Html heading.
Definition docnode.h:882
int level() const
Definition docnode.h:886
Node representing a Html list.
Definition docnode.h:1009
const HtmlAttribList & attribs() const
Definition docnode.h:1015
Type type() const
Definition docnode.h:1014
Node representing a HTML list item.
Definition docnode.h:1170
const HtmlAttribList & attribs() const
Definition docnode.h:1175
Node representing a HTML table row.
Definition docnode.h:1251
Node Html summary.
Definition docnode.h:853
Node representing a HTML table.
Definition docnode.h:1274
size_t numberHeaderRows() const
Definition docnode.cpp:2258
size_t numColumns() const
Definition docnode.h:1283
const DocNodeVariant * caption() const
Definition docnode.cpp:2253
Node representing an image.
Definition docnode.h:642
Type type() const
Definition docnode.h:647
DString width() const
Definition docnode.h:650
DString name() const
Definition docnode.h:648
bool isInlineImage() const
Definition docnode.h:654
bool hasCaption() const
Definition docnode.h:649
DString height() const
Definition docnode.h:651
Node representing a include/dontinclude operator block.
Definition docnode.h:477
bool stripCodeComments() const
Definition docnode.h:506
bool isLast() const
Definition docnode.h:503
DString text() const
Definition docnode.h:499
DString context() const
Definition docnode.h:501
DString exampleFile() const
Definition docnode.h:508
DString includeFileName() const
Definition docnode.h:509
int line() const
Definition docnode.h:497
Type type() const
Definition docnode.h:485
bool isFirst() const
Definition docnode.h:502
bool showLineNo() const
Definition docnode.h:498
bool isExample() const
Definition docnode.h:507
Node representing an included text block from file.
Definition docnode.h:435
bool stripCodeComments() const
Definition docnode.h:455
DString blockId() const
Definition docnode.h:454
@ LatexInclude
Definition docnode.h:437
@ SnippetWithLines
Definition docnode.h:438
@ DontIncWithLines
Definition docnode.h:439
@ IncWithLines
Definition docnode.h:438
@ HtmlInclude
Definition docnode.h:437
@ VerbInclude
Definition docnode.h:437
@ DontInclude
Definition docnode.h:437
@ DocbookInclude
Definition docnode.h:439
DString context() const
Definition docnode.h:453
Type type() const
Definition docnode.h:451
DString exampleFile() const
Definition docnode.h:457
DString text() const
Definition docnode.h:452
DString file() const
Definition docnode.h:449
DString extension() const
Definition docnode.h:450
bool trimLeft() const
Definition docnode.h:459
bool isExample() const
Definition docnode.h:456
Node representing an entry in the index.
Definition docnode.h:552
DString entry() const
Definition docnode.h:559
Node representing an internal section of documentation.
Definition docnode.h:978
Node representing an internal reference to some item.
Definition docnode.h:816
DString anchor() const
Definition docnode.h:822
DString file() const
Definition docnode.h:820
Node representing a line break.
Definition docnode.h:202
Node representing a word that can be linked to something.
Definition docnode.h:165
DString word() const
Definition docnode.h:170
DString anchor() const
Definition docnode.h:174
DString ref() const
Definition docnode.h:173
DString file() const
Definition docnode.h:171
Node representing a mermaid file.
Definition docnode.h:749
Node representing a msc file.
Definition docnode.h:722
DocNodeVariant * parent()
Definition docnode.h:89
Node representing an block of paragraphs.
Definition docnode.h:988
Node representing a paragraph in the documentation tree.
Definition docnode.h:1089
bool isLast() const
Definition docnode.h:1097
Node representing a parameter list.
Definition docnode.h:1130
const DocNodeList & parameters() const
Definition docnode.h:1134
const DocNodeList & paramTypes() const
Definition docnode.h:1135
DocParamSect::Direction direction() const
Definition docnode.h:1138
const DocNodeList & paragraphs() const
Definition docnode.h:1136
Node representing a parameter section.
Definition docnode.h:1062
bool hasInOutSpecifier() const
Definition docnode.h:1078
bool hasTypeSpecifier() const
Definition docnode.h:1079
Type type() const
Definition docnode.h:1077
Node representing a uml file.
Definition docnode.h:740
Node representing a reference to some item.
Definition docnode.h:787
DString ref() const
Definition docnode.h:793
SectionType sectionType() const
Definition docnode.h:796
DString file() const
Definition docnode.h:791
bool isSubPage() const
Definition docnode.h:801
bool refToTable() const
Definition docnode.h:800
DString anchor() const
Definition docnode.h:794
bool refToSection() const
Definition docnode.h:799
bool hasLinkText() const
Definition docnode.h:797
DString targetTitle() const
Definition docnode.h:795
Root node of documentation tree.
Definition docnode.h:1318
Node representing a reference to a section.
Definition docnode.h:944
bool refToTable() const
Definition docnode.h:952
DString anchor() const
Definition docnode.h:949
DString ref() const
Definition docnode.h:951
DString file() const
Definition docnode.h:948
bool isSubPage() const
Definition docnode.h:953
Node representing a list of section references.
Definition docnode.h:968
Node representing a normal section.
Definition docnode.h:923
DString file() const
Definition docnode.h:931
int level() const
Definition docnode.h:927
DString anchor() const
Definition docnode.h:929
const DocNodeVariant * title() const
Definition docnode.h:928
Node representing a separator.
Definition docnode.h:365
DString chars() const
Definition docnode.h:369
Node representing a simple list.
Definition docnode.h:999
Node representing a simple list item.
Definition docnode.h:1158
const DocNodeVariant * paragraph() const
Definition docnode.h:1162
Node representing a simple section.
Definition docnode.h:1026
Type type() const
Definition docnode.h:1035
const DocNodeVariant * title() const
Definition docnode.h:1042
Node representing a separator between two simple sections of the same type.
Definition docnode.h:1053
Node representing a style change.
Definition docnode.h:268
Style style() const
Definition docnode.h:307
bool enable() const
Definition docnode.h:309
Node representing a special symbol.
Definition docnode.h:328
HtmlEntityMapper::SymType symbol() const
Definition docnode.h:332
Root node of a text fragment.
Definition docnode.h:1309
Node representing a simple section title.
Definition docnode.h:608
Node representing a URL (or email address).
Definition docnode.h:188
DString url() const
Definition docnode.h:192
bool isEmail() const
Definition docnode.h:193
Node representing a verbatim, unparsed text fragment.
Definition docnode.h:376
DString text() const
Definition docnode.h:383
int srcLine() const
Definition docnode.h:398
bool hasCaption() const
Definition docnode.h:390
DString height() const
Definition docnode.h:392
const DocNodeList & children() const
Definition docnode.h:395
DString language() const
Definition docnode.h:388
bool isExample() const
Definition docnode.h:385
Type type() const
Definition docnode.h:382
DString exampleFile() const
Definition docnode.h:386
bool useBitmap() const
Definition docnode.h:394
DString width() const
Definition docnode.h:391
DString srcFile() const
Definition docnode.h:397
DString context() const
Definition docnode.h:384
DString engine() const
Definition docnode.h:393
@ JavaDocLiteral
Definition docnode.h:378
Node representing a VHDL flow chart.
Definition docnode.h:758
void pushHidden(bool hide)
CodeParserInterface & getCodeParser(const DString &langExt)
bool popHidden()
Node representing some amount of white space.
Definition docnode.h:354
DString chars() const
Definition docnode.h:358
Node representing a word.
Definition docnode.h:153
DString word() const
Definition docnode.h:156
Node representing an item of a cross-referenced list.
Definition docnode.h:621
DString anchor() const
Definition docnode.h:625
DString file() const
Definition docnode.h:624
DString title() const
Definition docnode.h:626
const char * name(int index) const
Access routine to the name of the Emoji entity.
Definition emoji.cpp:2026
static EmojiEntityMapper & instance()
Returns the one and only instance of the Emoji entity mapper.
Definition emoji.cpp:1978
Minimal replacement for QFileInfo.
Definition fileinfo.h:26
std::string fileName() const
Definition fileinfo.cpp:118
std::string dirPath(bool absPath=true) const
Definition fileinfo.cpp:137
Class representing a list of HTML attributes.
Definition htmlattrib.h:31
const char * latex(SymType symb) const
Access routine to the LaTeX code of the HTML entity.
static HtmlEntityMapper & instance()
Returns the one and only instance of the HTML entity mapper.
Generator for LaTeX code fragments.
Definition latexgen.h:27
int usedTableLevel() const
Definition latexgen.h:65
bool insideTabbing() const
Definition latexgen.h:70
void decUsedTableLevel()
Definition latexgen.h:64
void incUsedTableLevel()
Definition latexgen.h:63
void startPlantUmlFile(const DString &fileName, const DString &width, const DString &height, bool hasCaption, const DString &srcFile, int srcLine)
RowSpanList & rowSpans()
void startMscFile(const DString &fileName, const DString &width, const DString &height, bool hasCaption, const DString &srcFile, int srcLine, bool newFile=true)
void writePlantUMLFile(const DString &fileName, const DocVerbatim &s)
void setCurrentColumn(size_t col)
static const int maxIndentLevels
void endDotFile(bool hasCaption)
void operator()(const DocWord &)
void startLink(const DString &ref, const DString &file, const DString &anchor, bool refToTable=false, bool refToSection=false)
void visitCaption(const DocNodeList &children)
void startDotFile(const DString &fileName, const DString &width, const DString &height, bool hasCaption, const DString &srcFile, int srcLine, bool newFile=true)
void addRowSpan(ActiveRowSpan &&span)
void setNumCols(size_t num)
void writeStartTableCommand(const DocNodeVariant *n, size_t cols)
void writeEndTableCommand(const DocNodeVariant *n)
OutputCodeList & m_ci
size_t currentColumn() const
LatexDocVisitor(TextStream &t, OutputCodeList &ci, LatexCodeGenerator &lcg, const DString &langExt, int hierarchyLevel=0)
void startMermaidFile(const DString &fileName, const DString &width, const DString &height, bool hasCaption, const DString &srcFile, int srcLine)
void endMscFile(bool hasCaption)
bool isTableNested(const DocNodeVariant *n) const
LatexListItemInfo m_listItemInfo[maxIndentLevels]
void writeMscFile(const DString &fileName, const DocVerbatim &s, bool newFile=true)
bool insideTable() const
void endDiaFile(bool hasCaption)
void endMermaidFile(bool hasCaption)
const char * getSectionName(int level) const
void writeMermaidFile(const DString &baseName, const DocVerbatim &s)
void startDiaFile(const DString &fileName, const DString &width, const DString &height, bool hasCaption, const DString &srcFile, int srcLine, bool newFile=true)
void filter(const DString &str, const bool retainNewLine=false, const bool citeEntry=false)
void endLink(const DString &ref, const DString &file, const DString &anchor, bool refToTable=false, bool refToSection=false, SectionType sectionType=SectionType::Anchor)
void endPlantUmlFile(bool hasCaption)
void visitChildren(const T &t)
LatexCodeGenerator & m_lcg
static MermaidManager & instance()
Definition mermaid.cpp:35
static DString imageExtension(ImageFormat imageFormat)
Definition mermaid.cpp:45
static ImageFormat convertToImageFormat(OutputFormat outputFormat)
Definition mermaid.cpp:56
void generateMermaidOutput(const DString &baseName, const DString &outDir, ImageFormat format, bool toIndex)
Register a generated Mermaid image with the index.
Definition mermaid.cpp:118
DString writeMermaidSource(const DString &outDirArg, const DString &fileName, const DString &content, ImageFormat format, const DString &srcFile, int srcLine)
Write a Mermaid source file and register it for CLI rendering.
Definition mermaid.cpp:72
Class representing a list of different code generators.
Definition outputlist.h:162
void startCodeFragment(const DString &style)
Definition outputlist.h:276
void endCodeFragment(const DString &style)
Definition outputlist.h:279
void generatePlantUMLOutput(const DString &baseName, const DString &outDir, OutputFormat format, bool toIndex)
Convert a PlantUML file to an image.
Definition plantuml.cpp:201
StringVector writePlantUMLSource(const DString &outDirArg, const DString &fileName, const DString &content, OutputFormat format, const DString &engine, const DString &srcFile, int srcLine, bool inlineCode)
Write a PlantUML compatible file.
Definition plantuml.cpp:31
static PlantumlManager & instance()
Definition plantuml.cpp:230
constexpr int level() const
Definition section.h:46
Text streaming class that buffers data.
Definition textstream.h:36
virtual DString trExceptions()=0
virtual DString trReturns()=0
virtual DString trParameters()=0
virtual DString trCopyright()=0
virtual DString trWarning()=0
virtual DString trSince()=0
virtual DString trNote()=0
virtual DString trAuthor(bool first_capital, bool singular)=0
virtual DString trReturnValues()=0
virtual DString trVersion()=0
virtual DString trTemplateParameters()=0
virtual DString trImportant()=0
virtual DString trPrecondition()=0
virtual DString trAttention()=0
virtual DString trPageAbbreviation()=0
virtual DString trInvariant()=0
virtual DString trRemarks()=0
virtual DString trDate()=0
virtual DString trSeeAlso()=0
virtual DString trPostcondition()=0
Class representing a regular expression.
Definition regex.h:39
Object representing the matching results.
Definition regex.h:154
#define Config_getBool(name)
Definition config.h:33
#define Config_getString(name)
Definition config.h:32
void writeDiaGraphFromFile(const DString &inFile, const DString &outDir, const DString &outFile, DiaOutputFormat format, const DString &srcFile, int srcLine, bool toIndex)
Definition dia.cpp:28
constexpr bool holds_one_of_alternatives(const DocNodeVariant &v)
returns true iff v holds one of types passed as template parameters
Definition docnode.h:1371
std::variant< DocWord, DocLinkedWord, DocURL, DocLineBreak, DocHorRuler, DocAnchor, DocCite, DocStyleChange, DocSymbol, DocEmoji, DocWhiteSpace, DocSeparator, DocVerbatim, DocInclude, DocIncOperator, DocFormula, DocIndexEntry, DocAutoList, DocAutoListItem, DocTitle, DocXRefItem, DocImage, DocDotFile, DocMscFile, DocDiaFile, DocVhdlFlow, DocLink, DocRef, DocInternalRef, DocHRef, DocHtmlHeader, DocHtmlDescTitle, DocHtmlDescList, DocSection, DocSecRefItem, DocSecRefList, DocInternal, DocParBlock, DocSimpleList, DocHtmlList, DocSimpleSect, DocSimpleSectSep, DocParamSect, DocPara, DocParamList, DocSimpleListItem, DocHtmlListItem, DocHtmlDescData, DocHtmlCell, DocHtmlCaption, DocHtmlRow, DocHtmlTable, DocHtmlBlockQuote, DocText, DocRoot, DocHtmlDetails, DocHtmlSummary, DocPlantUmlFile, DocMermaidFile > DocNodeVariant
Definition docnode.h:66
constexpr DocNodeVariant * parent(DocNodeVariant *n)
returns the parent node of a given node n or nullptr if the node has no parent.
Definition docnode.h:1335
void writeDotGraphFromFile(const DString &inFile, const DString &outDir, const DString &outFile, GraphOutputFormat format, const DString &srcFile, int srcLine, bool toIndex)
Definition dot.cpp:197
#define ASSERT(x)
Definition dstring.h:28
std::unique_ptr< FileDef > createFileDef(const DString &p, const DString &n, const DString &ref, const DString &dn)
Definition filedef.cpp:270
Translator * theTranslator
Definition language.cpp:71
static const char * g_subparagraphLabel
static const int g_maxLevels
static void visitPreStart(TextStream &t, bool hasCaption, DString name, DString width, DString height, bool inlineImage=false)
static void insertDimension(TextStream &t, DString dimension, const char *orientationString)
static const std::array< const char *, g_maxLevels > g_secLabels
static bool listIsNested(const DocHtmlDescList &dl)
static const char * g_paragraphLabel
static bool classEqualsReflist(const DocHtmlDescList &dl)
static void visitPostEnd(TextStream &t, bool hasCaption, bool inlineImage=false)
@ TEX
called through texorpdf as TeX (first) part
@ PDF
called through texorpdf as PDF (second) part
@ NO
not called through texorpdf
DString latexFilterURL(const DString &s)
void filterLatexString(TextStream &t, const DString &str, bool insideTabbing, bool insidePre, bool insideItem, bool insideTable, bool keepSpaces, const bool retainNewline)
void latexWriteIndexItem(TextStream &m_t, const DString &s1, const DString &s2)
#define err(fmt,...)
Definition message.h:127
void writeMscGraphFromFile(const DString &inFile, const DString &outDir, const DString &outFile, MscOutputFormat format, const DString &srcFile, int srcLine, bool toIndex)
Definition msc.cpp:157
bool search(std::string_view str, Match &match, const Ex &re, size_t pos)
Search in a given string str starting at position pos for a match against regular expression re.
Definition regex.cpp:847
Portable versions of functions that are platform dependent.
Options to configure the code parser.
Definition parserintf.h:77
CodeParserOptions & setStartLine(int lineNr)
Definition parserintf.h:100
CodeParserOptions & setInlineFragment(bool enable)
Definition parserintf.h:106
CodeParserOptions & setShowLineNumbers(bool enable)
Definition parserintf.h:112
CodeParserOptions & setFileDef(const FileDef *fd)
Definition parserintf.h:97
SrcLangExt
Definition types.h:207
DString writeInlineGraph(const DString &baseName, const DString &extension, const DString &content, bool &exists)
Definition util.cpp:5360
DString getFileNameExtension(const DString &fn)
Definition util.cpp:4212
bool readInputFile(const DString &fileName, std::string &contents, bool filter, bool isSourceCode)
read a file name fileName and optionally filter and transcode it
Definition util.cpp:4376
SrcLangExt getLanguageFromFileName(const DString &fileName, SrcLangExt defLang)
Definition util.cpp:4170
bool copyFile(const DString &src, const DString &dest)
Copies the contents of file with name src to the newly created file with name dest.
Definition util.cpp:4621
DString makeBaseName(const DString &name, const DString &ext)
Definition util.cpp:3976
DString stripPath(const DString &s)
Definition util.cpp:3962
SrcLangExt getLanguageFromCodeLang(DString &fileName)
Routine to handle the language attribute of the \code command.
Definition util.cpp:4188
A bunch of utility functions.