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