1 /******************************************************************************
6 * Copyright (C) 1997-2014 by Dimitri van Heesch.
8 * Permission to use, copy, modify, and distribute this software and its
9 * documentation under the terms of the GNU General Public License is hereby
10 * granted. No representations are made about the suitability of this software
11 * for any purpose. It is provided "as is" without express or implied warranty.
12 * See the GNU General Public License for more details.
14 * Documents produced by Doxygen are derivative works derived from the
15 * input used in their production; they are not affected by this license.
19 #include <qfileinfo.h>
21 #include "docbookvisitor.h"
22 #include "docparser.h"
25 #include "outputgen.h"
26 #include "docbookgen.h"
30 #include "parserintf.h"
36 #include "htmlentity.h"
39 DocbookDocVisitor::DocbookDocVisitor(FTextStream &t,CodeOutputInterface &ci)
40 : DocVisitor(DocVisitor_Docbook), m_t(t), m_ci(ci), m_insidePre(FALSE), m_hide(FALSE)
44 //--------------------------------------
45 // visitor functions for leaf nodes
46 //--------------------------------------
48 void DocbookDocVisitor::visit(DocWord *w)
54 void DocbookDocVisitor::visit(DocLinkedWord *w)
57 startLink(w->file(),w->anchor());
62 void DocbookDocVisitor::visit(DocWhiteSpace *w)
75 void DocbookDocVisitor::visit(DocSymbol *s)
78 const char *res = HtmlEntityMapper::instance()->docbook(s->symbol());
85 err("DocBook: non supported HTML-entity found: %s\n",HtmlEntityMapper::instance()->html(s->symbol(),TRUE));
89 void DocbookDocVisitor::visit(DocURL *u)
92 m_t << "<link xlink:href=\"";
93 if (u->isEmail()) m_t << "mailto:";
100 void DocbookDocVisitor::visit(DocLineBreak *)
103 m_t << endl << "<literallayout>\n</literallayout>" << endl;
106 void DocbookDocVisitor::visit(DocHorRuler *)
109 m_t << "<informaltable frame='bottom'><tgroup cols='1'><colspec align='center'/><tbody><row><entry align='center'>\n";
110 m_t << "</entry></row></tbody></tgroup></informaltable>\n";
113 void DocbookDocVisitor::visit(DocStyleChange *s)
118 case DocStyleChange::Bold:
119 if (s->enable()) m_t << "<emphasis role=\"bold\">"; else m_t << "</emphasis>";
121 case DocStyleChange::Italic:
122 if (s->enable()) m_t << "<emphasis>"; else m_t << "</emphasis>";
124 case DocStyleChange::Code:
125 if (s->enable()) m_t << "<computeroutput>"; else m_t << "</computeroutput>";
127 case DocStyleChange::Subscript:
128 if (s->enable()) m_t << "<subscript>"; else m_t << "</subscript>";
130 case DocStyleChange::Superscript:
131 if (s->enable()) m_t << "<superscript>"; else m_t << "</superscript>";
133 case DocStyleChange::Center:
134 if (s->enable()) m_t << "<informaltable frame='none'><tgroup cols='1'><colspec align='center'/><tbody><row><entry align='center'>";
135 else m_t << "</entry></row></tbody></tgroup></informaltable>";
137 case DocStyleChange::Preformatted:
140 m_t << "<literallayout>";
145 m_t << "</literallayout>";
149 /* There is no equivalent Docbook tag for rendering Small text */
150 case DocStyleChange::Small: /* XSLT Stylesheets can be used */ break;
152 case DocStyleChange::Div: /* HTML only */ break;
153 case DocStyleChange::Span: /* HTML only */ break;
157 void DocbookDocVisitor::visit(DocVerbatim *s)
160 SrcLangExt langExt = getLanguageFromFileName(m_langExt);
163 case DocVerbatim::Code: // fall though
164 m_t << "<literallayout><computeroutput>";
165 Doxygen::parserManager->getParser(m_langExt)
166 ->parseCode(m_ci,s->context(),s->text(),langExt,
167 s->isExample(),s->exampleFile());
168 m_t << "</computeroutput></literallayout>";
170 case DocVerbatim::Verbatim:
171 m_t << "<literallayout>";
173 m_t << "</literallayout>";
175 case DocVerbatim::HtmlOnly:
177 case DocVerbatim::RtfOnly:
179 case DocVerbatim::ManOnly:
181 case DocVerbatim::LatexOnly:
183 case DocVerbatim::XmlOnly:
185 case DocVerbatim::DocbookOnly:
189 case DocVerbatim::Dot:
191 static int dotindex = 1;
192 QCString baseName(4096);
194 QCString stext = s->text();
195 m_t << "<para>" << endl;
196 name.sprintf("%s%d", "dot_inline_dotgraph_", dotindex);
197 baseName.sprintf("%s%d",
198 (Config_getString("DOCBOOK_OUTPUT")+"/inline_dotgraph_").data(),
201 QFile file(baseName+".dot");
202 if (!file.open(IO_WriteOnly))
204 err("Could not open file %s.msc for writing\n",baseName.data());
206 file.writeBlock( stext, stext.length() );
208 m_t << " <figure>" << endl;
209 m_t << " <title>" << name << "</title>" << endl;
210 m_t << " <mediaobject>" << endl;
211 m_t << " <imageobject>" << endl;
212 writeDotFile(baseName);
213 m_t << " </imageobject>" << endl;
214 m_t << " </mediaobject>" << endl;
215 m_t << " </figure>" << endl;
216 m_t << "</para>" << endl;
219 case DocVerbatim::Msc:
221 static int mscindex = 1;
222 QCString baseName(4096);
224 QCString stext = s->text();
225 m_t << "<para>" << endl;
226 name.sprintf("%s%d", "msc_inline_mscgraph_", mscindex);
227 baseName.sprintf("%s%d",
228 (Config_getString("DOCBOOK_OUTPUT")+"/inline_mscgraph_").data(),
231 QFile file(baseName+".msc");
232 if (!file.open(IO_WriteOnly))
234 err("Could not open file %s.msc for writing\n",baseName.data());
236 QCString text = "msc {";
239 file.writeBlock( text, text.length() );
241 m_t << " <figure>" << endl;
242 m_t << " <title>" << name << "</title>" << endl;
243 m_t << " <mediaobject>" << endl;
244 m_t << " <imageobject>" << endl;
245 writeMscFile(baseName);
246 m_t << " </imageobject>" << endl;
247 m_t << " </mediaobject>" << endl;
248 m_t << " </figure>" << endl;
249 m_t << "</para>" << endl;
252 case DocVerbatim::PlantUML:
254 static QCString docbookOutput = Config_getString("DOCBOOK_OUTPUT");
255 QCString baseName = writePlantUMLSource(docbookOutput,s->exampleFile(),s->text());
256 QCString shortName = baseName;
258 if ((i=shortName.findRev('/'))!=-1)
260 shortName=shortName.right(shortName.length()-i-1);
262 m_t << " <figure>" << endl;
263 m_t << " <title>" << shortName << "</title>" << endl;
264 m_t << " <mediaobject>" << endl;
265 m_t << " <imageobject>" << endl;
266 writePlantUMLFile(baseName);
267 m_t << " </imageobject>" << endl;
268 m_t << " </mediaobject>" << endl;
269 m_t << " </figure>" << endl;
270 m_t << "</para>" << endl;
276 void DocbookDocVisitor::visit(DocAnchor *anc)
279 m_t << "<anchor id=\"" << anc->file() << "_1" << anc->anchor() << "\"/>";
282 void DocbookDocVisitor::visit(DocInclude *inc)
285 SrcLangExt langExt = getLanguageFromFileName(inc->extension());
288 case DocInclude::IncWithLines:
290 m_t << "<literallayout><computeroutput>";
291 QFileInfo cfi( inc->file() );
292 FileDef fd( cfi.dirPath().utf8(), cfi.fileName().utf8() );
293 Doxygen::parserManager->getParser(inc->extension())
294 ->parseCode(m_ci,inc->context(),
298 inc->exampleFile(), &fd);
299 m_t << "</computeroutput></literallayout>";
302 case DocInclude::Include:
303 m_t << "<literallayout><computeroutput>";
304 Doxygen::parserManager->getParser(inc->extension())
305 ->parseCode(m_ci,inc->context(),
310 m_t << "</computeroutput></literallayout>";
312 case DocInclude::DontInclude:
314 case DocInclude::HtmlInclude:
316 case DocInclude::LatexInclude:
318 case DocInclude::VerbInclude:
321 m_t << "</verbatim>";
323 case DocInclude::Snippet:
324 m_t << "<literallayout><computeroutput>";
325 Doxygen::parserManager->getParser(inc->extension())
328 extractBlock(inc->text(),inc->blockId()),
333 m_t << "</computeroutput></literallayout>";
338 void DocbookDocVisitor::visit(DocIncOperator *op)
344 m_t << "<programlisting>";
349 SrcLangExt langExt = getLanguageFromFileName(m_langExt);
350 if (op->type()!=DocIncOperator::Skip)
355 Doxygen::parserManager->getParser(m_langExt)
356 ->parseCode(m_ci,op->context(),
357 op->text(),langExt,op->isExample(),
366 if (!m_hide) m_t << "</programlisting>";
370 if (!m_hide) m_t << endl;
374 void DocbookDocVisitor::visit(DocFormula *f)
377 m_t << "<equation><title>" << f->name() << "</title>";
379 m_t << "</equation>";
382 void DocbookDocVisitor::visit(DocIndexEntry *ie)
385 m_t << "<indexentry><primaryie>" << endl;
387 m_t << "</primaryie><secondaryie></secondaryie></indexentry>" << endl;
390 void DocbookDocVisitor::visit(DocSimpleSectSep *)
392 m_t << "<simplesect/>";
395 void DocbookDocVisitor::visit(DocCite *cite)
398 if (!cite->file().isEmpty()) startLink(cite->file(),cite->anchor());
399 filter(cite->text());
400 if (!cite->file().isEmpty()) endLink();
403 //--------------------------------------
404 // visitor functions for compound nodes
405 //--------------------------------------
407 void DocbookDocVisitor::visitPre(DocAutoList *l)
412 m_t << "<orderedlist>\n";
416 m_t << "<itemizedlist>\n";
420 void DocbookDocVisitor::visitPost(DocAutoList *l)
425 m_t << "</orderedlist>\n";
429 m_t << "</itemizedlist>\n";
433 void DocbookDocVisitor::visitPre(DocAutoListItem *)
439 void DocbookDocVisitor::visitPost(DocAutoListItem *)
442 m_t << "</listitem>";
445 void DocbookDocVisitor::visitPre(DocPara *)
452 void DocbookDocVisitor::visitPost(DocPara *)
459 void DocbookDocVisitor::visitPre(DocRoot *)
461 //m_t << "<hr><h4><font color=\"red\">New parser:</font></h4>\n";
464 void DocbookDocVisitor::visitPost(DocRoot *)
466 //m_t << "<hr><h4><font color=\"red\">Old parser:</font></h4>\n";
469 void DocbookDocVisitor::visitPre(DocSimpleSect *s)
474 case DocSimpleSect::See:
477 m_t << "<formalpara><title>" << theTranslator->trSeeAlso() << ": </title>" << endl;
481 m_t << "<formalpara><title>" << convertToXML(theTranslator->trSeeAlso()) << ": </title>" << endl;
484 case DocSimpleSect::Return:
487 m_t << "<formalpara><title>" << theTranslator->trReturns()<< ": </title>" << endl;
491 m_t << "<formalpara><title>" << convertToXML(theTranslator->trReturns()) << ": </title>" << endl;
494 case DocSimpleSect::Author:
497 m_t << "<formalpara><title>" << theTranslator->trAuthor(TRUE, TRUE) << ": </title>" << endl;
501 m_t << "<formalpara><title>" << convertToXML(theTranslator->trAuthor(TRUE, TRUE)) << ": </title>" << endl;
504 case DocSimpleSect::Authors:
507 m_t << "<formalpara><title>" << theTranslator->trAuthor(TRUE, FALSE) << ": </title>" << endl;
511 m_t << "<formalpara><title>" << convertToXML(theTranslator->trAuthor(TRUE, FALSE)) << ": </title>" << endl;
514 case DocSimpleSect::Version:
517 m_t << "<formalpara><title>" << theTranslator->trVersion() << ": </title>" << endl;
521 m_t << "<formalpara><title>" << convertToXML(theTranslator->trVersion()) << ": </title>" << endl;
524 case DocSimpleSect::Since:
527 m_t << "<formalpara><title>" << theTranslator->trSince() << ": </title>" << endl;
531 m_t << "<formalpara><title>" << convertToXML(theTranslator->trSince()) << ": </title>" << endl;
534 case DocSimpleSect::Date:
537 m_t << "<formalpara><title>" << theTranslator->trDate() << ": </title>" << endl;
541 m_t << "<formalpara><title>" << convertToXML(theTranslator->trDate()) << ": </title>" << endl;
544 case DocSimpleSect::Note:
547 m_t << "<formalpara><title>" << theTranslator->trNote() << ": </title>" << endl;
551 m_t << "<formalpara><title>" << convertToXML(theTranslator->trNote()) << ": </title>" << endl;
554 case DocSimpleSect::Warning:
557 m_t << "<formalpara><title>" << theTranslator->trWarning() << ": </title>" << endl;
561 m_t << "<formalpara><title>" << convertToXML(theTranslator->trWarning()) << ": </title>" << endl;
564 case DocSimpleSect::Pre:
567 m_t << "<formalpara><title>" << theTranslator->trPrecondition() << ": </title>" << endl;
571 m_t << "<formalpara><title>" << convertToXML(theTranslator->trPrecondition()) << ": </title>" << endl;
574 case DocSimpleSect::Post:
577 m_t << "<formalpara><title>" << theTranslator->trPostcondition() << ": </title>" << endl;
581 m_t << "<formalpara><title>" << convertToXML(theTranslator->trPostcondition()) << ": </title>" << endl;
584 case DocSimpleSect::Copyright:
587 m_t << "<formalpara><title>" << theTranslator->trCopyright() << ": </title>" << endl;
591 m_t << "<formalpara><title>" << convertToXML(theTranslator->trCopyright()) << ": </title>" << endl;
594 case DocSimpleSect::Invar:
597 m_t << "<formalpara><title>" << theTranslator->trInvariant() << ": </title>" << endl;
601 m_t << "<formalpara><title>" << convertToXML(theTranslator->trInvariant()) << ": </title>" << endl;
604 case DocSimpleSect::Remark:
607 m_t << "<formalpara><title>" << theTranslator->trRemarks() << ": </title>" << endl;
611 m_t << "<formalpara><title>" << convertToXML(theTranslator->trRemarks()) << ": </title>" << endl;
614 case DocSimpleSect::Attention:
617 m_t << "<formalpara><title>" << theTranslator->trAttention() << ": </title>" << endl;
621 m_t << "<formalpara><title>" << convertToXML(theTranslator->trAttention()) << ": </title>" << endl;
624 case DocSimpleSect::User:
625 m_t << "<formalpara><title></title>" << endl;
627 case DocSimpleSect::Rcs:
628 m_t << "<formalpara><title></title>" << endl;
630 case DocSimpleSect::Unknown: m_t << "<formalpara><title></title>" << endl; break;
634 void DocbookDocVisitor::visitPost(DocSimpleSect *)
637 m_t << "</formalpara>" << endl;
640 void DocbookDocVisitor::visitPre(DocTitle *)
646 void DocbookDocVisitor::visitPost(DocTitle *)
652 void DocbookDocVisitor::visitPre(DocSimpleList *)
655 m_t << "<itemizedlist>\n";
658 void DocbookDocVisitor::visitPost(DocSimpleList *)
661 m_t << "</itemizedlist>\n";
664 void DocbookDocVisitor::visitPre(DocSimpleListItem *)
670 void DocbookDocVisitor::visitPost(DocSimpleListItem *)
673 m_t << "</listitem>\n";
676 void DocbookDocVisitor::visitPre(DocSection *s)
679 m_t << "<section xml:id=\"" << s->file();
680 if (!s->anchor().isEmpty()) m_t << "_1" << s->anchor();
681 m_t << "\">" << endl;
684 m_t << "</title>" << endl;
687 void DocbookDocVisitor::visitPost(DocSection *)
689 m_t << "</section>\n";
692 void DocbookDocVisitor::visitPre(DocHtmlList *s)
695 if (s->type()==DocHtmlList::Ordered)
696 m_t << "<orderedlist>\n";
698 m_t << "<itemizedlist>\n";
701 void DocbookDocVisitor::visitPost(DocHtmlList *s)
704 if (s->type()==DocHtmlList::Ordered)
705 m_t << "</orderedlist>\n";
707 m_t << "</itemizedlist>\n";
710 void DocbookDocVisitor::visitPre(DocHtmlListItem *)
713 m_t << "<listitem>\n";
716 void DocbookDocVisitor::visitPost(DocHtmlListItem *)
719 m_t << "</listitem>\n";
722 void DocbookDocVisitor::visitPre(DocHtmlDescList *)
725 m_t << "<variablelist>\n";
728 void DocbookDocVisitor::visitPost(DocHtmlDescList *)
731 m_t << "</variablelist>\n";
734 void DocbookDocVisitor::visitPre(DocHtmlDescTitle *)
737 m_t << "<varlistentry><term>";
740 void DocbookDocVisitor::visitPost(DocHtmlDescTitle *)
746 void DocbookDocVisitor::visitPre(DocHtmlDescData *)
752 void DocbookDocVisitor::visitPost(DocHtmlDescData *)
755 m_t << "</listitem></varlistentry>\n";
758 void DocbookDocVisitor::visitPre(DocHtmlTable *t)
761 m_t << "<table frame=\"all\">" << endl;
762 m_t << " <title></title>" << endl;
763 m_t << " <tgroup cols=\"" << t->numColumns() << "\" align=\"left\" colsep=\"1\" rowsep=\"1\">" << endl;
764 m_t << " <tbody>" << endl;
767 void DocbookDocVisitor::visitPost(DocHtmlTable *)
770 m_t << " </tbody>" << endl;
771 m_t << " </tgroup>" << endl;
772 m_t << "</table>" << endl;
775 void DocbookDocVisitor::visitPre(DocHtmlRow *)
781 void DocbookDocVisitor::visitPost(DocHtmlRow *)
787 void DocbookDocVisitor::visitPre(DocHtmlCell *)
793 void DocbookDocVisitor::visitPost(DocHtmlCell *)
799 void DocbookDocVisitor::visitPre(DocHtmlCaption *)
805 void DocbookDocVisitor::visitPost(DocHtmlCaption *)
808 m_t << "</caption>\n";
811 void DocbookDocVisitor::visitPre(DocInternal *)
814 // TODO: to be implemented
817 void DocbookDocVisitor::visitPost(DocInternal *)
820 // TODO: to be implemented
823 void DocbookDocVisitor::visitPre(DocHRef *href)
826 m_t << "<link xlink:href=\"" << href->url() << "\">";
829 void DocbookDocVisitor::visitPost(DocHRef *)
835 void DocbookDocVisitor::visitPre(DocHtmlHeader *)
838 m_t << "<formalpara><title>";
841 void DocbookDocVisitor::visitPost(DocHtmlHeader *)
844 m_t << "</title></formalpara>\n";
847 void DocbookDocVisitor::visitPre(DocImage *img)
849 if (img->type()==DocImage::DocBook)
853 m_t << " <figure>" << endl;
863 void DocbookDocVisitor::visitPost(DocImage *img)
865 if (img->type()==DocImage::DocBook)
869 m_t << "</title>" << endl;
870 m_t << " <mediaobject>" << endl;
871 m_t << " <imageobject>" << endl;
872 QCString baseName=img->name();
874 if ((i=baseName.findRev('/'))!=-1 || (i=baseName.findRev('\\'))!=-1)
876 baseName=baseName.right(baseName.length()-i-1);
878 m_t << " <imagedata";
879 if (!img->width().isEmpty())
882 filter(img->width());
887 m_t << " width=\"50%\"";
889 if (!img->height().isEmpty())
892 filter(img->height());
895 m_t << " align=\"center\" valign=\"middle\" scalefit=\"1\" fileref=\"" << baseName << "\">";
896 m_t << "</imagedata>" << endl;
897 m_t << " </imageobject>" << endl;
898 m_t << " </mediaobject>" << endl;
899 m_t << " </figure>" << endl;
900 // copy the image to the output dir
903 FileDef *fd=findFileDef(Doxygen::imageNameDict, baseName, ambig);
906 m_file=fd->absFilePath();
908 QFile inImage(m_file);
909 QFile outImage(Config_getString("DOCBOOK_OUTPUT")+"/"+baseName.data());
910 if (inImage.open(IO_ReadOnly))
912 if (outImage.open(IO_WriteOnly))
914 char *buffer = new char[inImage.size()];
915 inImage.readBlock(buffer,inImage.size());
916 outImage.writeBlock(buffer,inImage.size());
928 void DocbookDocVisitor::visitPre(DocDotFile *df)
931 startDotFile(df->file(),df->width(),df->height(),df->hasCaption());
934 void DocbookDocVisitor::visitPost(DocDotFile *df)
937 endDotFile(df->hasCaption());
940 void DocbookDocVisitor::visitPre(DocMscFile *df)
943 startMscFile(df->file(),df->width(),df->height(),df->hasCaption());
946 void DocbookDocVisitor::visitPost(DocMscFile *df)
949 endMscFile(df->hasCaption());
951 void DocbookDocVisitor::visitPre(DocDiaFile *df)
954 startDiaFile(df->file(),df->width(),df->height(),df->hasCaption());
957 void DocbookDocVisitor::visitPost(DocDiaFile *df)
960 endDiaFile(df->hasCaption());
963 void DocbookDocVisitor::visitPre(DocLink *lnk)
966 startLink(lnk->file(),lnk->anchor());
969 void DocbookDocVisitor::visitPost(DocLink *)
975 void DocbookDocVisitor::visitPre(DocRef *ref)
978 if (!ref->file().isEmpty()) startLink(ref->file(),ref->anchor());
979 if (!ref->hasLinkText()) filter(ref->targetTitle());
982 void DocbookDocVisitor::visitPost(DocRef *ref)
985 if (!ref->file().isEmpty()) endLink();
988 void DocbookDocVisitor::visitPre(DocSecRefItem *ref)
991 m_t << "<tocitem id=\"" << ref->file() << "_1" << ref->anchor() << "\">";
994 void DocbookDocVisitor::visitPost(DocSecRefItem *)
997 m_t << "</tocitem>" << endl;
1000 void DocbookDocVisitor::visitPre(DocSecRefList *)
1003 m_t << "<toclist>" << endl;
1006 void DocbookDocVisitor::visitPost(DocSecRefList *)
1009 m_t << "</toclist>" << endl;
1012 void DocbookDocVisitor::visitPre(DocParamSect *s)
1016 m_t << " <formalpara>" << endl;
1017 m_t << " <title/>" << endl;
1018 m_t << " <table frame=\"all\">" << endl;
1022 case DocParamSect::Param: m_t << theTranslator->trParameters(); break;
1023 case DocParamSect::RetVal: m_t << theTranslator->trReturnValues(); break;
1024 case DocParamSect::Exception: m_t << theTranslator->trExceptions(); break;
1025 case DocParamSect::TemplateParam: m_t << theTranslator->trTemplateParameters(); break;
1029 m_t << " </title>" << endl;
1030 m_t << " <tgroup cols=\"2\" align=\"left\" colsep=\"1\" rowsep=\"1\">" << endl;
1031 m_t << " <tbody>" << endl;
1034 void DocbookDocVisitor::visitPost(DocParamSect *)
1037 m_t << " </tbody>" << endl;
1038 m_t << " </tgroup>" << endl;
1039 m_t << " </table>" << endl;
1040 m_t << " </formalpara>" << endl;
1044 void DocbookDocVisitor::visitPre(DocParamList *pl)
1047 QListIterator<DocNode> li(pl->parameters());
1049 m_t << " <row>" << endl;
1052 m_t << " <entry></entry>" << endl;
1058 for (li.toFirst();(param=li.current());++li)
1064 if (param->kind()==DocNode::Kind_Word)
1066 visit((DocWord*)param);
1068 else if (param->kind()==DocNode::Kind_LinkedWord)
1070 visit((DocLinkedWord*)param);
1074 m_t << "</entry>" << endl;
1079 void DocbookDocVisitor::visitPost(DocParamList *)
1082 m_t << "</entry>" << endl;
1083 m_t << " </row>" << endl;
1086 void DocbookDocVisitor::visitPre(DocXRefItem *x)
1089 if (x->title().isEmpty()) return;
1090 m_t << "<para><link linkend=\"";
1091 m_t << x->file() << "_1" << x->anchor();
1098 void DocbookDocVisitor::visitPost(DocXRefItem *x)
1101 if (x->title().isEmpty()) return;
1105 void DocbookDocVisitor::visitPre(DocInternalRef *ref)
1108 startLink(ref->file(),ref->anchor());
1111 void DocbookDocVisitor::visitPost(DocInternalRef *)
1118 void DocbookDocVisitor::visitPre(DocCopy *)
1121 // TODO: to be implemented
1125 void DocbookDocVisitor::visitPost(DocCopy *)
1128 // TODO: to be implemented
1132 void DocbookDocVisitor::visitPre(DocText *)
1134 // TODO: to be implemented
1138 void DocbookDocVisitor::visitPost(DocText *)
1140 // TODO: to be implemented
1144 void DocbookDocVisitor::visitPre(DocHtmlBlockQuote *)
1147 m_t << "<blockquote>";
1150 void DocbookDocVisitor::visitPost(DocHtmlBlockQuote *)
1153 m_t << "</blockquote>";
1156 void DocbookDocVisitor::visitPre(DocVhdlFlow *)
1158 // TODO: to be implemented
1162 void DocbookDocVisitor::visitPost(DocVhdlFlow *)
1164 // TODO: to be implemented
1167 void DocbookDocVisitor::visitPre(DocParBlock *)
1171 void DocbookDocVisitor::visitPost(DocParBlock *)
1176 void DocbookDocVisitor::filter(const char *str)
1178 m_t << convertToXML(str);
1181 void DocbookDocVisitor::startLink(const QCString &file,const QCString &anchor)
1183 m_t << "<link linkend=\"" << file;
1184 if (!anchor.isEmpty()) m_t << "_1" << anchor;
1188 void DocbookDocVisitor::endLink()
1193 void DocbookDocVisitor::pushEnabled()
1195 m_enabled.push(new bool(m_hide));
1198 void DocbookDocVisitor::popEnabled()
1200 bool *v=m_enabled.pop();
1206 void DocbookDocVisitor::writeMscFile(const QCString &baseName)
1208 QCString shortName = baseName;
1210 if ((i=shortName.findRev('/'))!=-1)
1212 shortName=shortName.right(shortName.length()-i-1);
1214 QCString outDir = Config_getString("DOCBOOK_OUTPUT");
1215 writeMscGraphFromFile(baseName+".msc",outDir,shortName,MSC_BITMAP);
1216 m_t << " <imagedata";
1217 m_t << " width=\"50%\"";
1218 m_t << " align=\"center\" valign=\"middle\" scalefit=\"1\" fileref=\"" << shortName << ".png" << "\">";
1219 m_t << "</imagedata>" << endl;
1222 void DocbookDocVisitor::writePlantUMLFile(const QCString &baseName)
1224 QCString shortName = baseName;
1226 if ((i=shortName.findRev('/'))!=-1)
1228 shortName=shortName.right(shortName.length()-i-1);
1230 QCString outDir = Config_getString("DOCBOOK_OUTPUT");
1231 generatePlantUMLOutput(baseName,outDir,PUML_BITMAP);
1232 m_t << " <imagedata";
1233 m_t << " width=\"50%\"";
1234 m_t << " align=\"center\" valign=\"middle\" scalefit=\"1\" fileref=\"" << shortName << ".png" << "\">";
1235 m_t << "</imagedata>" << endl;
1238 void DocbookDocVisitor::startMscFile(const QCString &fileName,
1239 const QCString &width,
1240 const QCString &height,
1244 QCString baseName=fileName;
1246 if ((i=baseName.findRev('/'))!=-1)
1248 baseName=baseName.right(baseName.length()-i-1);
1250 if ((i=baseName.find('.'))!=-1)
1252 baseName=baseName.left(i);
1254 baseName.prepend("msc_");
1255 QCString outDir = Config_getString("DOCBOOK_OUTPUT");
1256 writeMscGraphFromFile(fileName,outDir,baseName,MSC_BITMAP);
1257 m_t << "<para>" << endl;
1258 m_t << " <figure>" << endl;
1259 m_t << " <title></title>" << endl;
1260 m_t << " <mediaobject>" << endl;
1261 m_t << " <imageobject>" << endl;
1262 m_t << " <imagedata";
1263 if (!width.isEmpty())
1271 m_t << " width=\"50%\"";
1273 if (!height.isEmpty())
1279 m_t << " align=\"center\" valign=\"middle\" scalefit=\"1\" fileref=\"" << baseName << ".png" << "\">";
1280 m_t << "</imagedata>" << endl;
1281 m_t << " </imageobject>" << endl;
1284 m_t << " <caption>" << endl;
1288 void DocbookDocVisitor::endMscFile(bool hasCaption)
1294 m_t << " </caption>" << endl;
1296 m_t << " </mediaobject>" << endl;
1297 m_t << " </figure>" << endl;
1298 m_t << "</para>" << endl;
1301 void DocbookDocVisitor::writeDiaFile(const QCString &baseName)
1303 QCString shortName = baseName;
1305 if ((i=shortName.findRev('/'))!=-1)
1307 shortName=shortName.right(shortName.length()-i-1);
1309 QCString outDir = Config_getString("DOCBOOK_OUTPUT");
1310 writeDiaGraphFromFile(baseName+".dia",outDir,shortName,DIA_BITMAP);
1311 m_t << " <imagedata";
1312 m_t << " align=\"center\" fileref=\"" << shortName << ".png" << "\">";
1313 m_t << "</imagedata>" << endl;
1316 void DocbookDocVisitor::startDiaFile(const QCString &fileName,
1317 const QCString &width,
1318 const QCString &height,
1322 QCString baseName=fileName;
1324 if ((i=baseName.findRev('/'))!=-1)
1326 baseName=baseName.right(baseName.length()-i-1);
1328 if ((i=baseName.find('.'))!=-1)
1330 baseName=baseName.left(i);
1332 baseName.prepend("msc_");
1333 QCString outDir = Config_getString("DOCBOOK_OUTPUT");
1334 writeDiaGraphFromFile(fileName,outDir,baseName,DIA_BITMAP);
1335 m_t << "<para>" << endl;
1336 m_t << " <figure>" << endl;
1337 m_t << " <title></title>" << endl;
1338 m_t << " <mediaobject>" << endl;
1339 m_t << " <imageobject>" << endl;
1340 m_t << " <imagedata";
1341 if (!width.isEmpty())
1347 else if (!height.isEmpty())
1353 m_t << " align=\"center\" fileref=\"" << baseName << ".png" << "\">";
1354 m_t << "</imagedata>" << endl;
1355 m_t << " </imageobject>" << endl;
1358 m_t << " <caption>" << endl;
1362 void DocbookDocVisitor::endDiaFile(bool hasCaption)
1368 m_t << " </caption>" << endl;
1370 m_t << " </mediaobject>" << endl;
1371 m_t << " </figure>" << endl;
1372 m_t << "</para>" << endl;
1375 void DocbookDocVisitor::writeDotFile(const QCString &baseName)
1377 QCString shortName = baseName;
1379 if ((i=shortName.findRev('/'))!=-1)
1381 shortName=shortName.right(shortName.length()-i-1);
1383 QCString outDir = Config_getString("DOCBOOK_OUTPUT");
1384 QCString imgExt = Config_getEnum("DOT_IMAGE_FORMAT");
1385 writeDotGraphFromFile(baseName+".dot",outDir,shortName,GOF_BITMAP);
1386 m_t << " <imagedata";
1387 //If no width is specified use default value for PDF rendering
1388 m_t << " width=\"50%\"";
1389 m_t << " align=\"center\" valign=\"middle\" scalefit=\"1\" fileref=\"" << shortName << "." << imgExt << "\">";
1390 m_t << "</imagedata>" << endl;
1393 void DocbookDocVisitor::startDotFile(const QCString &fileName,
1394 const QCString &width,
1395 const QCString &height,
1399 QCString baseName=fileName;
1401 if ((i=baseName.findRev('/'))!=-1)
1403 baseName=baseName.right(baseName.length()-i-1);
1405 if ((i=baseName.find('.'))!=-1)
1407 baseName=baseName.left(i);
1409 baseName.prepend("dot_");
1410 QCString outDir = Config_getString("DOCBOOK_OUTPUT");
1411 QCString imgExt = Config_getEnum("DOT_IMAGE_FORMAT");
1412 writeDotGraphFromFile(fileName,outDir,baseName,GOF_BITMAP);
1413 m_t << "<para>" << endl;
1414 m_t << " <figure>" << endl;
1415 m_t << " <title></title>" << endl;
1416 m_t << " <mediaobject>" << endl;
1417 m_t << " <imageobject>" << endl;
1418 m_t << " <imagedata";
1419 if (!width.isEmpty())
1427 m_t << " width=\"50%\"";
1429 if (!height.isEmpty())
1435 m_t << " align=\"center\" valign=\"middle\" scalefit=\"1\" fileref=\"" << baseName << "." << imgExt << "\">";
1436 m_t << "</imagedata>" << endl;
1437 m_t << " </imageobject>" << endl;
1440 m_t << " <caption>" << endl;
1444 void DocbookDocVisitor::endDotFile(bool hasCaption)
1450 m_t << " </caption>" << endl;
1452 m_t << " </mediaobject>" << endl;
1453 m_t << " </figure>" << endl;
1454 m_t << "</para>" << endl;