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// own header
17#include "latexdocvisitor.h"
18
19// standard includes
20#include <algorithm>
21#include <array>
22
23// other includes
24#include "cite.h"
25#include "codefragment.h"
26#include "config.h"
27#include "dia.h"
28#include "docparser.h"
29#include "dot.h"
30#include "doxygen.h"
31#include "emoji.h"
32#include "filedef.h"
33#include "fileinfo.h"
34#include "htmlattrib.h"
35#include "htmlentity.h"
36#include "language.h"
37#include "latexgen.h"
38#include "mermaid.h"
39#include "message.h"
40#include "msc.h"
41#include "outputlist.h"
42#include "parserintf.h"
43#include "plantuml.h"
44#include "portable.h"
45#include "regex.h"
46#include "util.h"
47
48static const int g_maxLevels = 7;
49static const std::array<const char *,g_maxLevels> g_secLabels =
50{ "doxysection",
51 "doxysubsection",
52 "doxysubsubsection",
53 "doxysubsubsubsection",
54 "doxysubsubsubsubsection",
55 "doxysubsubsubsubsubsection",
56 "doxysubsubsubsubsubsubsection"
57};
58
59static const char *g_paragraphLabel = "doxyparagraph";
60static const char *g_subparagraphLabel = "doxysubparagraph";
61
62const char *LatexDocVisitor::getSectionName(int level) const
63{
64 bool compactLatex = Config_getBool(COMPACT_LATEX);
65 int l = level;
66 if (compactLatex) l++;
67
68 if (l < g_maxLevels)
69 {
70 l += m_hierarchyLevel; /* May be -1 if generating main page */
71 // Sections get special treatment because they inherit the parent's level
72 if (l >= g_maxLevels)
73 {
74 l = g_maxLevels - 1;
75 }
76 else if (l < 0)
77 {
78 /* Should not happen; level is always >= 1 and hierarchyLevel >= -1 */
79 l = 0;
80 }
81 return g_secLabels[l];
82 }
83 else if (l == 7)
84 {
85 return g_paragraphLabel;
86 }
87 else
88 {
90 }
91}
92
93static void insertDimension(TextStream &t, DString dimension, const char *orientationString)
94{
95 // dimensions for latex images can be a percentage, in this case they need some extra
96 // handling as the % symbol is used for comments
97 static const reg::Ex re(R"((\d+)%)");
98 std::string s = dimension.str();
99 reg::Match match;
100 if (reg::search(s,match,re))
101 {
102 bool ok = false;
103 double percent = DString(match[1].str()).toInt(&ok);
104 if (ok)
105 {
106 t << percent/100.0 << "\\text" << orientationString;
107 return;
108 }
109 }
110 t << dimension;
111}
112
113static void visitPreStart(TextStream &t, bool hasCaption, DString name, DString width, DString height, bool inlineImage = false)
114{
115 if (inlineImage)
116 {
117 t << "\n\\begin{DoxyInlineImage}%\n";
118 }
119 else
120 {
121 if (hasCaption)
122 {
123 t << "\n\\begin{DoxyImage}%\n";
124 }
125 else
126 {
127 t << "\n\\begin{DoxyImageNoCaption}%\n"
128 " \\doxymbox{";
129 }
130 }
131
132 t << "\\includegraphics";
133 if (!width.empty() || !height.empty())
134 {
135 t << "[";
136 }
137 if (!width.empty())
138 {
139 t << "width=";
140 insertDimension(t, width, "width");
141 }
142 if (!width.empty() && !height.empty())
143 {
144 t << ",";
145 }
146 if (!height.empty())
147 {
148 t << "height=";
149 insertDimension(t, height, "height");
150 }
151 if (width.empty() && height.empty())
152 {
153 /* default setting */
154 if (inlineImage)
155 {
156 t << "[height=\\baselineskip,keepaspectratio=true]";
157 }
158 else
159 {
160 t << "[width=\\textwidth,height=\\textheight/2,keepaspectratio=true]";
161 }
162 }
163 else
164 {
165 t << "]";
166 }
167
168 t << "{" << name << "}";
169
170 if (hasCaption)
171 {
172 if (!inlineImage)
173 {
174 if (Config_getBool(PDF_HYPERLINKS))
175 {
176 t << "%\n\\doxyfigcaption{";
177 }
178 else
179 {
180 t << "%\n\\doxyfigcaptionnolink{";
181 }
182 }
183 else
184 {
185 t << "%"; // to catch the caption
186 }
187 }
188}
189
190
191
192static void visitPostEnd(TextStream &t, bool hasCaption, bool inlineImage = false)
193{
194 if (inlineImage)
195 {
196 t << "%\n\\end{DoxyInlineImage}\n";
197 }
198 else
199 {
200 t << "}%\n"; // end doxymbox or caption
201 if (hasCaption)
202 {
203 t << "\\end{DoxyImage}\n";
204 }
205 else
206 {
207 t << "\\end{DoxyImageNoCaption}\n";
208 }
209 }
210}
211
213{
214 for (const auto &n : children)
215 {
216 std::visit(*this,n);
217 }
218}
219
221 const DString &langExt, int hierarchyLevel)
222 : m_t(t), m_ci(ci), m_lcg(lcg), m_insidePre(false),
223 m_insideItem(false), m_hide(false), m_captionTable(false),
224 m_langExt(langExt), m_hierarchyLevel(hierarchyLevel)
225{
226}
227
228 //--------------------------------------
229 // visitor functions for leaf nodes
230 //--------------------------------------
231
233{
234 if (m_hide) return;
235 filter(w.word());
236}
237
239{
240 if (m_hide) return;
241 startLink(w.ref(),w.file(),w.anchor());
242 filter(w.word());
243 endLink(w.ref(),w.file(),w.anchor());
244}
245
247{
248 if (m_hide) return;
249 if (m_insidePre)
250 {
251 m_t << w.chars();
252 }
253 else
254 {
255 m_t << " ";
256 }
257}
258
260{
261 if (m_hide) return;
262 bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS);
263 const char *res = HtmlEntityMapper::instance().latex(s.symbol());
264 if (res)
265 {
267 {
268 if (pdfHyperlinks)
269 {
270 m_t << "\\texorpdfstring{$<$}{<}";
271 }
272 else
273 {
274 m_t << "$<$";
275 }
276 }
278 {
279 if (pdfHyperlinks)
280 {
281 m_t << "\\texorpdfstring{$>$}{>}";
282 }
283 else
284 {
285 m_t << "$>$";
286 }
287 }
288 else
289 {
290 m_t << res;
291 }
292 }
293 else
294 {
295 err("LaTeX: non supported HTML-entity found: {}\n",HtmlEntityMapper::instance().html(s.symbol(),true));
296 }
297}
298
300{
301 if (m_hide) return;
303 if (!emojiName.empty())
304 {
305 DString imageName=emojiName.mid(1,emojiName.length()-2); // strip : at start and end
306 if (m_texOrPdf != TexOrPdf::PDF) m_t << "\\doxygenemoji{";
307 filter(emojiName);
308 if (m_texOrPdf != TexOrPdf::PDF) m_t << "}{" << imageName << "}";
309 }
310 else
311 {
312 m_t << s.name();
313 }
314}
315
317{
318 if (m_hide) return;
319 if (Config_getBool(PDF_HYPERLINKS))
320 {
321 m_t << "\\href{";
322 if (u.isEmail()) m_t << "mailto:";
323 m_t << latexFilterURL(u.url()) << "}";
324 }
325 m_t << "{\\texttt{";
326 filter(u.url());
327 m_t << "}}";
328}
329
331{
332 if (m_hide) return;
333 if (m_insideItem)
334 {
335 m_t << "\\\\\n";
336 }
337 else if (m_captionTable)
338 {
339 m_t << "\\hspace{\\textwidth minus \\textwidth}\\mbox{}\\\\ ";
340 }
341 else
342 {
343 m_t << "~\\newline\n";
344 }
345}
346
348{
349 if (m_hide) return;
350 if (insideTable())
351 m_t << "\\DoxyHorRuler{1}\n";
352 else
353 m_t << "\\DoxyHorRuler{0}\n";
354}
355
357{
358 if (m_hide) return;
359 switch (s.style())
360 {
362 if (s.enable()) m_t << "{\\bfseries{"; else m_t << "}}";
363 break;
367 if (s.enable()) m_t << "\\sout{"; else m_t << "}";
368 break;
371 if (s.enable()) m_t << "\\uline{"; else m_t << "}";
372 break;
374 if (s.enable()) m_t << "{\\itshape "; else m_t << "}";
375 break;
379 if (s.enable()) m_t << "{\\ttfamily "; else m_t << "}";
380 break;
382 if (s.enable()) m_t << "\\textsubscript{"; else m_t << "}";
383 break;
385 if (s.enable()) m_t << "\\textsuperscript{"; else m_t << "}";
386 break;
388 if (s.enable()) m_t << "\\begin{center}"; else m_t << "\\end{center} ";
389 break;
391 if (s.enable()) m_t << "\n\\footnotesize "; else m_t << "\n\\normalsize ";
392 break;
394 if (s.enable()) m_t << "{\\itshape "; else m_t << "}";
395 break;
397 if (s.enable())
398 {
399 m_t << "\n\\begin{DoxyPre}";
400 m_insidePre=true;
401 }
402 else
403 {
404 m_insidePre=false;
405 m_t << "\\end{DoxyPre}\n";
406 }
407 break;
408 case DocStyleChange::Div: /* HTML only */ break;
409 case DocStyleChange::Span: /* HTML only */ break;
410 }
411}
412
414{
415 if (m_hide) return;
416 DString lang = m_langExt;
417 if (!s.language().empty()) // explicit language setting
418 {
419 lang = s.language();
420 }
421 SrcLangExt langExt = getLanguageFromCodeLang(lang);
422 switch(s.type())
423 {
425 {
426 m_ci.startCodeFragment("DoxyCode");
427 getCodeParser(lang).parseCode(m_ci,s.context(),s.text(),langExt,
428 Config_getBool(STRIP_CODE_COMMENTS),
429 CodeParserOptions().setExample(s.isExample(),s.exampleFile()));
430 m_ci.endCodeFragment("DoxyCode");
431 }
432 break;
434 filter(s.text(), true);
435 break;
437 m_t << "{\\ttfamily ";
438 filter(s.text(), true);
439 m_t << "}";
440 break;
442 if (isTableNested(s.parent())) // in table
443 {
444 m_t << "\\begin{DoxyCode}{0}";
445 filter(s.text(), true);
446 m_t << "\\end{DoxyCode}\n";
447 }
448 else
449 {
450 m_t << "\\begin{DoxyVerb}";
451 m_t << s.text();
452 m_t << "\\end{DoxyVerb}\n";
453 }
454 break;
460 /* nothing */
461 break;
463 m_t << s.text();
464 break;
465 case DocVerbatim::Dot:
466 {
467 bool exists = false;
468 auto fileName = writeInlineGraph(Config_getString(LATEX_OUTPUT)+"/inline_dotgraph_", // baseName
469 ".dot", // extension
470 s.text(), // contents
471 exists);
472 if (!fileName.empty())
473 {
474 startDotFile(fileName,s.width(),s.height(),s.hasCaption(),s.srcFile(),s.srcLine(),!exists);
475 visitChildren(s);
477 }
478 }
479 break;
480 case DocVerbatim::Msc:
481 {
482 bool exists = false;
483 auto fileName = writeInlineGraph(Config_getString(LATEX_OUTPUT)+"/inline_mscgraph_", // baseName
484 ".msc", // extension
485 "msc {"+s.text()+"}", // contents
486 exists);
487 if (!fileName.empty())
488 {
489 writeMscFile(fileName, s, !exists);
490 }
491 }
492 break;
494 {
495 DString latexOutput = Config_getString(LATEX_OUTPUT);
496 auto baseNameVector = PlantumlManager::instance().writePlantUMLSource(
497 latexOutput,s.exampleFile(),s.text(),
499 s.engine(),s.srcFile(),s.srcLine(),true);
500
501 for (const auto &baseName: baseNameVector)
502 {
503 writePlantUMLFile(baseName, s);
504 }
505 }
506 break;
508 if (Config_getBool(MERMAID_RENDER_MODE)!=MERMAID_RENDER_MODE_t::CLIENT_SIDE)
509 {
510 auto latexOutput = Config_getString(LATEX_OUTPUT);
511 auto outputFormat = MermaidManager::OutputFormat::LaTeX;
512 auto imageFormat = MermaidManager::convertToImageFormat(outputFormat);
514 latexOutput,s.exampleFile(),s.text(),imageFormat,
515 s.srcFile(),s.srcLine());
516 writeMermaidFile(baseName, s);
517 }
518 break;
519 }
520}
521
523{
524 if (m_hide) return;
525 m_t << "\\label{" << stripPath(anc.file()) << "_" << anc.anchor() << "}%\n";
526 if (!anc.file().empty() && Config_getBool(PDF_HYPERLINKS))
527 {
528 m_t << "\\Hypertarget{" << stripPath(anc.file()) << "_" << anc.anchor()
529 << "}%\n";
530 }
531}
532
534{
535 if (m_hide) return;
537 switch(inc.type())
538 {
540 {
541 m_ci.startCodeFragment("DoxyCodeInclude");
542 FileInfo cfi( inc.file().str() );
543 auto fd = createFileDef( cfi.dirPath(), cfi.fileName() );
545 inc.text(),
546 langExt,
547 inc.stripCodeComments(),
549 .setExample(inc.isExample(), inc.exampleFile())
550 .setFileDef(fd.get())
551 .setInlineFragment(true)
552 );
553 m_ci.endCodeFragment("DoxyCodeInclude");
554 }
555 break;
557 {
558 m_ci.startCodeFragment("DoxyCodeInclude");
560 inc.text(),langExt,
561 inc.stripCodeComments(),
563 .setExample(inc.isExample(), inc.exampleFile())
564 .setInlineFragment(true)
565 .setShowLineNumbers(false)
566 );
567 m_ci.endCodeFragment("DoxyCodeInclude");
568 }
569 break;
577 break;
579 m_t << inc.text();
580 break;
582 if (isTableNested(inc.parent())) // in table
583 {
584 m_t << "\\begin{DoxyCode}{0}";
585 filter(inc.text(), true);
586 m_t << "\\end{DoxyCode}\n";
587 }
588 else
589 {
590 m_t << "\n\\begin{DoxyVerbInclude}\n";
591 m_t << inc.text();
592 m_t << "\\end{DoxyVerbInclude}\n";
593 }
594 break;
597 {
598 m_ci.startCodeFragment("DoxyCodeInclude");
600 inc.file(),
601 inc.blockId(),
602 inc.context(),
604 inc.trimLeft(),
606 );
607 m_ci.endCodeFragment("DoxyCodeInclude");
608 }
609 break;
610 }
611}
612
614{
615 //printf("DocIncOperator: type=%d first=%d, last=%d text='%s'\n",
616 // op.type(),op.isFirst(),op.isLast(),qPrint(op.text()));
617 if (op.isFirst())
618 {
619 if (!m_hide) m_ci.startCodeFragment("DoxyCodeInclude");
621 m_hide = true;
622 }
624 if (locLangExt.empty()) locLangExt = m_langExt;
625 SrcLangExt langExt = getLanguageFromFileName(locLangExt);
626 if (op.type()!=DocIncOperator::Skip)
627 {
628 m_hide = popHidden();
629 if (!m_hide)
630 {
631 std::unique_ptr<FileDef> fd;
632 if (!op.includeFileName().empty())
633 {
634 FileInfo cfi( op.includeFileName().str() );
635 fd = createFileDef( cfi.dirPath(), cfi.fileName() );
636 }
637
638 getCodeParser(locLangExt).parseCode(m_ci,op.context(),op.text(),langExt,
641 .setExample(op.isExample(),op.exampleFile())
642 .setFileDef(fd.get())
643 .setStartLine(op.line())
645 );
646 }
648 m_hide=true;
649 }
650 if (op.isLast())
651 {
653 if (!m_hide) m_ci.endCodeFragment("DoxyCodeInclude");
654 }
655 else
656 {
657 if (!m_hide) m_t << "\n";
658 }
659}
660
662{
663 if (m_hide) return;
664 DString s = f.text();
665 const char *p = s.data();
666 char c = 0;
667 if (p)
668 {
669 while ((c=*p++))
670 {
671 switch (c)
672 {
673 case '\'': m_t << "\\textnormal{\\textquotesingle}"; break;
674 default: m_t << c; break;
675 }
676 }
677 }
678}
679
681{
682 if (m_hide) return;
684}
685
689
691{
692 if (m_hide) return;
693 auto opt = cite.option();
694 DString txt;
695 if (opt.noCite())
696 {
697 if (!cite.file().empty())
698 {
699 txt = cite.getText();
700 }
701 else
702 {
703 if (!opt.noPar()) txt += "[";
704 txt += cite.target();
705 if (!opt.noPar()) txt += "]";
706 }
707 m_t << "{\\bfseries ";
708 filter(txt);
709 m_t << "}";
710 }
711 else
712 {
713 if (!cite.file().empty())
714 {
715 DString anchor = cite.anchor();
717 anchor = anchor.mid(anchorPrefix.length()); // strip prefix
718
719 txt = "\\DoxyCite{" + anchor + "}";
720 if (opt.isNumber())
721 {
722 txt += "{number}";
723 }
724 else if (opt.isShortAuthor())
725 {
726 txt += "{shortauthor}";
727 }
728 else if (opt.isYear())
729 {
730 txt += "{year}";
731 }
732 if (!opt.noPar()) txt += "{1}";
733 else txt += "{0}";
734
735 m_t << txt;
736 }
737 else
738 {
739 if (!opt.noPar()) txt += "[";
740 txt += cite.target();
741 if (!opt.noPar()) txt += "]";
742 m_t << "{\\bfseries ";
743 filter(txt);
744 m_t << "}";
745 }
746 }
747}
748
749//--------------------------------------
750// visitor functions for compound nodes
751//--------------------------------------
752
754{
755 if (m_hide) return;
756 if (m_indentLevel>=maxIndentLevels-1) return;
757 if (l.isEnumList())
758 {
759 m_t << "\n\\begin{DoxyEnumerate}";
761 }
762 else
763 {
765 m_t << "\n\\begin{DoxyItemize}";
766 }
767 visitChildren(l);
768 if (l.isEnumList())
769 {
770 m_t << "\n\\end{DoxyEnumerate}";
771 }
772 else
773 {
774 m_t << "\n\\end{DoxyItemize}";
775 }
776}
777
779{
780 if (m_hide) return;
781 switch (li.itemNumber())
782 {
783 case DocAutoList::Unchecked: // unchecked
784 m_t << "\n\\item[\\DoxyUnchecked] ";
785 break;
786 case DocAutoList::Checked_x: // checked with x
787 case DocAutoList::Checked_X: // checked with X
788 m_t << "\n\\item[\\DoxyChecked] ";
789 break;
790 default:
791 m_t << "\n\\item ";
792 break;
793 }
795 visitChildren(li);
797}
798
800{
801 if (m_hide) return;
802 visitChildren(p);
803 if (!p.isLast() && // omit <p> for last paragraph
804 !(p.parent() && // and for parameter sections
805 std::get_if<DocParamSect>(p.parent())
806 )
807 )
808 {
809 if (insideTable())
810 {
811 m_t << "~\\newline\n";
812 }
813 else
814 {
815 m_t << "\n\n";
816 }
817 }
818}
819
821{
822 visitChildren(r);
823}
824
826{
827 if (m_hide) return;
828 switch(s.type())
829 {
831 m_t << "\\begin{DoxySeeAlso}{";
833 break;
835 m_t << "\\begin{DoxyReturn}{";
837 break;
839 m_t << "\\begin{DoxyAuthor}{";
840 filter(theTranslator->trAuthor(true,true));
841 break;
843 m_t << "\\begin{DoxyAuthor}{";
844 filter(theTranslator->trAuthor(true,false));
845 break;
847 m_t << "\\begin{DoxyVersion}{";
849 break;
851 m_t << "\\begin{DoxySince}{";
853 break;
855 m_t << "\\begin{DoxyDate}{";
857 break;
859 m_t << "\\begin{DoxyNote}{";
861 break;
863 m_t << "\\begin{DoxyWarning}{";
865 break;
867 m_t << "\\begin{DoxyPrecond}{";
869 break;
871 m_t << "\\begin{DoxyPostcond}{";
873 break;
875 m_t << "\\begin{DoxyCopyright}{";
877 break;
879 m_t << "\\begin{DoxyInvariant}{";
881 break;
883 m_t << "\\begin{DoxyRemark}{";
885 break;
887 m_t << "\\begin{DoxyAttention}{";
889 break;
891 m_t << "\\begin{DoxyImportant}{";
893 break;
895 m_t << "\\begin{DoxyParagraph}{";
896 break;
898 m_t << "\\begin{DoxyParagraph}{";
899 break;
900 case DocSimpleSect::Unknown: break;
901 }
902
903 if (s.title())
904 {
905 m_insideItem=true;
906 std::visit(*this,*s.title());
907 m_insideItem=false;
908 }
909 m_t << "}\n";
911 visitChildren(s);
912 switch(s.type())
913 {
915 m_t << "\n\\end{DoxySeeAlso}\n";
916 break;
918 m_t << "\n\\end{DoxyReturn}\n";
919 break;
921 m_t << "\n\\end{DoxyAuthor}\n";
922 break;
924 m_t << "\n\\end{DoxyAuthor}\n";
925 break;
927 m_t << "\n\\end{DoxyVersion}\n";
928 break;
930 m_t << "\n\\end{DoxySince}\n";
931 break;
933 m_t << "\n\\end{DoxyDate}\n";
934 break;
936 m_t << "\n\\end{DoxyNote}\n";
937 break;
939 m_t << "\n\\end{DoxyWarning}\n";
940 break;
942 m_t << "\n\\end{DoxyPrecond}\n";
943 break;
945 m_t << "\n\\end{DoxyPostcond}\n";
946 break;
948 m_t << "\n\\end{DoxyCopyright}\n";
949 break;
951 m_t << "\n\\end{DoxyInvariant}\n";
952 break;
954 m_t << "\n\\end{DoxyRemark}\n";
955 break;
957 m_t << "\n\\end{DoxyAttention}\n";
958 break;
960 m_t << "\n\\end{DoxyImportant}\n";
961 break;
963 m_t << "\n\\end{DoxyParagraph}\n";
964 break;
966 m_t << "\n\\end{DoxyParagraph}\n";
967 break;
968 default:
969 break;
970 }
972}
973
975{
976 if (m_hide) return;
977 visitChildren(t);
978}
979
981{
982 if (m_hide) return;
983 m_t << "\\begin{DoxyItemize}\n";
985 visitChildren(l);
986 m_t << "\\end{DoxyItemize}\n";
987}
988
990{
991 if (m_hide) return;
992 m_t << "\\item ";
994 if (li.paragraph())
995 {
996 visit(*this,*li.paragraph());
997 }
999}
1000
1002{
1003 if (m_hide) return;
1004 bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS);
1005 if (pdfHyperlinks)
1006 {
1007 m_t << "\\hypertarget{" << stripPath(s.file()) << "_" << s.anchor() << "}{}";
1008 }
1009 m_t << "\\" << getSectionName(s.level()) << "{";
1010 if (pdfHyperlinks)
1011 {
1012 m_t << "\\texorpdfstring{";
1013 }
1014 if (s.title())
1015 {
1016 if (pdfHyperlinks) m_texOrPdf = TexOrPdf::TEX;
1017 std::visit(*this,*s.title());
1019 }
1020 if (pdfHyperlinks)
1021 {
1022 m_t << "}{";
1023 if (s.title())
1024 {
1025 if (pdfHyperlinks) m_texOrPdf = TexOrPdf::PDF;
1026 std::visit(*this,*s.title());
1028 }
1029 m_t << "}";
1030 }
1031 m_t << "}\\label{" << stripPath(s.file()) << "_" << s.anchor() << "}\n";
1032 visitChildren(s);
1033}
1034
1036{
1037 if (m_hide) return;
1038 if (m_indentLevel>=maxIndentLevels-1) return;
1040 if (s.type()==DocHtmlList::Ordered)
1041 {
1042 bool first = true;
1043 m_t << "\n\\begin{DoxyEnumerate}";
1044 for (const auto &opt : s.attribs())
1045 {
1046 if (opt.name=="type")
1047 {
1048 if (opt.value=="1")
1049 {
1050 m_t << (first ? "[": ",");
1051 m_t << "label=\\arabic*";
1052 first = false;
1053 }
1054 else if (opt.value=="a")
1055 {
1056 m_t << (first ? "[": ",");
1057 m_t << "label=\\enumalphalphcnt*";
1058 first = false;
1059 }
1060 else if (opt.value=="A")
1061 {
1062 m_t << (first ? "[": ",");
1063 m_t << "label=\\enumAlphAlphcnt*";
1064 first = false;
1065 }
1066 else if (opt.value=="i")
1067 {
1068 m_t << (first ? "[": ",");
1069 m_t << "label=\\roman*";
1070 first = false;
1071 }
1072 else if (opt.value=="I")
1073 {
1074 m_t << (first ? "[": ",");
1075 m_t << "label=\\Roman*";
1076 first = false;
1077 }
1078 }
1079 else if (opt.name=="start")
1080 {
1081 m_t << (first ? "[": ",");
1082 bool ok = false;
1083 int val = opt.value.toInt(&ok);
1084 if (ok) m_t << "start=" << val;
1085 first = false;
1086 }
1087 }
1088 if (!first) m_t << "]\n";
1089 }
1090 else
1091 {
1092 m_t << "\n\\begin{DoxyItemize}";
1093 }
1094 visitChildren(s);
1095 if (m_indentLevel>=maxIndentLevels-1) return;
1096 if (s.type()==DocHtmlList::Ordered)
1097 m_t << "\n\\end{DoxyEnumerate}";
1098 else
1099 m_t << "\n\\end{DoxyItemize}";
1100}
1101
1103{
1104 if (m_hide) return;
1105 if (m_listItemInfo[indentLevel()].isEnum)
1106 {
1107 for (const auto &opt : l.attribs())
1108 {
1109 if (opt.name=="value")
1110 {
1111 bool ok = false;
1112 int val = opt.value.toInt(&ok);
1113 if (ok)
1114 {
1115 m_t << "\n\\setcounter{DoxyEnumerate" << DString::integerToRoman(indentLevel()+1,false) << "}{" << (val - 1) << "}";
1116 }
1117 }
1118 }
1119 }
1120 m_t << "\n\\item ";
1122 visitChildren(l);
1124}
1125
1126
1128{
1129 HtmlAttribList attrs = dl.attribs();
1130 auto it = std::find_if(attrs.begin(),attrs.end(),
1131 [](const auto &att) { return att.name=="class"; });
1132 if (it!=attrs.end() && it->value == "reflist") return true;
1133 return false;
1134}
1135
1136static bool listIsNested(const DocHtmlDescList &dl)
1137{
1138 bool isNested=false;
1139 const DocNodeVariant *n = dl.parent();
1140 while (n && !isNested)
1141 {
1142 if (std::get_if<DocHtmlDescList>(n))
1143 {
1144 isNested = !classEqualsReflist(std::get<DocHtmlDescList>(*n));
1145 }
1146 n = ::parent(n);
1147 }
1148 return isNested;
1149}
1150
1152{
1153 if (m_hide) return;
1154 bool eq = classEqualsReflist(dl);
1155 if (eq)
1156 {
1157 m_t << "\n\\begin{DoxyRefList}";
1158 }
1159 else
1160 {
1161 if (listIsNested(dl)) m_t << "\n\\hfill";
1162 m_t << "\n\\begin{DoxyDescription}";
1163 }
1164 visitChildren(dl);
1165 if (eq)
1166 {
1167 m_t << "\n\\end{DoxyRefList}";
1168 }
1169 else
1170 {
1171 m_t << "\n\\end{DoxyDescription}";
1172 }
1173}
1174
1176{
1177 if (m_hide) return;
1178 m_t << "\n\\item[{\\parbox[t]{\\linewidth}{";
1179 m_insideItem=true;
1180 visitChildren(dt);
1181 m_insideItem=false;
1182 m_t << "}}]";
1183}
1184
1186{
1188 if (!m_insideItem) m_t << "\\hfill";
1189 m_t << " \\\\\n";
1190 visitChildren(dd);
1192}
1193
1195{
1196 bool isNested=m_lcg.usedTableLevel()>0;
1197 while (n && !isNested)
1198 {
1200 n = ::parent(n);
1201 }
1202 return isNested;
1203}
1204
1206{
1207 if (isTableNested(n))
1208 {
1209 m_t << "\\begin{DoxyTableNested}{" << cols << "}";
1210 }
1211 else
1212 {
1213 m_t << "\n\\begin{DoxyTable}{" << cols << "}";
1214 }
1215}
1216
1218{
1219 if (isTableNested(n))
1220 {
1221 m_t << "\\end{DoxyTableNested}\n";
1222 }
1223 else
1224 {
1225 m_t << "\\end{DoxyTable}\n";
1226 }
1227}
1228
1230{
1231 if (m_hide) return;
1233 const DocHtmlCaption *c = t.caption() ? &std::get<DocHtmlCaption>(*t.caption()) : nullptr;
1234 if (c)
1235 {
1236 bool pdfHyperLinks = Config_getBool(PDF_HYPERLINKS);
1237 if (!c->file().empty() && pdfHyperLinks)
1238 {
1239 m_t << "\\hypertarget{" << stripPath(c->file()) << "_" << c->anchor()
1240 << "}{}";
1241 }
1242 m_t << "\n";
1243 }
1244
1246 if (!isTableNested(t.parent()))
1247 {
1248 // write caption
1249 m_t << "{";
1250 if (c)
1251 {
1252 m_captionTable = true;
1253 std::visit(*this, *t.caption());
1254 m_captionTable = false;
1255 }
1256 m_t << "}";
1257 // write label
1258 m_t << "{";
1259 if (c && (!stripPath(c->file()).empty() || !c->anchor().empty()))
1260 {
1261 m_t << stripPath(c->file()) << "_" << c->anchor();
1262 }
1263 m_t << "}";
1264 }
1265
1266 // write head row(s)
1267 m_t << "{" << t.numberHeaderRows() << "}\n";
1268
1270
1271 visitChildren(t);
1273 popTableState();
1274}
1275
1277{
1278 if (m_hide) return;
1279 visitChildren(c);
1280}
1281
1283{
1284 if (m_hide) return;
1286
1287 visitChildren(row);
1288
1289 m_t << "\\\\";
1290
1291 size_t col = 1;
1292 for (auto &span : rowSpans())
1293 {
1294 if (span.rowSpan>0) span.rowSpan--;
1295 if (span.rowSpan<=0)
1296 {
1297 // inactive span
1298 }
1299 else if (span.column>col)
1300 {
1301 col = span.column+span.colSpan;
1302 }
1303 else
1304 {
1305 col = span.column+span.colSpan;
1306 }
1307 }
1308
1309 m_t << "\n";
1310}
1311
1313{
1314 if (m_hide) return;
1315 //printf("Cell(r=%u,c=%u) rowSpan=%d colSpan=%d currentColumn()=%zu\n",c.rowIndex(),c.columnIndex(),c.rowSpan(),c.colSpan(),currentColumn());
1316
1318
1319 DString cellOpts;
1320 DString cellSpec;
1321 auto appendOpt = [&cellOpts](const DString &s)
1322 {
1323 if (!cellOpts.empty()) cellOpts+=",";
1324 cellOpts+=s;
1325 };
1326 auto appendSpec = [&cellSpec](const DString &s)
1327 {
1328 if (!cellSpec.empty()) cellSpec+=",";
1329 cellSpec+=s;
1330 };
1331 auto writeCell = [this,&cellOpts,&cellSpec]()
1332 {
1333 if (!cellOpts.empty() || !cellSpec.empty())
1334 {
1335 m_t << "\\SetCell";
1336 if (!cellOpts.empty())
1337 {
1338 m_t << "[" << cellOpts << "]";
1339 }
1340 m_t << "{" << cellSpec << "}";
1341 }
1342 };
1343
1344 // skip over columns that have a row span starting at an earlier row
1345 for (const auto &span : rowSpans())
1346 {
1347 //printf("span(r=%u,c=%u): column=%zu colSpan=%zu,rowSpan=%zu currentColumn()=%zu\n",
1348 // span.cell.rowIndex(),span.cell.columnIndex(),
1349 // span.column,span.colSpan,span.rowSpan,
1350 // currentColumn());
1351 if (span.rowSpan>0 && span.column==currentColumn())
1352 {
1353 setCurrentColumn(currentColumn()+span.colSpan);
1354 for (size_t i=0;i<span.colSpan;i++)
1355 {
1356 m_t << "&";
1357 }
1358 }
1359 }
1360
1361 int cs = c.colSpan();
1362 int ha = c.alignment();
1363 int rs = c.rowSpan();
1364 int va = c.valignment();
1365
1366 switch (ha) // horizontal alignment
1367 {
1368 case DocHtmlCell::Right:
1369 appendSpec("r");
1370 break;
1372 appendSpec("c");
1373 break;
1374 default:
1375 // default
1376 break;
1377 }
1378 if (rs>0) // row span
1379 {
1380 appendOpt("r="+DString().setNum(rs));
1381 //printf("adding row span: cell={r=%d c=%d rs=%d cs=%d} curCol=%zu\n",
1382 // c.rowIndex(),c.columnIndex(),c.rowSpan(),c.colSpan(),
1383 // currentColumn());
1385 }
1386 if (cs>1) // column span
1387 {
1388 // update column to the end of the span, needs to be done *after* calling addRowSpan()
1390 appendOpt("c="+DString().setNum(cs));
1391 }
1392 if (c.isHeading())
1393 {
1394 appendSpec("bg=\\tableheadbgcolor");
1395 appendSpec("font=\\bfseries");
1396 }
1397 switch(va) // vertical alignment
1398 {
1399 case DocHtmlCell::Top:
1400 appendSpec("h");
1401 break;
1403 appendSpec("f");
1404 break;
1406 // default
1407 break;
1408 }
1409 writeCell();
1410
1411 visitChildren(c);
1412
1413 for (int i=0;i<cs-1;i++)
1414 {
1415 m_t << "&"; // placeholder for invisible cell
1416 }
1417
1418 if (!c.isLast()) m_t << "&";
1419}
1420
1422{
1423 if (m_hide) return;
1424 visitChildren(i);
1425}
1426
1428{
1429 if (m_hide) return;
1430 if (Config_getBool(PDF_HYPERLINKS))
1431 {
1432 m_t << "\\href{";
1433 m_t << latexFilterURL(href.url());
1434 m_t << "}";
1435 }
1436 m_t << "{\\texttt{";
1437 visitChildren(href);
1438 m_t << "}}";
1439}
1440
1442{
1443 if (m_hide) return;
1444 m_t << "{\\bfseries{";
1445 visitChildren(d);
1446 m_t << "}}";
1447}
1448
1450{
1451 if (m_hide) return;
1452 m_t << "\n\n";
1453 auto summary = d.summary();
1454 if (summary)
1455 {
1456 std::visit(*this,*summary);
1457 m_t << "\\begin{adjustwidth}{1em}{0em}\n";
1458 }
1459 visitChildren(d);
1460 if (summary)
1461 {
1462 m_t << "\\end{adjustwidth}\n";
1463 }
1464 else
1465 {
1466 m_t << "\n\n";
1467 }
1468}
1469
1471{
1472 if (m_hide) return;
1473 m_t << "\\" << getSectionName(header.level()) << "*{";
1474 visitChildren(header);
1475 m_t << "}";
1476}
1477
1479{
1480 if (img.type()==DocImage::Latex)
1481 {
1482 if (m_hide) return;
1483 DString gfxName = img.name();
1484 if (gfxName.endsWith(".eps") || gfxName.endsWith(".pdf"))
1485 {
1486 gfxName=gfxName.left(gfxName.length()-4);
1487 }
1488
1489 visitPreStart(m_t,img.hasCaption(), gfxName, img.width(), img.height(), img.isInlineImage());
1490 visitChildren(img);
1492 }
1493 else // other format -> skip
1494 {
1495 }
1496}
1497
1499{
1500 if (m_hide) return;
1501 bool exists = false;
1502 std::string inBuf;
1503 if (readInputFile(df.file(),inBuf))
1504 {
1505 auto fileName = writeInlineGraph(Config_getString(LATEX_OUTPUT)+"/"+stripPath(df.file())+"_", // baseName
1506 ".dot", // extension
1507 inBuf, // contents
1508 exists);
1509 if (!fileName.empty())
1510 {
1511 startDotFile(fileName,df.width(),df.height(),df.hasCaption(),df.srcFile(),df.srcLine(),!exists);
1512 visitChildren(df);
1513 endDotFile(df.hasCaption());
1514 }
1515 }
1516}
1517
1519{
1520 if (m_hide) return;
1521 bool exists = false;
1522 std::string inBuf;
1523 if (readInputFile(df.file(),inBuf))
1524 {
1525 auto fileName = writeInlineGraph(Config_getString(LATEX_OUTPUT)+"/"+stripPath(df.file())+"_", // baseName
1526 ".msc", // extension
1527 inBuf, // contents
1528 exists);
1529 if (!fileName.empty())
1530 {
1531 startMscFile(fileName,df.width(),df.height(),df.hasCaption(),df.srcFile(),df.srcLine(),!exists);
1532 visitChildren(df);
1533 endMscFile(df.hasCaption());
1534 }
1535 }
1536}
1537
1539{
1540 if (m_hide) return;
1541 bool exists = false;
1542 std::string inBuf;
1543 if (readInputFile(df.file(),inBuf))
1544 {
1545 auto fileName = writeInlineGraph(Config_getString(LATEX_OUTPUT)+"/"+stripPath(df.file())+"_", // baseName
1546 ".dia", // extension
1547 inBuf, // contents
1548 exists);
1549 if (!fileName.empty())
1550 {
1551 startDiaFile(fileName,df.width(),df.height(),df.hasCaption(),df.srcFile(),df.srcLine(),!exists);
1552 visitChildren(df);
1553 endDiaFile(df.hasCaption());
1554 }
1555 }
1556}
1557
1559{
1560 if (m_hide) return;
1561 if (!Config_getBool(DOT_CLEANUP)) copyFile(df.file(),Config_getString(LATEX_OUTPUT)+"/"+stripPath(df.file()));
1562 startPlantUmlFile(df.file(),df.width(),df.height(),df.hasCaption(),df.srcFile(),df.srcLine());
1563 visitChildren(df);
1565}
1566
1568{
1569 if (m_hide) return;
1570 if (Config_getBool(MERMAID_RENDER_MODE)==MERMAID_RENDER_MODE_t::CLIENT_SIDE) return;
1571 if (!Config_getBool(DOT_CLEANUP)) copyFile(df.file(),Config_getString(LATEX_OUTPUT)+"/"+stripPath(df.file()));
1572 startMermaidFile(df.file(),df.width(),df.height(),df.hasCaption(),df.srcFile(),df.srcLine());
1573 visitChildren(df);
1575}
1576
1578{
1579 if (m_hide) return;
1580 startLink(lnk.ref(),lnk.file(),lnk.anchor());
1581 visitChildren(lnk);
1582 endLink(lnk.ref(),lnk.file(),lnk.anchor());
1583}
1584
1586{
1587 if (m_hide) return;
1588 // when ref.isSubPage()==true we use ref.file() for HTML and
1589 // ref.anchor() for LaTeX/RTF
1590 if (ref.isSubPage())
1591 {
1592 startLink(ref.ref(),DString(),ref.anchor());
1593 }
1594 else
1595 {
1596 if (!ref.file().empty()) startLink(ref.ref(),ref.file(),ref.anchor(),ref.refToTable(),ref.refToSection());
1597 }
1598 if (!ref.hasLinkText())
1599 {
1600 filter(ref.targetTitle());
1601 }
1602 visitChildren(ref);
1603 if (ref.isSubPage())
1604 {
1605 endLink(ref.ref(),DString(),ref.anchor());
1606 }
1607 else
1608 {
1609 if (!ref.file().empty()) endLink(ref.ref(),ref.file(),ref.anchor(),ref.refToTable(),ref.refToSection(),ref.sectionType());
1610 }
1611}
1612
1614{
1615 if (m_hide) return;
1616 m_t << "\\item \\contentsline{section}{";
1617 if (ref.isSubPage())
1618 {
1619 startLink(ref.ref(),DString(),ref.anchor());
1620 }
1621 else
1622 {
1623 if (!ref.file().empty())
1624 {
1625 startLink(ref.ref(),ref.file(),ref.anchor(),ref.refToTable());
1626 }
1627 }
1628 visitChildren(ref);
1629 if (ref.isSubPage())
1630 {
1631 endLink(ref.ref(),DString(),ref.anchor());
1632 }
1633 else
1634 {
1635 if (!ref.file().empty()) endLink(ref.ref(),ref.file(),ref.anchor(),ref.refToTable());
1636 }
1637 m_t << "}{\\ref{";
1638 if (!ref.file().empty()) m_t << stripPath(ref.file());
1639 if (!ref.file().empty() && !ref.anchor().empty()) m_t << "_";
1640 if (!ref.anchor().empty()) m_t << ref.anchor();
1641 m_t << "}}{}\n";
1642}
1643
1645{
1646 if (m_hide) return;
1647 m_t << "\\footnotesize\n";
1648 m_t << "\\begin{multicols}{2}\n";
1649 m_t << "\\begin{DoxyCompactList}\n";
1651 visitChildren(l);
1653 m_t << "\\end{DoxyCompactList}\n";
1654 m_t << "\\end{multicols}\n";
1655 m_t << "\\normalsize\n";
1656}
1657
1659{
1660 if (m_hide) return;
1661 bool hasInOutSpecs = s.hasInOutSpecifier();
1662 bool hasTypeSpecs = s.hasTypeSpecifier();
1664 switch(s.type())
1665 {
1667 m_t << "\n\\begin{DoxyParams}";
1668 if (hasInOutSpecs && hasTypeSpecs) m_t << "[2]"; // 2 extra cols
1669 else if (hasInOutSpecs || hasTypeSpecs) m_t << "[1]"; // 1 extra col
1670 m_t << "{";
1672 break;
1674 m_t << "\n\\begin{DoxyRetVals}{";
1676 break;
1678 m_t << "\n\\begin{DoxyExceptions}{";
1680 break;
1682 m_t << "\n\\begin{DoxyTemplParams}{";
1684 break;
1685 default:
1686 ASSERT(0);
1688 }
1689 m_t << "}\n";
1690 visitChildren(s);
1692 switch(s.type())
1693 {
1695 m_t << "\\end{DoxyParams}\n";
1696 break;
1698 m_t << "\\end{DoxyRetVals}\n";
1699 break;
1701 m_t << "\\end{DoxyExceptions}\n";
1702 break;
1704 m_t << "\\end{DoxyTemplParams}\n";
1705 break;
1706 default:
1707 ASSERT(0);
1709 }
1710}
1711
1713{
1714 m_t << " " << sep.chars() << " ";
1715}
1716
1718{
1719 if (m_hide) return;
1721 const DocParamSect *sect = std::get_if<DocParamSect>(pl.parent());
1722 if (sect)
1723 {
1724 parentType = sect->type();
1725 }
1726 bool useTable = parentType==DocParamSect::Param ||
1727 parentType==DocParamSect::RetVal ||
1728 parentType==DocParamSect::Exception ||
1729 parentType==DocParamSect::TemplateParam;
1730 if (!useTable)
1731 {
1732 m_t << "\\item[";
1733 }
1734 if (sect && sect->hasInOutSpecifier())
1735 {
1737 {
1738 m_t << "\\doxymbox{\\texttt{";
1739 if (pl.direction()==DocParamSect::In)
1740 {
1741 m_t << "in";
1742 }
1743 else if (pl.direction()==DocParamSect::Out)
1744 {
1745 m_t << "out";
1746 }
1747 else if (pl.direction()==DocParamSect::InOut)
1748 {
1749 m_t << "in,out";
1750 }
1751 m_t << "}} ";
1752 }
1753 if (useTable) m_t << " & ";
1754 }
1755 if (sect && sect->hasTypeSpecifier())
1756 {
1757 for (const auto &type : pl.paramTypes())
1758 {
1759 std::visit(*this,type);
1760 }
1761 if (useTable) m_t << " & ";
1762 }
1763 m_t << "{\\em ";
1764 bool first=true;
1765 for (const auto &param : pl.parameters())
1766 {
1767 if (!first) m_t << ","; else first=false;
1768 m_insideItem=true;
1769 std::visit(*this,param);
1770 m_insideItem=false;
1771 }
1772 m_t << "}";
1773 if (useTable)
1774 {
1775 m_t << " & ";
1776 }
1777 else
1778 {
1779 m_t << "]";
1780 }
1781 for (const auto &par : pl.paragraphs())
1782 {
1783 std::visit(*this,par);
1784 }
1785 if (useTable)
1786 {
1787 m_t << "\\\\\n"
1788 << "\\hline\n";
1789 }
1790}
1791
1793{
1794 bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS);
1795 if (m_hide) return;
1796 if (x.title().empty()) return;
1798 m_t << "\\begin{DoxyRefDesc}{";
1799 filter(x.title());
1800 m_t << "}\n";
1801 bool anonymousEnum = x.file()=="@";
1802 m_t << "\\item[";
1803 if (pdfHyperlinks && !anonymousEnum)
1804 {
1805 m_t << "\\doxymbox{\\hyperlink{" << stripPath(x.file()) << "_" << x.anchor() << "}{";
1806 }
1807 else
1808 {
1809 m_t << "\\textbf{ ";
1810 }
1811 m_insideItem=true;
1812 filter(x.title());
1813 m_insideItem=false;
1814 if (pdfHyperlinks && !anonymousEnum)
1815 {
1816 m_t << "}";
1817 }
1818 m_t << "}]";
1819 visitChildren(x);
1820 if (x.title().empty()) return;
1822 m_t << "\\end{DoxyRefDesc}\n";
1823}
1824
1826{
1827 if (m_hide) return;
1828 startLink(DString(),ref.file(),ref.anchor());
1829 visitChildren(ref);
1830 endLink(DString(),ref.file(),ref.anchor());
1831}
1832
1834{
1835 if (m_hide) return;
1836 visitChildren(t);
1837}
1838
1840{
1841 if (m_hide) return;
1842 m_t << "\\begin{quote}\n";
1844 visitChildren(q);
1845 m_t << "\\end{quote}\n";
1847}
1848
1852
1854{
1855 if (m_hide) return;
1856 visitChildren(pb);
1857}
1858
1859void LatexDocVisitor::filter(const DString &str, const bool retainNewLine, const bool /* citeEntry */)
1860{
1861 //printf("LatexDocVisitor::filter(%s) m_insideTabbing=%d m_insideTable=%d\n",qPrint(str),m_lcg.insideTabbing(),m_lcg.usedTableLevel()>0);
1866 m_lcg.usedTableLevel()>0, // insideTable
1867 false, // keepSpaces
1868 retainNewLine
1869 );
1870}
1871
1872void LatexDocVisitor::startLink(const DString &ref,const DString &file,const DString &anchor,
1873 bool refToTable,bool refToSection)
1874{
1875 bool pdfHyperLinks = Config_getBool(PDF_HYPERLINKS);
1876 if (ref.empty() && pdfHyperLinks) // internal PDF link
1877 {
1878 if (refToTable)
1879 {
1880 m_t << "\\doxytablelink{";
1881 }
1882 else if (refToSection)
1883 {
1884 if (m_texOrPdf == TexOrPdf::TEX || m_captionTable) m_t << "\\protect";
1885 if (m_texOrPdf != TexOrPdf::PDF) m_t << "\\doxysectlink{";
1886 }
1887 else
1888 {
1889 if (m_texOrPdf == TexOrPdf::TEX || m_captionTable) m_t << "\\protect";
1890 if (m_texOrPdf != TexOrPdf::PDF) m_t << "\\doxylink{";
1891 }
1892 if (refToTable || m_texOrPdf != TexOrPdf::PDF)
1893 {
1894 if (!file.empty()) m_t << stripPath(file);
1895 if (!file.empty() && !anchor.empty()) m_t << "_";
1896 if (!anchor.empty()) m_t << anchor;
1897 m_t << "}";
1898 }
1899 m_t << "{";
1900 }
1901 else if (ref.empty() && refToSection)
1902 {
1903 m_t << "\\doxysectref{";
1904 }
1905 else if (ref.empty() && refToTable)
1906 {
1907 m_t << "\\doxytableref{";
1908 }
1909 else if (ref.empty()) // internal non-PDF link
1910 {
1911 m_t << "\\doxyref{";
1912 }
1913 else // external link
1914 {
1915 m_t << "\\textbf{ ";
1916 }
1917}
1918
1919void LatexDocVisitor::endLink(const DString &ref,const DString &file,const DString &anchor,bool /*refToTable*/,bool refToSection, SectionType sectionType)
1920{
1921 m_t << "}";
1922 bool pdfHyperLinks = Config_getBool(PDF_HYPERLINKS);
1923 if (ref.empty() && !pdfHyperLinks)
1924 {
1925 m_t << "{";
1927 m_t << "}{" << file;
1928 if (!file.empty() && !anchor.empty()) m_t << "_";
1929 m_t << anchor << "}";
1930 if (refToSection)
1931 {
1932 m_t << "{" << sectionType.level() << "}";
1933 }
1934 }
1935 if (ref.empty() && pdfHyperLinks) // internal PDF link
1936 {
1937 if (refToSection)
1938 {
1939 if (m_texOrPdf != TexOrPdf::PDF) m_t << "{" << sectionType.level() << "}";
1940 }
1941 }
1942}
1943
1945 const DString &width,
1946 const DString &height,
1947 bool hasCaption,
1948 const DString &srcFile,
1949 int srcLine, bool newFile
1950 )
1951{
1952 DString baseName=makeBaseName(fileName,".dot");
1953 baseName.prepend("dot_");
1954 DString outDir = Config_getString(LATEX_OUTPUT);
1955 if (newFile) writeDotGraphFromFile(fileName,outDir,baseName,GraphOutputFormat::EPS,srcFile,srcLine,false);
1956 visitPreStart(m_t,hasCaption, baseName, width, height);
1957}
1958
1959void LatexDocVisitor::endDotFile(bool hasCaption)
1960{
1961 if (m_hide) return;
1962 visitPostEnd(m_t,hasCaption);
1963}
1964
1966 const DString &width,
1967 const DString &height,
1968 bool hasCaption,
1969 const DString &srcFile,
1970 int srcLine, bool newFile
1971 )
1972{
1973 DString baseName=makeBaseName(fileName,".msc");
1974 baseName.prepend("msc_");
1975
1976 DString outDir = Config_getString(LATEX_OUTPUT);
1977 if (newFile) writeMscGraphFromFile(fileName,outDir,baseName,MscOutputFormat::EPS,srcFile,srcLine,false);
1978 visitPreStart(m_t,hasCaption, baseName, width, height);
1979}
1980
1981void LatexDocVisitor::endMscFile(bool hasCaption)
1982{
1983 if (m_hide) return;
1984 visitPostEnd(m_t,hasCaption);
1985}
1986
1987
1988void LatexDocVisitor::writeMscFile(const DString &fileName, const DocVerbatim &s, bool newFile)
1989{
1990 DString shortName=makeBaseName(fileName,".msc");
1991 DString outDir = Config_getString(LATEX_OUTPUT);
1992 if (newFile) writeMscGraphFromFile(fileName,outDir,shortName,MscOutputFormat::EPS,s.srcFile(),s.srcLine(),false);
1993 visitPreStart(m_t, s.hasCaption(), shortName, s.width(),s.height());
1996}
1997
1999 const DString &width,
2000 const DString &height,
2001 bool hasCaption,
2002 const DString &srcFile,
2003 int srcLine, bool newFile
2004 )
2005{
2006 DString baseName=makeBaseName(fileName,".dia");
2007 baseName.prepend("dia_");
2008
2009 DString outDir = Config_getString(LATEX_OUTPUT);
2010 if (newFile) writeDiaGraphFromFile(fileName,outDir,baseName,DiaOutputFormat::EPS,srcFile,srcLine,false);
2011 visitPreStart(m_t,hasCaption, baseName, width, height);
2012}
2013
2014void LatexDocVisitor::endDiaFile(bool hasCaption)
2015{
2016 if (m_hide) return;
2017 visitPostEnd(m_t,hasCaption);
2018}
2019
2021{
2022 DString shortName = stripPath(baseName);
2023 if (s.useBitmap())
2024 {
2025 if (shortName.find('.')==DString::npos) shortName += ".png";
2026 }
2027 DString outDir = Config_getString(LATEX_OUTPUT);
2030 visitPreStart(m_t, s.hasCaption(), shortName, s.width(), s.height());
2033}
2034
2036 const DString &width,
2037 const DString &height,
2038 bool hasCaption,
2039 const DString &srcFile,
2040 int srcLine
2041 )
2042{
2043 DString outDir = Config_getString(LATEX_OUTPUT);
2044 std::string inBuf;
2045 readInputFile(fileName,inBuf);
2046
2047 bool useBitmap = inBuf.find("@startditaa") != std::string::npos;
2048 auto baseNameVector = PlantumlManager::instance().writePlantUMLSource(
2049 outDir,DString(),inBuf,
2051 DString(),srcFile,srcLine,false);
2052 bool first = true;
2053 for (const auto &bName: baseNameVector)
2054 {
2055 DString baseName = makeBaseName(bName,".pu");
2056 DString shortName = stripPath(baseName);
2057 if (useBitmap)
2058 {
2059 if (shortName.find('.')==DString::npos) shortName += ".png";
2060 }
2063 if (!first) endPlantUmlFile(hasCaption);
2064 first = false;
2065 visitPreStart(m_t,hasCaption, shortName, width, height);
2066 }
2067}
2068
2070{
2071 if (m_hide) return;
2072 visitPostEnd(m_t,hasCaption);
2073}
2074
2076{
2077 if (Config_getBool(MERMAID_RENDER_MODE)==MERMAID_RENDER_MODE_t::CLIENT_SIDE) return;
2078 auto shortName = stripPath(baseName);
2079 auto outDir = Config_getString(LATEX_OUTPUT);
2080 auto outputFormat = MermaidManager::OutputFormat::LaTeX;
2081 auto imageFormat = MermaidManager::convertToImageFormat(outputFormat);
2082 auto imgExt = MermaidManager::imageExtension(imageFormat);
2083 if (shortName.find('.')==DString::npos) shortName += "." + imgExt;
2084 MermaidManager::instance().generateMermaidOutput(baseName,outDir,imageFormat,false);
2085 visitPreStart(m_t, s.hasCaption(), shortName, s.width(), s.height());
2088}
2089
2091 const DString &width,
2092 const DString &height,
2093 bool hasCaption,
2094 const DString &srcFile,
2095 int srcLine
2096 )
2097{
2098 if (Config_getBool(MERMAID_RENDER_MODE)==MERMAID_RENDER_MODE_t::CLIENT_SIDE) return;
2099 DString outDir = Config_getString(LATEX_OUTPUT);
2100 std::string inBuf;
2101 readInputFile(fileName,inBuf);
2102 auto outputFormat = MermaidManager::OutputFormat::LaTeX;
2103 auto imageFormat = MermaidManager::convertToImageFormat(outputFormat);
2104 auto imgExt = MermaidManager::imageExtension(imageFormat);
2106 outDir,DString(),inBuf,imageFormat,
2107 srcFile,srcLine);
2108 auto shortName = stripPath(baseName);
2109 if (shortName.find('.')==DString::npos) shortName += "." + imgExt;
2110 MermaidManager::instance().generateMermaidOutput(baseName,outDir,imageFormat,false);
2111 visitPreStart(m_t,hasCaption, shortName, width, height);
2112}
2113
2115{
2116 if (m_hide) return;
2117 visitPostEnd(m_t,hasCaption);
2118}
2119
2121{
2122 return std::min(m_indentLevel,maxIndentLevels-1);
2123}
2124
2126{
2127 m_indentLevel++;
2129 {
2130 err("Maximum indent level ({}) exceeded while generating LaTeX output!\n",maxIndentLevels-1);
2131 }
2132}
2133
2135{
2136 if (m_indentLevel>0)
2137 {
2138 m_indentLevel--;
2139 }
2140}
2141
static CitationManager & instance()
Definition cite.cpp:90
DString anchorPrefix() const
Definition cite.cpp:131
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:84
DString mid(size_t index, size_t len=npos) const
Definition dstring.h:318
bool empty() const
Returns true iff the string is empty (std::string compatible alias for isEmpty()).
Definition dstring.h:148
static DString integerToRoman(int n, bool upper=true)
Definition dstring.cpp:638
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:178
DString & prepend(const char *s)
Definition dstring.h:515
size_t find(char c, size_t pos=0) const
Definition dstring.h:239
int toInt(bool *ok=nullptr, int base=10) const
Definition dstring.cpp:191
DString left(size_t len) const
Definition dstring.h:306
const std::string & str() const
Definition dstring.h:645
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:157
bool endsWith(const char *s) const
Definition dstring.h:617
size_t length() const
Returns the length of the string, not counting the 0-terminator.
Definition dstring.h:151
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:979
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:2064
uint32_t rowSpan() const
Definition docnode.cpp:2002
Alignment alignment() const
Definition docnode.cpp:2026
bool isLast() const
Definition docnode.h:1207
bool isHeading() const
Definition docnode.h:1205
uint32_t colSpan() const
Definition docnode.cpp:2014
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:2339
size_t numColumns() const
Definition docnode.h:1283
const DocNodeVariant * caption() const
Definition docnode.cpp:2334
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:2029
static EmojiEntityMapper & instance()
Returns the one and only instance of the Emoji entity mapper.
Definition emoji.cpp:1981
Minimal replacement for QFileInfo.
Definition fileinfo.h:26
std::string fileName() const
Definition fileinfo.cpp:122
std::string dirPath(bool absPath=true) const
Definition fileinfo.cpp:141
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:38
static DString imageExtension(ImageFormat imageFormat)
Definition mermaid.cpp:48
static ImageFormat convertToImageFormat(OutputFormat outputFormat)
Definition mermaid.cpp:59
void generateMermaidOutput(const DString &baseName, const DString &outDir, ImageFormat format, bool toIndex)
Register a generated Mermaid image with the index.
Definition mermaid.cpp:121
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:75
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:207
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:37
static PlantumlManager & instance()
Definition plantuml.cpp:236
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:29
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:196
std::unique_ptr< FileDef > createFileDef(const DString &p, const DString &n, const DString &ref, const DString &dn)
Definition filedef.cpp:267
Translator * theTranslator
Definition language.cpp:76
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
#define ASSERT(x)
Definition message.h:142
void writeMscGraphFromFile(const DString &inFile, const DString &outDir, const DString &outFile, MscOutputFormat format, const DString &srcFile, int srcLine, bool toIndex)
Definition msc.cpp:160
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:850
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:5358
DString getFileNameExtension(const DString &fn)
Definition util.cpp:4210
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:4374
SrcLangExt getLanguageFromFileName(const DString &fileName, SrcLangExt defLang)
Definition util.cpp:4168
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:4619
DString makeBaseName(const DString &name, const DString &ext)
Definition util.cpp:3974
DString stripPath(const DString &s)
Definition util.cpp:3960
SrcLangExt getLanguageFromCodeLang(DString &fileName)
Routine to handle the language attribute of the \code command.
Definition util.cpp:4186
A bunch of utility functions.