Doxygen
Loading...
Searching...
No Matches
docbookvisitor.cpp
Go to the documentation of this file.
1/******************************************************************************
2 *
3 * Copyright (C) 1997-2020 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 "docbookvisitor.h"
17#include "docparser.h"
18#include "language.h"
19#include "doxygen.h"
20#include "outputgen.h"
21#include "docbookgen.h"
22#include "dot.h"
23#include "message.h"
24#include "util.h"
25#include "parserintf.h"
26#include "filename.h"
27#include "config.h"
28#include "filedef.h"
29#include "msc.h"
30#include "dia.h"
31#include "htmlentity.h"
32#include "emoji.h"
33#include "plantuml.h"
34#include "mermaid.h"
35#include "fileinfo.h"
36#include "portable.h"
37#include "codefragment.h"
38#include "cite.h"
39
40#if 0
41#define DB_VIS_C DB_VIS_C1(m_t)
42#define DB_VIS_C1(x) x << "<!-- DB_VIS_C " << __LINE__ << " -->\n";
43#define DB_VIS_C2(y) DB_VIS_C2a(m_t,y)
44#define DB_VIS_C2a(x,y) x << "<!-- DB_VIS_C " << __LINE__ << " " << y << " -->\n";
45#else
46#define DB_VIS_C
47#define DB_VIS_C1(x)
48#define DB_VIS_C2(y)
49#define DB_VIS_C2a(x,y)
50#endif
51
52static DString filterId(const DString &s)
53{
54 if (s.empty()) return s;
55 DString result;
56 result.reserve(s.length()+8);
57 const char *p=s.data();
58 char c=0;
59 while ((c=*p++))
60 {
61 switch (c)
62 {
63 case ':': result+="_1"; break;
64 default: result+=c; break;
65 }
66 }
67 return result;
68}
69
70static bool supportedHtmlAttribute(const DString &name)
71{
72 return (name=="align" ||
73 name=="bgcolor" ||
74 name=="border" ||
75 name=="cellpadding" ||
76 name=="cellspacing" ||
77 name=="class" ||
78 name=="frame" ||
79 name=="label" ||
80 name=="style" ||
81 name=="width" ||
82 name=="tabstyle" ||
83 name=="title");
84}
85
87{
88 for (const auto &n : children)
89 {
90 std::visit(*this,n);
91 }
92}
93
95 const DocNodeList &children,
96 bool hasCaption,
97 const DString &name,
98 const DString &width,
99 const DString &height,
100 bool inlineImage)
101{
102 if (hasCaption && !inlineImage)
103 {
104 t << " <figure>\n";
105 t << " <title>\n";
106 visitCaption(children);
107 t << " </title>\n";
108 }
109 else
110 {
111 t << " <informalfigure>\n";
112 }
113 t << " <mediaobject>\n";
114 t << " <imageobject>\n";
115 t << " <imagedata";
116 if (!width.empty())
117 {
118 t << " width=\"" << DocbookGenerator::convertToDocbook(width) << "\"";
119 }
120 else
121 {
122 if (!height.empty() && !inlineImage) t << " width=\"50%\"";
123 }
124 if (!height.empty())
125 {
126 t << " depth=\"" << DocbookGenerator::convertToDocbook(height) << "\"";
127 }
128 t << " align=\"center\" valign=\"middle\" scalefit=\"0\" fileref=\"" << name << "\">";
129 t << "</imagedata>\n";
130 t << " </imageobject>\n";
131 if (hasCaption && !inlineImage)
132 {
133 t << " <!--\n"; // Needed for general formatting with title for other formats
134 }
135}
136
137void DocbookDocVisitor::visitPostEnd(TextStream &t, bool hasCaption, bool inlineImage)
138{
139 t << "\n";
140 if (hasCaption && !inlineImage)
141 {
142 t << " -->\n"; // Needed for general formatting with title for other formats
143 }
144 t << " </mediaobject>\n";
145 if (hasCaption && !inlineImage)
146 {
147 t << " </figure>\n";
148 }
149 else
150 {
151 t << " </informalfigure>\n";
152 }
153}
154
156 : m_t(t), m_ci(ci),m_langExt(langExt)
157{
159 // m_t << "<section>\n";
160}
161
162//--------------------------------------
163// visitor functions for leaf nodes
164//--------------------------------------
165
167{
169 if (m_hide) return;
170 filter(w.word());
171}
172
174{
176 if (m_hide) return;
177 startLink(w.file(),w.anchor());
178 filter(w.word());
179 endLink();
180}
181
183{
185 if (m_hide) return;
186 if (m_insidePre)
187 {
188 m_t << w.chars();
189 }
190 else
191 {
192 m_t << " ";
193 }
194}
195
197{
199 if (m_hide) return;
200 const char *res = HtmlEntityMapper::instance().docbook(s.symbol());
201 if (res)
202 {
203 m_t << res;
204 }
205 else
206 {
207 err("DocBook: non supported HTML-entity found: {}\n",HtmlEntityMapper::instance().html(s.symbol(),true));
208 }
209}
210
212{
214 if (m_hide) return;
215 const char *res = EmojiEntityMapper::instance().unicode(s.index());
216 if (res)
217 {
218 m_t << res;
219 }
220 else
221 {
222 m_t << s.name();
223 }
224}
225
227{
229 if (m_hide) return;
230 m_t << "<link xlink:href=\"";
231 if (u.isEmail()) m_t << "mailto:";
232 filter(u.url());
233 m_t << "\">";
234 filter(u.url());
235 m_t << "</link>";
236}
237
239{
241 if (m_hide) return;
242 m_t << "<?linebreak?>";
243 // gives nicer results but gives problems as it is not allowed in <pare> and also problems with dblatex
244 // m_t << "\n" << "<sbr/>\n";
245}
246
248{
250 if (m_hide) return;
251 m_t << "<informaltable frame='bottom'><tgroup cols='1'><colspec align='center'/><tbody><row><entry align='center'>\n";
252 m_t << "</entry></row></tbody></tgroup></informaltable>\n";
253}
254
256{
258 if (m_hide) return;
259 switch (s.style())
260 {
262 if (s.enable()) m_t << "<emphasis role=\"bold\">"; else m_t << "</emphasis>";
263 break;
265 if (s.enable()) m_t << "<emphasis>"; else m_t << "</emphasis>";
266 break;
270 if (s.enable()) m_t << "<computeroutput>"; else m_t << "</computeroutput>";
271 break;
273 if (s.enable()) m_t << "<subscript>"; else m_t << "</subscript>";
274 break;
276 if (s.enable()) m_t << "<superscript>"; else m_t << "</superscript>";
277 break;
279 if (s.enable()) m_t << "<informaltable frame='none'><tgroup cols='1'><colspec align='center'/><tbody><row><entry align='center'>";
280 else m_t << "</entry></row></tbody></tgroup></informaltable>";
281 break;
283 if (s.enable())
284 {
285 m_t << "<literallayout>";
286 m_insidePre=true;
287 }
288 else
289 {
290 m_t << "</literallayout>";
291 m_insidePre=false;
292 }
293 break;
294 /* There is no equivalent Docbook tag for rendering Small text */
295 case DocStyleChange::Small: /* XSLT Stylesheets can be used */ break;
296 /* HTML only */
297 case DocStyleChange::Cite: break;
298 case DocStyleChange::S: break;
299 case DocStyleChange::Strike: break;
300 case DocStyleChange::Del: break;
301 case DocStyleChange::Underline: break;
302 case DocStyleChange::Ins: break;
303 case DocStyleChange::Div: /* HTML only */ break;
304 case DocStyleChange::Span: /* HTML only */ break;
305 }
306}
307
309{
311 if (m_hide) return;
312 DString lang = m_langExt;
313 if (!s.language().empty()) // explicit language setting
314 {
315 lang = s.language();
316 }
317 SrcLangExt langExt = getLanguageFromCodeLang(lang);
318 switch(s.type())
319 {
321 m_t << "<literallayout><computeroutput>";
323 s.text(),
324 langExt,
325 Config_getBool(STRIP_CODE_COMMENTS),
327 .setExample(s.isExample(),s.exampleFile())
328 );
329 m_t << "</computeroutput></literallayout>";
330 break;
332 m_t << "<literallayout><computeroutput>";
333 filter(s.text());
334 m_t << "</computeroutput></literallayout>";
335 break;
337 filter(s.text(), true);
338 break;
340 m_t << "<computeroutput>";
341 filter(s.text(), true);
342 m_t << "</computeroutput>";
343 break;
345 break;
347 break;
349 break;
351 break;
353 break;
355 m_t << s.text();
356 break;
357 case DocVerbatim::Dot:
358 {
359 m_t << "<para>\n";
360 bool exists = false;
361 auto fileName = writeInlineGraph(Config_getString(DOCBOOK_OUTPUT)+"/inline_dotgraph_", // baseName
362 ".dot", // extension
363 s.text(), // contents
364 exists);
365 if (!fileName.empty())
366 {
367 writeDotFile(fileName, s, !exists);
368 }
369 m_t << "</para>\n";
370 }
371 break;
372 case DocVerbatim::Msc:
373 {
374 m_t << "<para>\n";
375 bool exists = false;
376 auto fileName = writeInlineGraph(Config_getString(DOCBOOK_OUTPUT)+"/inline_mscgraph_", // baseName
377 ".msc", // extension
378 "msc {"+s.text()+"}", // contents
379 exists);
380 if (!fileName.empty())
381 {
382 writeMscFile(fileName,s,!exists);
383 }
384 m_t << "</para>\n";
385 }
386 break;
388 {
389 DString docbookOutput = Config_getString(DOCBOOK_OUTPUT);
390 auto baseNameVector = PlantumlManager::instance().writePlantUMLSource(docbookOutput,
392 s.engine(),s.srcFile(),s.srcLine(),true);
393 for (const auto &baseName: baseNameVector)
394 {
395 m_t << "<para>\n";
396 writePlantUMLFile(baseName,s);
397 m_t << "</para>\n";
398 }
399 }
400 break;
402 if (Config_getBool(MERMAID_RENDER_MODE)!=MERMAID_RENDER_MODE_t::CLIENT_SIDE)
403 {
404 auto docbookOutput = Config_getString(DOCBOOK_OUTPUT);
405 auto outputFormat = MermaidManager::OutputFormat::Docbook;
406 auto imageFormat = MermaidManager::convertToImageFormat(outputFormat);
407 auto baseName = MermaidManager::instance().writeMermaidSource(docbookOutput,
408 s.exampleFile(),s.text(),imageFormat,
409 s.srcFile(),s.srcLine());
410 m_t << "<para>\n";
411 writeMermaidFile(baseName,s);
412 m_t << "</para>\n";
413 }
414 break;
415 }
416}
417
419{
421 if (m_hide) return;
422 m_t << "<anchor xml:id=\"_" << stripPath(anc.file()) << "_1" << filterId(anc.anchor()) << "\"/>";
423}
424
426{
428 if (m_hide) return;
430 switch(inc.type())
431 {
433 {
434 m_t << "<literallayout><computeroutput>";
435 FileInfo cfi( inc.file().str() );
436 auto fd = createFileDef( cfi.dirPath(), cfi.fileName() );
438 inc.text(),
439 langExt,
440 inc.stripCodeComments(),
442 .setExample(inc.isExample(),inc.exampleFile())
443 .setFileDef(fd.get())
444 );
445 m_t << "</computeroutput></literallayout>";
446 }
447 break;
449 m_t << "<literallayout><computeroutput>";
451 inc.text(),
452 langExt,
453 inc.stripCodeComments(),
455 .setExample(inc.isExample(),inc.exampleFile())
456 );
457 m_t << "</computeroutput></literallayout>";
458 break;
466 break;
468 m_t << inc.text();
469 break;
471 m_t << "<literallayout>";
472 filter(inc.text());
473 m_t << "</literallayout>";
474 break;
477 m_t << "<literallayout><computeroutput>";
479 inc.file(),
480 inc.blockId(),
481 inc.context(),
483 inc.trimLeft(),
485 );
486 m_t << "</computeroutput></literallayout>";
487 break;
488 }
489}
490
492{
494 if (op.isFirst())
495 {
496 if (!m_hide)
497 {
498 m_t << "<programlisting linenumbering=\"unnumbered\">";
499 }
501 m_hide = true;
502 }
504 if (locLangExt.empty()) locLangExt = m_langExt;
505 SrcLangExt langExt = getLanguageFromFileName(locLangExt);
506 if (op.type()!=DocIncOperator::Skip)
507 {
508 m_hide = popHidden();
509 if (!m_hide)
510 {
511 std::unique_ptr<FileDef> fd;
512 if (!op.includeFileName().empty())
513 {
514 FileInfo cfi( op.includeFileName().str() );
515 fd = createFileDef( cfi.dirPath(), cfi.fileName() );
516 }
517
518 getCodeParser(locLangExt).parseCode(m_ci,op.context(),
519 op.text(),langExt,
522 .setExample(op.isExample(), op.exampleFile())
523 .setFileDef(fd.get())
524 .setStartLine(op.line())
526 );
527 }
529 m_hide=true;
530 }
531 if (op.isLast())
532 {
533 m_hide = popHidden();
534 if (!m_hide) m_t << "</programlisting>";
535 }
536 else
537 {
538 if (!m_hide) m_t << "\n";
539 }
540}
541
543{
545 if (m_hide) return;
546
547 if (f.isInline()) m_t << "<inlinemediaobject>\n";
548 else m_t << " <mediaobject>\n";
549 m_t << " <imageobject>\n";
550 m_t << " <imagedata ";
551 m_t << "align=\"center\" valign=\"middle\" scalefit=\"0\" fileref=\"" << f.relPath() << f.name() << ".png\"/>\n";
552 m_t << " </imageobject>\n";
553 if (f.isInline()) m_t << "</inlinemediaobject>\n";
554 else m_t << " </mediaobject>\n";
555}
556
558{
560 if (m_hide) return;
561 m_t << "<indexterm><primary>";
562 filter(ie.entry());
563 m_t << "</primary></indexterm>\n";
564}
565
567{
569 // m_t << "<simplesect/>";
570}
571
573{
575 if (m_hide) return;
576 auto opt = cite.option();
577 if (!cite.file().empty())
578 {
579 if (!opt.noCite()) startLink(cite.file(),filterId(cite.anchor()));
580
581 filter(cite.getText(), false, true);
582
583 if (!opt.noCite()) endLink();
584 }
585 else
586 {
587 if (!opt.noPar()) filter("[");
588 filter(cite.target());
589 if (!opt.noPar()) filter("]");
590
591 }
592
593}
594
595//--------------------------------------
596// visitor functions for compound nodes
597//--------------------------------------
598
600{
602 if (m_hide) return;
603 if (l.isEnumList())
604 {
605 m_t << "<orderedlist>\n";
606 }
607 else
608 {
609 m_t << "<itemizedlist>\n";
610 }
611 visitChildren(l);
612 if (l.isEnumList())
613 {
614 m_t << "</orderedlist>\n";
615 }
616 else
617 {
618 m_t << "</itemizedlist>\n";
619 }
620}
621
623{
625 if (m_hide) return;
626 switch (li.itemNumber())
627 {
628 case DocAutoList::Unchecked: // unchecked
629 m_t << "<listitem override=\"unchecked\">";
630 break;
631 case DocAutoList::Checked_x: // checked with x
632 case DocAutoList::Checked_X: // checked with X
633 m_t << "<listitem override=\"checked\">";
634 break;
635 default:
636 m_t << "<listitem>";
637 break;
638 }
639 visitChildren(li);
640 m_t << "</listitem>";
641}
642
644{
646 if (m_hide) return;
647 m_t << "\n";
648 m_t << "<para>";
649 visitChildren(p);
650 m_t << "</para>";
651 m_t << "\n";
652}
653
659
661{
663 if (m_hide) return;
664 switch(s.type())
665 {
667 if (m_insidePre)
668 {
669 m_t << "<formalpara><title>" << theTranslator->trSeeAlso() << "</title>\n";
670 }
671 else
672 {
673 m_t << "<formalpara><title>" << DocbookGenerator::convertToDocbook(theTranslator->trSeeAlso()) << "</title>\n";
674 }
675 break;
677 if (m_insidePre)
678 {
679 m_t << "<formalpara><title>" << theTranslator->trReturns()<< "</title>\n";
680 }
681 else
682 {
683 m_t << "<formalpara><title>" << DocbookGenerator::convertToDocbook(theTranslator->trReturns()) << "</title>\n";
684 }
685 break;
687 if (m_insidePre)
688 {
689 m_t << "<formalpara><title>" << theTranslator->trAuthor(true, true) << "</title>\n";
690 }
691 else
692 {
693 m_t << "<formalpara><title>" << DocbookGenerator::convertToDocbook(theTranslator->trAuthor(true, true)) << "</title>\n";
694 }
695 break;
697 if (m_insidePre)
698 {
699 m_t << "<formalpara><title>" << theTranslator->trAuthor(true, false) << "</title>\n";
700 }
701 else
702 {
703 m_t << "<formalpara><title>" << DocbookGenerator::convertToDocbook(theTranslator->trAuthor(true, false)) << "</title>\n";
704 }
705 break;
707 if (m_insidePre)
708 {
709 m_t << "<formalpara><title>" << theTranslator->trVersion() << "</title>\n";
710 }
711 else
712 {
713 m_t << "<formalpara><title>" << DocbookGenerator::convertToDocbook(theTranslator->trVersion()) << "</title>\n";
714 }
715 break;
717 if (m_insidePre)
718 {
719 m_t << "<formalpara><title>" << theTranslator->trSince() << "</title>\n";
720 }
721 else
722 {
723 m_t << "<formalpara><title>" << DocbookGenerator::convertToDocbook(theTranslator->trSince()) << "</title>\n";
724 }
725 break;
727 if (m_insidePre)
728 {
729 m_t << "<formalpara><title>" << theTranslator->trDate() << "</title>\n";
730 }
731 else
732 {
733 m_t << "<formalpara><title>" << DocbookGenerator::convertToDocbook(theTranslator->trDate()) << "</title>\n";
734 }
735 break;
737 if (m_insidePre)
738 {
739 m_t << "<note><title>" << theTranslator->trNote() << "</title>\n";
740 }
741 else
742 {
743 m_t << "<note><title>" << DocbookGenerator::convertToDocbook(theTranslator->trNote()) << "</title>\n";
744 }
745 break;
747 if (m_insidePre)
748 {
749 m_t << "<warning><title>" << theTranslator->trWarning() << "</title>\n";
750 }
751 else
752 {
753 m_t << "<warning><title>" << DocbookGenerator::convertToDocbook(theTranslator->trWarning()) << "</title>\n";
754 }
755 break;
757 if (m_insidePre)
758 {
759 m_t << "<formalpara><title>" << theTranslator->trPrecondition() << "</title>\n";
760 }
761 else
762 {
763 m_t << "<formalpara><title>" << DocbookGenerator::convertToDocbook(theTranslator->trPrecondition()) << "</title>\n";
764 }
765 break;
767 if (m_insidePre)
768 {
769 m_t << "<formalpara><title>" << theTranslator->trPostcondition() << "</title>\n";
770 }
771 else
772 {
773 m_t << "<formalpara><title>" << DocbookGenerator::convertToDocbook(theTranslator->trPostcondition()) << "</title>\n";
774 }
775 break;
777 if (m_insidePre)
778 {
779 m_t << "<formalpara><title>" << theTranslator->trCopyright() << "</title>\n";
780 }
781 else
782 {
783 m_t << "<formalpara><title>" << DocbookGenerator::convertToDocbook(theTranslator->trCopyright()) << "</title>\n";
784 }
785 break;
787 if (m_insidePre)
788 {
789 m_t << "<formalpara><title>" << theTranslator->trInvariant() << "</title>\n";
790 }
791 else
792 {
793 m_t << "<formalpara><title>" << DocbookGenerator::convertToDocbook(theTranslator->trInvariant()) << "</title>\n";
794 }
795 break;
797 // <remark> is miising the <title> possibility
798 if (m_insidePre)
799 {
800 m_t << "<formalpara><title>" << theTranslator->trRemarks() << "</title>\n";
801 }
802 else
803 {
804 m_t << "<formalpara><title>" << DocbookGenerator::convertToDocbook(theTranslator->trRemarks()) << "</title>\n";
805 }
806 break;
808 if (m_insidePre)
809 {
810 m_t << "<caution><title>" << theTranslator->trAttention() << "</title>\n";
811 }
812 else
813 {
814 m_t << "<caution><title>" << DocbookGenerator::convertToDocbook(theTranslator->trAttention()) << "</title>\n";
815 }
816 break;
818 if (m_insidePre)
819 {
820 m_t << "<important><title>" << theTranslator->trImportant() << "</title>\n";
821 }
822 else
823 {
824 m_t << "<important><title>" << DocbookGenerator::convertToDocbook(theTranslator->trImportant()) << "</title>\n";
825 }
826 break;
830 if (s.hasTitle())
831 m_t << "<formalpara>\n";
832 else
833 m_t << "<para>\n";
834 break;
835 }
836
837 if (s.title())
838 {
839 std::visit(*this,*s.title());
840 }
841 visitChildren(s);
842
843 switch(s.type())
844 {
848 if (s.hasTitle())
849 m_t << "</formalpara>\n";
850 else
851 m_t << "</para>\n";
852 break;
854 m_t << "</note>\n";
855 break;
857 m_t << "</caution>\n";
858 break;
860 m_t << "</important>\n";
861 break;
863 m_t << "</warning>\n";
864 break;
865 default:
866 m_t << "</formalpara>\n";
867 break;
868 }
869}
870
872{
874 if (m_hide) return;
875 if (t.hasTitle()) m_t << "<title>";
876 visitChildren(t);
877 if (t.hasTitle()) m_t << "</title>";
878}
879
881{
883 if (m_hide) return;
884 m_t << "<itemizedlist>\n";
885 visitChildren(l);
886 m_t << "</itemizedlist>\n";
887}
888
890{
892 if (m_hide) return;
893 m_t << "<listitem>";
894 if (li.paragraph())
895 {
896 visit(*this,*li.paragraph());
897 }
898 m_t << "</listitem>\n";
899}
900
902{
904 if (m_hide) return;
905 m_t << "<section xml:id=\"_" << stripPath(s.file());
906 if (!s.anchor().empty()) m_t << "_1" << s.anchor();
907 m_t << "\">\n";
908 if (s.title())
909 {
910 std::visit(*this,*s.title());
911 }
912 visitChildren(s);
913 m_t << "</section>\n";
914}
915
917{
919 if (m_hide) return;
920 if (s.children().empty()) return;
921 // opening tag for ordered list will be handled in DocHtmlListItem
922 // due to (re-)numbering possibilities
923 if (s.type()!=DocHtmlList::Ordered)
924 m_t << "<itemizedlist>\n";
925 visitChildren(s);
926 if (s.type()==DocHtmlList::Ordered)
927 m_t << "</orderedlist>\n";
928 else
929 m_t << "</itemizedlist>\n";
930}
931
933{
935 if (m_hide) return;
936 const DocHtmlList *l = std::get_if<DocHtmlList>(s.parent());
937 if (l->type()==DocHtmlList::Ordered)
938 {
939 bool isFirst = &std::get<DocHtmlListItem>(l->children().front())==&s;
940 int value = 0;
941 DString type;
942 for (const auto &opt : s.attribs())
943 {
944 if (opt.name=="value")
945 {
946 bool ok = false;
947 int val = opt.value.toInt(&ok);
948 if (ok) value = val;
949 }
950 }
951
952 if (value>0 || isFirst)
953 {
954 for (const auto &opt : l->attribs())
955 {
956 if (opt.name=="type")
957 {
958 if (opt.value=="1")
959 type = " numeration=\"arabic\"";
960 else if (opt.value=="a")
961 type = " numeration=\"loweralpha\"";
962 else if (opt.value=="A")
963 type = " numeration=\"upperalpha\"";
964 else if (opt.value=="i")
965 type = " numeration=\"lowerroman\"";
966 else if (opt.value=="I")
967 type = " numeration=\"upperroman\"";
968 }
969 else if (value==0 && opt.name=="start")
970 {
971 bool ok = false;
972 int val = opt.value.toInt(&ok);
973 if (ok) value = val;
974 }
975 }
976 }
977
978 if (value>0 && !isFirst)
979 {
980 m_t << "</orderedlist>\n";
981 }
982 if (value>0 || isFirst)
983 {
984 m_t << "<orderedlist";
985 if (!type.empty()) m_t << type.data();
986 if (value>0) m_t << " startingnumber=\"" << value << "\"";
987 m_t << ">\n";
988 }
989 }
990 m_t << "<listitem>\n";
991 visitChildren(s);
992 m_t << "</listitem>\n";
993}
994
996{
998 if (m_hide) return;
999 m_t << "<variablelist>\n";
1000 visitChildren(l);
1001 m_t << "</variablelist>\n";
1002}
1003
1005{
1007 if (m_hide) return;
1008 m_t << "<varlistentry><term>";
1009 visitChildren(dt);
1010 m_t << "</term></varlistentry>\n";
1011}
1012
1014{
1016 if (m_hide) return;
1017 m_t << "<listitem>";
1018 visitChildren(dd);
1019 m_t << "</listitem>\n";
1020}
1021
1023{
1025 m_bodySet.push(false);
1026 if (m_hide) return;
1027 m_t << "<informaltable frame=\"all\">\n";
1028 m_t << " <tgroup cols=\"" << t.numColumns() << "\" align=\"left\" colsep=\"1\" rowsep=\"1\">\n";
1029 for (uint32_t i = 0; i <t.numColumns(); i++)
1030 {
1031 // do something with colwidth based of cell width specification (be aware of possible colspan in the header)?
1032 m_t << " <colspec colname='c" << i+1 << "'/>\n";
1033 }
1034 if (t.caption())
1035 {
1036 std::visit(*this,*t.caption());
1037 }
1038 visitChildren(t);
1039 if (m_bodySet.top()) m_t << " </tbody>\n";
1040 m_bodySet.pop();
1041 m_t << " </tgroup>\n";
1042 m_t << "</informaltable>\n";
1043}
1044
1046{
1048 m_colCnt = 0;
1049 if (m_hide) return;
1050
1051 if (tr.isHeading())
1052 {
1053 if (m_bodySet.top()) m_t << "</tbody>\n";
1054 m_bodySet.top() = false;
1055 m_t << "<thead>\n";
1056 }
1057 else if (!m_bodySet.top())
1058 {
1059 m_bodySet.top() = true;
1060 m_t << "<tbody>\n";
1061 }
1062
1063 m_t << " <row ";
1064
1065 for (const auto &opt : tr.attribs())
1066 {
1067 if (supportedHtmlAttribute(opt.name))
1068 {
1069 // process supported attributes only
1070 m_t << " " << opt.name << "='" << DocbookGenerator::convertToDocbook(opt.value) << "'";
1071 }
1072 }
1073 m_t << ">\n";
1074 visitChildren(tr);
1075 m_t << "</row>\n";
1076 if (tr.isHeading())
1077 {
1078 m_t << "</thead><tbody>\n";
1079 m_bodySet.top() = true;
1080 }
1081}
1082
1084{
1086 m_colCnt++;
1087 if (m_hide) return;
1088 m_t << "<entry";
1089
1090 for (const auto &opt : c.attribs())
1091 {
1092 if (opt.name=="colspan")
1093 {
1094 m_t << " namest='c" << m_colCnt << "'";
1095 int cols = opt.value.toInt();
1096 m_colCnt += (cols - 1);
1097 m_t << " nameend='c" << m_colCnt << "'";
1098 }
1099 else if (opt.name=="rowspan")
1100 {
1101 int extraRows = opt.value.toInt() - 1;
1102 m_t << " morerows='" << extraRows << "'";
1103 }
1104 else if (opt.name=="class")
1105 {
1106 if (opt.value.startsWith("markdownTable")) // handle markdown generated attributes
1107 {
1108 if (opt.value.endsWith("Right"))
1109 {
1110 m_t << " align='right'";
1111 }
1112 else if (opt.value.endsWith("Left"))
1113 {
1114 m_t << " align='left'";
1115 }
1116 else if (opt.value.endsWith("Center"))
1117 {
1118 m_t << " align='center'";
1119 }
1120 // skip 'markdownTable*' value ending with "None"
1121 }
1122 else
1123 {
1124 m_t << " class='" << DocbookGenerator::convertToDocbook(opt.value) << "'";
1125 }
1126 }
1127 else if (supportedHtmlAttribute(opt.name))
1128 {
1129 // process supported attributes only
1130 m_t << " " << opt.name << "='" << DocbookGenerator::convertToDocbook(opt.value) << "'";
1131 }
1132 }
1133 m_t << ">";
1134 visitChildren(c);
1135 m_t << "</entry>";
1136}
1137
1139{
1141 if (m_hide) return;
1142 m_t << "<caption>";
1143 if (!c.file().empty())
1144 {
1145 m_t << "<anchor xml:id=\"_" << stripPath(c.file()) << "_1" << filterId(c.anchor()) << "\"/>";
1146 }
1147 visitChildren(c);
1148 m_t << "</caption>\n";
1149}
1150
1152{
1154 if (m_hide) return;
1155 visitChildren(i);
1156}
1157
1159{
1161 if (m_hide) return;
1162 if (href.url().at(0) != '#')
1163 {
1164 m_t << "<link xlink:href=\"" << DocbookGenerator::convertToDocbook(href.url()) << "\">";
1165 }
1166 else
1167 {
1168 startLink(href.file(),filterId(href.url().mid(1)));
1169 }
1170 visitChildren(href);
1171 m_t << "</link>";
1172}
1173
1175{
1177 if (m_hide) return;
1178 m_t << "<para><emphasis role=\"bold\">";
1179 visitChildren(s);
1180 m_t << "</emphasis></para>";
1181}
1182
1184{
1186 if (m_hide) return;
1187 m_t << "\n";
1188 auto summary = d.summary();
1189 if (summary)
1190 {
1191 std::visit(*this,*summary);
1192 }
1193 m_t << "<para>";
1194 visitChildren(d);
1195 m_t << "</para>";
1196 m_t << "\n";
1197}
1198
1200{
1202 if (m_hide) return;
1203 m_t << "<formalpara><title>";
1204 visitChildren(h);
1205 m_t << "</title></formalpara>\n";
1206}
1207
1209{
1211 if (img.type()==DocImage::DocBook)
1212 {
1213 if (m_hide) return;
1214 m_t << "\n";
1215 DString baseName=stripPath(img.name());
1216 visitPreStart(m_t, img.children(), img.hasCaption(), img.relPath() + baseName, img.width(), img.height(), img.isInlineImage());
1217 visitChildren(img);
1219 DString file;
1220 bool ambig = false;
1221 FileDef *fd=Doxygen::imageNameLinkedMap->findFileDef( baseName, ambig);
1222 if (fd)
1223 {
1224 file=fd->absFilePath();
1225 }
1226 copyFile(file,Config_getString(DOCBOOK_OUTPUT)+"/"+baseName);
1227 }
1228 else // skip other formats
1229 {
1230 }
1231}
1232
1234{
1236 if (m_hide) return;
1237 bool exists = false;
1238 std::string inBuf;
1239 if (readInputFile(df.file(),inBuf))
1240 {
1241 auto fileName = writeInlineGraph(Config_getString(DOCBOOK_OUTPUT)+"/"+stripPath(df.file())+"_", // baseName
1242 ".dot", // extension
1243 inBuf, // contents
1244 exists);
1245 if (!fileName.empty())
1246 {
1247 startDotFile(fileName,df.relPath(),df.width(),df.height(),df.hasCaption(),df.children(),df.srcFile(),df.srcLine(),!exists);
1248 visitChildren(df);
1249 endDotFile(df.hasCaption());
1250 }
1251 }
1252}
1253
1255{
1257 if (m_hide) return;
1258 bool exists = false;
1259 std::string inBuf;
1260 if (readInputFile(df.file(),inBuf))
1261 {
1262 auto fileName = writeInlineGraph(Config_getString(DOCBOOK_OUTPUT)+"/"+stripPath(df.file())+"_", // baseName
1263 ".msc", // extension
1264 inBuf, // contents
1265 exists);
1266 if (!fileName.empty())
1267 {
1268 startMscFile(fileName,df.relPath(),df.width(),df.height(),df.hasCaption(),df.children(),df.srcFile(),df.srcLine(),!exists);
1269 visitChildren(df);
1270 endMscFile(df.hasCaption());
1271 }
1272 }
1273}
1274
1276{
1278 if (m_hide) return;
1279 bool exists = false;
1280 std::string inBuf;
1281 if (readInputFile(df.file(),inBuf))
1282 {
1283 auto fileName = writeInlineGraph(Config_getString(DOCBOOK_OUTPUT)+"/"+stripPath(df.file())+"_", // baseName
1284 ".dia", // extension
1285 inBuf, // contents
1286 exists);
1287 if (!fileName.empty())
1288 {
1289 startDiaFile(fileName,df.relPath(),df.width(),df.height(),df.hasCaption(),df.children(),df.srcFile(),df.srcLine(),!exists);
1290 visitChildren(df);
1291 endDiaFile(df.hasCaption());
1292 }
1293 }
1294}
1295
1297{
1299 if (m_hide) return;
1300 if (!Config_getBool(DOT_CLEANUP)) copyFile(df.file(),Config_getString(DOCBOOK_OUTPUT)+"/"+stripPath(df.file()));
1301 startPlantUmlFile(df.file(),df.relPath(),df.width(),df.height(),df.hasCaption(),df.children(),df.srcFile(),df.srcLine());
1302 visitChildren(df);
1304}
1305
1307{
1309 if (m_hide) return;
1310 if (Config_getBool(MERMAID_RENDER_MODE)==MERMAID_RENDER_MODE_t::CLIENT_SIDE) return;
1311 if (!Config_getBool(DOT_CLEANUP)) copyFile(df.file(),Config_getString(DOCBOOK_OUTPUT)+"/"+stripPath(df.file()));
1312 startMermaidFile(df.file(),df.relPath(),df.width(),df.height(),df.hasCaption(),df.children(),df.srcFile(),df.srcLine());
1313 visitChildren(df);
1315}
1316
1318{
1320 if (m_hide) return;
1321 startLink(lnk.file(),lnk.anchor());
1322 visitChildren(lnk);
1323 endLink();
1324}
1325
1327{
1329 if (m_hide) return;
1330 if (ref.isSubPage())
1331 {
1332 startLink(DString(),ref.anchor());
1333 }
1334 else
1335 {
1336 if (!ref.file().empty()) startLink(ref.file(),ref.anchor());
1337 }
1338
1339 if (!ref.hasLinkText()) filter(ref.targetTitle());
1340 visitChildren(ref);
1341 if (!ref.file().empty()) endLink();
1342}
1343
1345{
1347 if (m_hide) return;
1348 //m_t << "<tocentry xml:idref=\"_" << stripPath(ref->file()) << "_1" << ref->anchor() << "\">";
1349 m_t << "<tocentry>";
1350 visitChildren(ref);
1351 m_t << "</tocentry>\n";
1352}
1353
1355{
1357 if (m_hide) return;
1358 m_t << "<toc>\n";
1359 visitChildren(l);
1360 m_t << "</toc>\n";
1361}
1362
1364{
1366 if (m_hide) return;
1367 m_t << "\n";
1368 m_t << " <formalpara>\n";
1369 m_t << " <title>\n";
1370 switch(s.type())
1371 {
1376 default:
1377 ASSERT(0);
1378 }
1379 m_t << "</title>\n";
1380 m_t << " <para>\n";
1381 m_t << " <table frame=\"all\">\n";
1382 int ncols = 2;
1383 if (s.type() == DocParamSect::Param)
1384 {
1385 bool hasInOutSpecs = s.hasInOutSpecifier();
1386 bool hasTypeSpecs = s.hasTypeSpecifier();
1387 if (hasInOutSpecs && hasTypeSpecs) ncols += 2;
1388 else if (hasInOutSpecs || hasTypeSpecs) ncols += 1;
1389 }
1390 m_t << " <tgroup cols=\"" << ncols << "\" align=\"left\" colsep=\"1\" rowsep=\"1\">\n";
1391 for (int i = 1; i <= ncols; i++)
1392 {
1393 if (i == ncols) m_t << " <colspec colwidth=\"4*\"/>\n";
1394 else m_t << " <colspec colwidth=\"1*\"/>\n";
1395 }
1396 m_t << " <tbody>\n";
1397 visitChildren(s);
1398 m_t << " </tbody>\n";
1399 m_t << " </tgroup>\n";
1400 m_t << " </table>\n";
1401 m_t << " </para>\n";
1402 m_t << " </formalpara>\n";
1403 m_t << " ";
1404}
1405
1407{
1409 if (m_hide) return;
1410 m_t << " " << sep.chars() << " ";
1411}
1412
1414{
1416 if (m_hide) return;
1417 m_t << " <row>\n";
1418
1419 const DocParamSect *sect = std::get_if<DocParamSect>(pl.parent());
1420 if (sect && sect->hasInOutSpecifier())
1421 {
1422 m_t << "<entry>";
1424 {
1425 if (pl.direction()==DocParamSect::In)
1426 {
1427 m_t << "in";
1428 }
1429 else if (pl.direction()==DocParamSect::Out)
1430 {
1431 m_t << "out";
1432 }
1433 else if (pl.direction()==DocParamSect::InOut)
1434 {
1435 m_t << "in,out";
1436 }
1437 }
1438 m_t << "</entry>";
1439 }
1440
1441 if (sect && sect->hasTypeSpecifier())
1442 {
1443 m_t << "<entry>";
1444 for (const auto &type : pl.paramTypes())
1445 {
1446 std::visit(*this,type);
1447 }
1448 m_t << "</entry>";
1449 }
1450
1451 if (pl.parameters().empty())
1452 {
1453 m_t << "<entry></entry>\n";
1454 }
1455 else
1456 {
1457 m_t << "<entry>";
1458 int cnt = 0;
1459 for (const auto &param : pl.parameters())
1460 {
1461 if (cnt)
1462 {
1463 m_t << ", ";
1464 }
1465 std::visit(*this,param);
1466 cnt++;
1467 }
1468 m_t << "</entry>";
1469 }
1470 m_t << "<entry>";
1471 for (const auto &par : pl.paragraphs())
1472 {
1473 std::visit(*this,par);
1474 }
1475 m_t << "</entry>\n";
1476 m_t << " </row>\n";
1477}
1478
1480{
1482 if (m_hide) return;
1483 if (x.title().empty()) return;
1484 m_t << "<para><link linkend=\"_";
1485 m_t << stripPath(x.file()) << "_1" << x.anchor();
1486 m_t << "\">";
1487 filter(x.title());
1488 m_t << "</link>";
1489 m_t << " ";
1490 visitChildren(x);
1491 if (x.title().empty()) return;
1492 m_t << "</para>";
1493}
1494
1496{
1498 if (m_hide) return;
1499 startLink(ref.file(),ref.anchor());
1500 visitChildren(ref);
1501 endLink();
1502 m_t << " ";
1503}
1504
1506{
1508 visitChildren(t);
1509}
1510
1511
1513{
1515 if (m_hide) return;
1516 m_t << "<blockquote>";
1517 visitChildren(q);
1518 m_t << "</blockquote>";
1519}
1520
1522{
1524 // TODO: to be implemented
1525}
1526
1528{
1530 if (m_hide) return;
1531 visitChildren(b);
1532}
1533
1534
1535void DocbookDocVisitor::filter(const DString &str, bool retainNewLine, bool citeEntry)
1536{
1538 m_t << DocbookGenerator::convertToDocbook(str, retainNewLine, citeEntry);
1539}
1540
1541void DocbookDocVisitor::startLink(const DString &file,const DString &anchor)
1542{
1544 m_t << "<link linkend=\"_" << stripPath(file);
1545 if (!anchor.empty())
1546 {
1547 if (!file.empty()) m_t << "_1";
1548 m_t << anchor;
1549 }
1550 m_t << "\">";
1551}
1552
1554{
1556 m_t << "</link>";
1557}
1558
1559void DocbookDocVisitor::writeMscFile(const DString &fileName, const DocVerbatim &s, bool newFile)
1560{
1562 DString shortName = makeBaseName(fileName,".msc");
1563 DString outDir = Config_getString(DOCBOOK_OUTPUT);
1564 if (newFile) writeMscGraphFromFile(fileName,outDir,shortName,MscOutputFormat::BITMAP,s.srcFile(),s.srcLine(),false);
1565 visitPreStart(m_t, s.children(), s.hasCaption(), s.relPath() + shortName + ".png", s.width(), s.height());
1568}
1569
1571{
1573 DString shortName = stripPath(baseName);
1574 DString outDir = Config_getString(DOCBOOK_OUTPUT);
1576 visitPreStart(m_t, s.children(), s.hasCaption(), s.relPath() + shortName + ".png", s.width(),s.height());
1579}
1580
1582 const DString &relPath,
1583 const DString &width,
1584 const DString &height,
1585 bool hasCaption,
1586 const DocNodeList &children,
1587 const DString &srcFile,
1588 int srcLine
1589 )
1590{
1592 DString outDir = Config_getString(DOCBOOK_OUTPUT);
1593 std::string inBuf;
1594 readInputFile(fileName,inBuf);
1595 auto baseNameVector = PlantumlManager::instance().writePlantUMLSource(outDir,
1596 DString(),inBuf,PlantumlManager::PUML_BITMAP,DString(),srcFile,srcLine,false);
1597 bool first = true;
1598 for (const auto &bName: baseNameVector)
1599 {
1600 DString baseName=makeBaseName(bName,".pu");
1602 if (!first) endPlantUmlFile(hasCaption);
1603 first = false;
1604 m_t << "<para>\n";
1605 visitPreStart(m_t, children, hasCaption, relPath + baseName + ".png", width, height);
1606 }
1607}
1608
1610{
1612 if (m_hide) return;
1613 m_t << "\n";
1614 visitPostEnd(m_t, hasCaption);
1615 m_t << "</para>\n";
1616}
1617
1619{
1621 if (Config_getBool(MERMAID_RENDER_MODE)==MERMAID_RENDER_MODE_t::CLIENT_SIDE) return;
1622 auto shortName = stripPath(baseName);
1623 auto outDir = Config_getString(DOCBOOK_OUTPUT);
1624 auto outputFormat = MermaidManager::OutputFormat::Docbook;
1625 auto imageFormat = MermaidManager::convertToImageFormat(outputFormat);
1626 auto imgExt = MermaidManager::imageExtension(imageFormat);
1627 MermaidManager::instance().generateMermaidOutput(baseName,outDir,imageFormat,false);
1628 visitPreStart(m_t, s.children(), s.hasCaption(), s.relPath() + shortName + "." + imgExt, s.width(),s.height());
1631}
1632
1634 const DString &relPath,
1635 const DString &width,
1636 const DString &height,
1637 bool hasCaption,
1638 const DocNodeList &children,
1639 const DString &srcFile,
1640 int srcLine
1641 )
1642{
1644 if (Config_getBool(MERMAID_RENDER_MODE)==MERMAID_RENDER_MODE_t::CLIENT_SIDE) return;
1645 DString outDir = Config_getString(DOCBOOK_OUTPUT);
1646 std::string inBuf;
1647 readInputFile(fileName,inBuf);
1648 auto outputFormat = MermaidManager::OutputFormat::Docbook;
1649 auto imageFormat = MermaidManager::convertToImageFormat(outputFormat);
1650 auto imgExt = MermaidManager::imageExtension(imageFormat);
1651 auto baseName = MermaidManager::instance().writeMermaidSource(outDir,DString(),inBuf,imageFormat,srcFile,srcLine);
1652 auto shortName = stripPath(baseName);
1653 MermaidManager::instance().generateMermaidOutput(baseName,outDir,imageFormat,false);
1654 m_t << "<para>\n";
1655 visitPreStart(m_t, children, hasCaption, relPath + shortName + "." + imgExt, width, height);
1656}
1657
1659{
1661 if (m_hide) return;
1662 m_t << "\n";
1663 visitPostEnd(m_t, hasCaption);
1664 m_t << "</para>\n";
1665}
1666
1668 const DString &relPath,
1669 const DString &width,
1670 const DString &height,
1671 bool hasCaption,
1672 const DocNodeList &children,
1673 const DString &srcFile,
1674 int srcLine, bool newFile
1675 )
1676{
1678 DString baseName=makeBaseName(fileName,".msc");
1679 baseName.prepend("msc_");
1680 DString outDir = Config_getString(DOCBOOK_OUTPUT);
1681 if (newFile) writeMscGraphFromFile(fileName,outDir,baseName,MscOutputFormat::BITMAP,srcFile,srcLine,false);
1682 m_t << "<para>\n";
1683 visitPreStart(m_t, children, hasCaption, relPath + baseName + ".png", width, height);
1684}
1685
1687{
1689 if (m_hide) return;
1690 visitPostEnd(m_t, hasCaption);
1691 m_t << "</para>\n";
1692}
1693
1695{
1697 DString shortName = stripPath(baseName);
1698 DString outDir = Config_getString(DOCBOOK_OUTPUT);
1699 writeDiaGraphFromFile(baseName+".dia",outDir,shortName,DiaOutputFormat::BITMAP,s.srcFile(),s.srcLine(),false);
1700 visitPreStart(m_t, s.children(), s.hasCaption(), shortName, s.width(),s.height());
1703}
1704
1706 const DString &relPath,
1707 const DString &width,
1708 const DString &height,
1709 bool hasCaption,
1710 const DocNodeList &children,
1711 const DString &srcFile,
1712 int srcLine, bool newFile
1713 )
1714{
1716 DString baseName=makeBaseName(fileName,".dia");
1717 baseName.prepend("dia_");
1718 DString outDir = Config_getString(DOCBOOK_OUTPUT);
1719 if (newFile) writeDiaGraphFromFile(fileName,outDir,baseName,DiaOutputFormat::BITMAP,srcFile,srcLine,false);
1720 m_t << "<para>\n";
1721 visitPreStart(m_t, children, hasCaption, relPath + baseName + ".png", width, height);
1722}
1723
1725{
1727 if (m_hide) return;
1728 visitPostEnd(m_t, hasCaption);
1729 m_t << "</para>\n";
1730}
1731
1732void DocbookDocVisitor::writeDotFile(const DString &fileName, const DocVerbatim &s, bool newFile)
1733{
1735 DString shortName = makeBaseName(fileName,".dot");
1736 DString outDir = Config_getString(DOCBOOK_OUTPUT);
1737 if (newFile) writeDotGraphFromFile(fileName,outDir,shortName,GraphOutputFormat::BITMAP,s.srcFile(),s.srcLine(),false);
1738 visitPreStart(m_t, s.children(), s.hasCaption(), s.relPath() + shortName + "." + getDotImageExtension(), s.width(),s.height());
1741}
1742
1744 const DString &relPath,
1745 const DString &width,
1746 const DString &height,
1747 bool hasCaption,
1748 const DocNodeList &children,
1749 const DString &srcFile,
1750 int srcLine, bool newFile
1751 )
1752{
1754 DString baseName=makeBaseName(fileName,".dot");
1755 baseName.prepend("dot_");
1756 DString outDir = Config_getString(DOCBOOK_OUTPUT);
1757 DString imgExt = getDotImageExtension();
1758 if (newFile) writeDotGraphFromFile(fileName,outDir,baseName,GraphOutputFormat::BITMAP,srcFile,srcLine,false);
1759 m_t << "<para>\n";
1760 visitPreStart(m_t, children, hasCaption, relPath + baseName + "." + imgExt, width, height);
1761}
1762
1764{
1766 if (m_hide) return;
1767 m_t << "\n";
1768 visitPostEnd(m_t, hasCaption);
1769 m_t << "</para>\n";
1770}
1771
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:89
DString()=default
DString mid(size_t index, size_t len=npos) const
Definition dstring.h:323
bool empty() const
Returns true iff the string is empty (std::string compatible alias for isEmpty()).
Definition dstring.h:153
char & at(size_t i)
Returns a reference to the character at index i.
Definition dstring.h:675
void reserve(size_t size)
Reserve space for size bytes without changing the string contents.
Definition dstring.h:222
const std::string & str() const
Definition dstring.h:634
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:162
size_t length() const
Returns the length of the string, not counting the 0-terminator.
Definition dstring.h:156
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:976
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
DocNodeList & children()
Definition docnode.h:143
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
DString relPath() const
Definition docnode.h:686
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 relPath() const
Definition docnode.h:534
bool isInline() const
Definition docnode.h:536
DString name() const
Definition docnode.h:532
Node representing a Hypertext reference.
Definition docnode.h:832
DString file() const
Definition docnode.h:840
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
const HtmlAttribList & attribs() const
Definition docnode.h:1210
Node representing a HTML description data.
Definition docnode.h:1186
Node representing a Html description list.
Definition docnode.h:910
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
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
bool isHeading() const
Definition docnode.cpp:2004
const HtmlAttribList & attribs() const
Definition docnode.h:1257
Node Html summary.
Definition docnode.h:853
Node representing a HTML table.
Definition docnode.h:1274
size_t numColumns() const
Definition docnode.h:1283
const DocNodeVariant * caption() const
Definition docnode.cpp:2252
Node representing an image.
Definition docnode.h:642
DString relPath() const
Definition docnode.h:652
Type type() const
Definition docnode.h:647
DString width() const
Definition docnode.h:650
DString name() const
Definition docnode.h:648
@ DocBook
Definition docnode.h:644
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 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:90
Node representing an block of paragraphs.
Definition docnode.h:988
Node representing a paragraph in the documentation tree.
Definition docnode.h:1089
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 file() const
Definition docnode.h:791
bool isSubPage() const
Definition docnode.h:801
DString anchor() const
Definition docnode.h:794
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
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
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
bool hasTitle() const
Definition docnode.cpp:3147
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
bool hasTitle() const
Definition docnode.h:613
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
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
DString relPath() const
Definition docnode.h:387
@ 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
void endDiaFile(bool hasCaption)
void operator()(const DocWord &)
void startPlantUmlFile(const DString &fileName, const DString &relPath, const DString &width, const DString &height, bool hasCaption, const DocNodeList &children, const DString &srcFile, int srcLine)
void startDiaFile(const DString &fileName, const DString &relPath, const DString &width, const DString &height, bool hasCaption, const DocNodeList &children, const DString &srcFile, int srcLine, bool newFile=true)
void visitChildren(const T &t)
void visitPreStart(TextStream &t, const DocNodeList &children, bool hasCaption, const DString &name, const DString &width, const DString &height, bool inlineImage=false)
void endMermaidFile(bool hasCaption)
void writeMermaidFile(const DString &fileName, const DocVerbatim &s)
void startMermaidFile(const DString &fileName, const DString &relPath, const DString &width, const DString &height, bool hasCaption, const DocNodeList &children, const DString &srcFile, int srcLine)
OutputCodeList & m_ci
void endPlantUmlFile(bool hasCaption)
void visitCaption(const DocNodeList &children)
void writeDotFile(const DString &fileName, const DocVerbatim &s, bool newFile=true)
void endDotFile(bool hasCaption)
void startDotFile(const DString &fileName, const DString &relPath, const DString &width, const DString &height, bool hasCaption, const DocNodeList &children, const DString &srcFile, int srcLine, bool newFile=true)
DocbookDocVisitor(TextStream &t, OutputCodeList &ci, const DString &langExt)
void visitPostEnd(TextStream &t, bool hasCaption, bool inlineImage=false)
void startLink(const DString &file, const DString &anchor)
void endMscFile(bool hasCaption)
void startMscFile(const DString &fileName, const DString &relPath, const DString &width, const DString &height, bool hasCaption, const DocNodeList &children, const DString &srcFile, int srcLine, bool newFile=true)
void filter(const DString &str, bool retainNewLine=false, bool citeEntry=false)
void writePlantUMLFile(const DString &fileName, const DocVerbatim &s)
void writeDiaFile(const DString &fileName, const DocVerbatim &s)
void writeMscFile(const DString &fileName, const DocVerbatim &s, bool newFile=true)
static DString convertToDocbook(const DString &s, bool retainNewline=false, bool citeEntry=false)
static FileNameLinkedMap * imageNameLinkedMap
Definition doxygen.h:105
const char * unicode(int index) const
Access routine to the unicode sequence for the Emoji entity.
Definition emoji.cpp:2016
static EmojiEntityMapper & instance()
Returns the one and only instance of the Emoji entity mapper.
Definition emoji.cpp:1978
A model of a file symbol.
Definition filedef.h:99
virtual DString absFilePath() const =0
Minimal replacement for QFileInfo.
Definition fileinfo.h:23
std::string fileName() const
Definition fileinfo.cpp:118
std::string dirPath(bool absPath=true) const
Definition fileinfo.cpp:137
FileDef * findFileDef(const DString &n, bool &ambig) const
Returns the file definition in fnMap that matches the file name n.
Definition filename.cpp:36
bool empty() const
checks whether the container is empty
Definition growvector.h:140
T & front()
access the first element
Definition growvector.h:130
static HtmlEntityMapper & instance()
Returns the one and only instance of the HTML entity mapper.
const char * docbook(SymType symb) const
Access routine to the docbook code of the HTML entity.
static MermaidManager & instance()
Definition mermaid.cpp:33
static DString imageExtension(ImageFormat imageFormat)
Definition mermaid.cpp:43
static ImageFormat convertToImageFormat(OutputFormat outputFormat)
Definition mermaid.cpp:54
void generateMermaidOutput(const DString &baseName, const DString &outDir, ImageFormat format, bool toIndex)
Register a generated Mermaid image with the index.
Definition mermaid.cpp:116
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:70
Class representing a list of different code generators.
Definition outputlist.h:166
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
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 trInvariant()=0
virtual DString trRemarks()=0
virtual DString trDate()=0
virtual DString trSeeAlso()=0
virtual DString trPostcondition()=0
#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
static DString filterId(const DString &s)
#define DB_VIS_C
static bool supportedHtmlAttribute(const DString &name)
void writeDotGraphFromFile(const DString &inFile, const DString &outDir, const DString &outFile, GraphOutputFormat format, const DString &srcFile, int srcLine, bool toIndex)
Definition dot.cpp:196
#define ASSERT(x)
Definition dstring.h:29
std::unique_ptr< FileDef > createFileDef(const DString &p, const DString &n, const DString &ref, const DString &dn)
Definition filedef.cpp:268
Translator * theTranslator
Definition language.cpp:71
#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
Portable versions of functions that are platform dependent.
Options to configure the code parser.
Definition parserintf.h:78
CodeParserOptions & setStartLine(int lineNr)
Definition parserintf.h:101
CodeParserOptions & setShowLineNumbers(bool enable)
Definition parserintf.h:113
CodeParserOptions & setFileDef(const FileDef *fd)
Definition parserintf.h:98
SrcLangExt
Definition types.h:207
DString writeInlineGraph(const DString &baseName, const DString &extension, const DString &content, bool &exists)
Definition util.cpp:6023
DString getFileNameExtension(const DString &fn)
Definition util.cpp:4446
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:4742
SrcLangExt getLanguageFromFileName(const DString &fileName, SrcLangExt defLang)
Definition util.cpp:4404
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:5047
DString getDotImageExtension()
Definition util.cpp:5498
DString makeBaseName(const DString &name, const DString &ext)
Definition util.cpp:4171
DString stripPath(const DString &s)
Definition util.cpp:4157
SrcLangExt getLanguageFromCodeLang(DString &fileName)
Routine to handle the language attribute of the \code command.
Definition util.cpp:4422
A bunch of utility functions.