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"
38 DocbookDocVisitor::DocbookDocVisitor(FTextStream &t,CodeOutputInterface &ci)
39 : DocVisitor(DocVisitor_Docbook), m_t(t), m_ci(ci), m_insidePre(FALSE), m_hide(FALSE)
43 //--------------------------------------
44 // visitor functions for leaf nodes
45 //--------------------------------------
47 void DocbookDocVisitor::visit(DocWord *w)
53 void DocbookDocVisitor::visit(DocLinkedWord *w)
56 startLink(w->file(),w->anchor());
61 void DocbookDocVisitor::visit(DocWhiteSpace *w)
74 void DocbookDocVisitor::visit(DocSymbol *s)
77 const char *res = HtmlEntityMapper::instance()->docbook(s->symbol());
84 err("DocBook: non supported HTML-entity found: %s\n",HtmlEntityMapper::instance()->html(s->symbol(),TRUE));
88 void DocbookDocVisitor::visit(DocURL *u)
91 m_t << "<link xlink:href=\"";
92 if (u->isEmail()) m_t << "mailto:";
99 void DocbookDocVisitor::visit(DocLineBreak *)
102 m_t << endl << "<literallayout>\n</literallayout>" << endl;
105 void DocbookDocVisitor::visit(DocHorRuler *)
108 m_t << "<informaltable frame='bottom'><tgroup cols='1'><colspec align='center'/><tbody><row><entry align='center'>\n";
109 m_t << "</entry></row></tbody></tgroup></informaltable>\n";
112 void DocbookDocVisitor::visit(DocStyleChange *s)
117 case DocStyleChange::Bold:
118 if (s->enable()) m_t << "<emphasis role=\"bold\">"; else m_t << "</emphasis>";
120 case DocStyleChange::Italic:
121 if (s->enable()) m_t << "<emphasis>"; else m_t << "</emphasis>";
123 case DocStyleChange::Code:
124 if (s->enable()) m_t << "<computeroutput>"; else m_t << "</computeroutput>";
126 case DocStyleChange::Subscript:
127 if (s->enable()) m_t << "<subscript>"; else m_t << "</subscript>";
129 case DocStyleChange::Superscript:
130 if (s->enable()) m_t << "<superscript>"; else m_t << "</superscript>";
132 case DocStyleChange::Center:
133 if (s->enable()) m_t << "<informaltable frame='none'><tgroup cols='1'><colspec align='center'/><tbody><row><entry align='center'>";
134 else m_t << "</entry></row></tbody></tgroup></informaltable>";
136 case DocStyleChange::Preformatted:
139 m_t << "<literallayout>";
144 m_t << "</literallayout>";
148 /* There is no equivalent Docbook tag for rendering Small text */
149 case DocStyleChange::Small: /* XSLT Stylesheets can be used */ break;
151 case DocStyleChange::Div: /* HTML only */ break;
152 case DocStyleChange::Span: /* HTML only */ break;
156 void DocbookDocVisitor::visit(DocVerbatim *s)
159 SrcLangExt langExt = getLanguageFromFileName(m_langExt);
162 case DocVerbatim::Code: // fall though
163 m_t << "<programlisting>";
164 Doxygen::parserManager->getParser(m_langExt)
165 ->parseCode(m_ci,s->context(),s->text(),langExt,
166 s->isExample(),s->exampleFile());
167 m_t << "</programlisting>";
169 case DocVerbatim::Verbatim:
170 m_t << "<programlisting><literallayout>";
172 m_t << "</literallayout></programlisting>";
174 case DocVerbatim::HtmlOnly:
176 case DocVerbatim::RtfOnly:
178 case DocVerbatim::ManOnly:
180 case DocVerbatim::LatexOnly:
182 case DocVerbatim::XmlOnly:
184 case DocVerbatim::DocbookOnly:
188 case DocVerbatim::Dot:
190 static int dotindex = 1;
191 QCString baseName(4096);
192 QCString stext = s->text();
193 m_t << "<para>" << endl;
194 baseName.sprintf("%s%d",
195 (Config_getString("DOCBOOK_OUTPUT")+"/inline_dotgraph_").data(),
198 QFile file(baseName+".dot");
199 if (!file.open(IO_WriteOnly))
201 err("Could not open file %s.msc for writing\n",baseName.data());
203 file.writeBlock( stext, stext.length() );
205 m_t << " <figure>" << endl;
206 m_t << " <title></title>" << endl;
207 m_t << " <mediaobject>" << endl;
208 m_t << " <imageobject>" << endl;
209 writeDotFile(baseName);
210 m_t << " </imageobject>" << endl;
211 m_t << " </mediaobject>" << endl;
212 m_t << " </figure>" << endl;
213 m_t << "</para>" << endl;
216 case DocVerbatim::Msc:
217 static int mscindex = 1;
218 QCString baseName(4096);
219 QCString stext = s->text();
220 m_t << "<para>" << endl;
221 baseName.sprintf("%s%d",
222 (Config_getString("DOCBOOK_OUTPUT")+"/inline_mscgraph_").data(),
225 QFile file(baseName+".msc");
226 if (!file.open(IO_WriteOnly))
228 err("Could not open file %s.msc for writing\n",baseName.data());
230 QCString text = "msc {";
233 file.writeBlock( text, text.length() );
235 m_t << " <figure>" << endl;
236 m_t << " <title></title>" << endl;
237 m_t << " <mediaobject>" << endl;
238 m_t << " <imageobject>" << endl;
239 writeMscFile(baseName);
240 m_t << " </imageobject>" << endl;
241 m_t << " </mediaobject>" << endl;
242 m_t << " </figure>" << endl;
243 m_t << "</para>" << endl;
248 void DocbookDocVisitor::visit(DocAnchor *anc)
251 m_t << "<anchor id=\"" << anc->file() << "_1" << anc->anchor() << "\"/>";
254 void DocbookDocVisitor::visit(DocInclude *inc)
257 SrcLangExt langExt = getLanguageFromFileName(inc->extension());
260 case DocInclude::IncWithLines:
262 m_t << "<programlisting>";
263 QFileInfo cfi( inc->file() );
264 FileDef fd( cfi.dirPath().utf8(), cfi.fileName().utf8() );
265 Doxygen::parserManager->getParser(inc->extension())
266 ->parseCode(m_ci,inc->context(),
270 inc->exampleFile(), &fd);
271 m_t << "</programlisting>";
274 case DocInclude::Include:
275 m_t << "<programlisting>";
276 Doxygen::parserManager->getParser(inc->extension())
277 ->parseCode(m_ci,inc->context(),
282 m_t << "</programlisting>";
284 case DocInclude::DontInclude:
286 case DocInclude::HtmlInclude:
288 case DocInclude::LatexInclude:
290 case DocInclude::VerbInclude:
293 m_t << "</verbatim>";
295 case DocInclude::Snippet:
296 m_t << "<programlisting>";
297 Doxygen::parserManager->getParser(inc->extension())
300 extractBlock(inc->text(),inc->blockId()),
305 m_t << "</programlisting>";
310 void DocbookDocVisitor::visit(DocIncOperator *op)
316 m_t << "<programlisting>";
321 SrcLangExt langExt = getLanguageFromFileName(m_langExt);
322 if (op->type()!=DocIncOperator::Skip)
327 Doxygen::parserManager->getParser(m_langExt)
328 ->parseCode(m_ci,op->context(),
329 op->text(),langExt,op->isExample(),
338 if (!m_hide) m_t << "</programlisting>";
342 if (!m_hide) m_t << endl;
346 void DocbookDocVisitor::visit(DocFormula *f)
349 m_t << "<equation><title>" << f->name() << "</title>";
351 m_t << "</equation>";
354 void DocbookDocVisitor::visit(DocIndexEntry *ie)
357 m_t << "<indexentry><primaryie>" << endl;
359 m_t << "</primaryie><secondaryie></secondaryie></indexentry>" << endl;
362 void DocbookDocVisitor::visit(DocSimpleSectSep *)
364 m_t << "<simplesectsep/>";
367 void DocbookDocVisitor::visit(DocCite *cite)
370 if (!cite->file().isEmpty()) startLink(cite->file(),cite->anchor());
371 filter(cite->text());
372 if (!cite->file().isEmpty()) endLink();
375 //--------------------------------------
376 // visitor functions for compound nodes
377 //--------------------------------------
379 void DocbookDocVisitor::visitPre(DocAutoList *l)
384 m_t << "<orderedlist>\n";
388 m_t << "<itemizedlist>\n";
392 void DocbookDocVisitor::visitPost(DocAutoList *l)
397 m_t << "</orderedlist>\n";
401 m_t << "</itemizedlist>\n";
405 void DocbookDocVisitor::visitPre(DocAutoListItem *)
411 void DocbookDocVisitor::visitPost(DocAutoListItem *)
414 m_t << "</listitem>";
417 void DocbookDocVisitor::visitPre(DocPara *)
424 void DocbookDocVisitor::visitPost(DocPara *)
431 void DocbookDocVisitor::visitPre(DocRoot *)
433 //m_t << "<hr><h4><font color=\"red\">New parser:</font></h4>\n";
436 void DocbookDocVisitor::visitPost(DocRoot *)
438 //m_t << "<hr><h4><font color=\"red\">Old parser:</font></h4>\n";
441 void DocbookDocVisitor::visitPre(DocSimpleSect *s)
446 case DocSimpleSect::See:
449 m_t << "<formalpara><title>" << theTranslator->trSeeAlso() << ": </title>" << endl;
453 m_t << "<formalpara><title>" << convertToXML(theTranslator->trSeeAlso()) << ": </title>" << endl;
456 case DocSimpleSect::Return:
459 m_t << "<formalpara><title>" << theTranslator->trReturns()<< ": </title>" << endl;
463 m_t << "<formalpara><title>" << convertToXML(theTranslator->trReturns()) << ": </title>" << endl;
466 case DocSimpleSect::Author:
469 m_t << "<formalpara><title>" << theTranslator->trAuthor(TRUE, TRUE) << ": </title>" << endl;
473 m_t << "<formalpara><title>" << convertToXML(theTranslator->trAuthor(TRUE, TRUE)) << ": </title>" << endl;
476 case DocSimpleSect::Authors:
479 m_t << "<formalpara><title>" << theTranslator->trAuthor(TRUE, FALSE) << ": </title>" << endl;
483 m_t << "<formalpara><title>" << convertToXML(theTranslator->trAuthor(TRUE, FALSE)) << ": </title>" << endl;
486 case DocSimpleSect::Version:
489 m_t << "<formalpara><title>" << theTranslator->trVersion() << ": </title>" << endl;
493 m_t << "<formalpara><title>" << convertToXML(theTranslator->trVersion()) << ": </title>" << endl;
496 case DocSimpleSect::Since:
499 m_t << "<formalpara><title>" << theTranslator->trSince() << ": </title>" << endl;
503 m_t << "<formalpara><title>" << convertToXML(theTranslator->trSince()) << ": </title>" << endl;
506 case DocSimpleSect::Date:
509 m_t << "<formalpara><title>" << theTranslator->trDate() << ": </title>" << endl;
513 m_t << "<formalpara><title>" << convertToXML(theTranslator->trDate()) << ": </title>" << endl;
516 case DocSimpleSect::Note:
519 m_t << "<formalpara><title>" << theTranslator->trNote() << ": </title>" << endl;
523 m_t << "<formalpara><title>" << convertToXML(theTranslator->trNote()) << ": </title>" << endl;
526 case DocSimpleSect::Warning:
529 m_t << "<formalpara><title>" << theTranslator->trWarning() << ": </title>" << endl;
533 m_t << "<formalpara><title>" << convertToXML(theTranslator->trWarning()) << ": </title>" << endl;
536 case DocSimpleSect::Pre:
539 m_t << "<formalpara><title>" << theTranslator->trPrecondition() << ": </title>" << endl;
543 m_t << "<formalpara><title>" << convertToXML(theTranslator->trPrecondition()) << ": </title>" << endl;
546 case DocSimpleSect::Post:
549 m_t << "<formalpara><title>" << theTranslator->trPostcondition() << ": </title>" << endl;
553 m_t << "<formalpara><title>" << convertToXML(theTranslator->trPostcondition()) << ": </title>" << endl;
556 case DocSimpleSect::Copyright:
559 m_t << "<formalpara><title>" << theTranslator->trCopyright() << ": </title>" << endl;
563 m_t << "<formalpara><title>" << convertToXML(theTranslator->trCopyright()) << ": </title>" << endl;
566 case DocSimpleSect::Invar:
569 m_t << "<formalpara><title>" << theTranslator->trInvariant() << ": </title>" << endl;
573 m_t << "<formalpara><title>" << convertToXML(theTranslator->trInvariant()) << ": </title>" << endl;
576 case DocSimpleSect::Remark:
579 m_t << "<formalpara><title>" << theTranslator->trRemarks() << ": </title>" << endl;
583 m_t << "<formalpara><title>" << convertToXML(theTranslator->trRemarks()) << ": </title>" << endl;
586 case DocSimpleSect::Attention:
589 m_t << "<formalpara><title>" << theTranslator->trAttention() << ": </title>" << endl;
593 m_t << "<formalpara><title>" << convertToXML(theTranslator->trAttention()) << ": </title>" << endl;
596 case DocSimpleSect::User:
597 m_t << "<formalpara><title></title>" << endl;
599 case DocSimpleSect::Rcs:
600 m_t << "<formalpara><title></title>" << endl;
602 case DocSimpleSect::Unknown: m_t << "<formalpara><title></title>" << endl; break;
606 void DocbookDocVisitor::visitPost(DocSimpleSect *)
609 m_t << "</formalpara>" << endl;
612 void DocbookDocVisitor::visitPre(DocTitle *)
618 void DocbookDocVisitor::visitPost(DocTitle *)
624 void DocbookDocVisitor::visitPre(DocSimpleList *)
627 m_t << "<itemizedlist>\n";
630 void DocbookDocVisitor::visitPost(DocSimpleList *)
633 m_t << "</itemizedlist>\n";
636 void DocbookDocVisitor::visitPre(DocSimpleListItem *)
642 void DocbookDocVisitor::visitPost(DocSimpleListItem *)
645 m_t << "</listitem>\n";
648 void DocbookDocVisitor::visitPre(DocSection *s)
651 m_t << "<section xml:id=\"" << s->file();
652 if (!s->anchor().isEmpty()) m_t << "_1" << s->anchor();
653 m_t << "\">" << endl;
656 m_t << "</title>" << endl;
659 void DocbookDocVisitor::visitPost(DocSection *)
661 m_t << "</section>\n";
664 void DocbookDocVisitor::visitPre(DocHtmlList *s)
667 if (s->type()==DocHtmlList::Ordered)
668 m_t << "<orderedlist>\n";
670 m_t << "<itemizedlist>\n";
673 void DocbookDocVisitor::visitPost(DocHtmlList *s)
676 if (s->type()==DocHtmlList::Ordered)
677 m_t << "</orderedlist>\n";
679 m_t << "</itemizedlist>\n";
682 void DocbookDocVisitor::visitPre(DocHtmlListItem *)
685 m_t << "<listitem>\n";
688 void DocbookDocVisitor::visitPost(DocHtmlListItem *)
691 m_t << "</listitem>\n";
694 void DocbookDocVisitor::visitPre(DocHtmlDescList *)
697 m_t << "<variablelist>\n";
700 void DocbookDocVisitor::visitPost(DocHtmlDescList *)
703 m_t << "</variablelist>\n";
706 void DocbookDocVisitor::visitPre(DocHtmlDescTitle *)
709 m_t << "<varlistentry><term>";
712 void DocbookDocVisitor::visitPost(DocHtmlDescTitle *)
718 void DocbookDocVisitor::visitPre(DocHtmlDescData *)
724 void DocbookDocVisitor::visitPost(DocHtmlDescData *)
727 m_t << "</listitem></varlistentry>\n";
730 void DocbookDocVisitor::visitPre(DocHtmlTable *t)
733 m_t << "<table frame=\"all\">" << endl;
734 m_t << " <title></title>" << endl;
735 m_t << " <tgroup cols=\"" << t->numColumns() << "\" align=\"left\" colsep=\"1\" rowsep=\"1\">" << endl;
736 m_t << " <tbody>" << endl;
739 void DocbookDocVisitor::visitPost(DocHtmlTable *)
742 m_t << " </tbody>" << endl;
743 m_t << " </tgroup>" << endl;
744 m_t << "</table>" << endl;
747 void DocbookDocVisitor::visitPre(DocHtmlRow *)
753 void DocbookDocVisitor::visitPost(DocHtmlRow *)
759 void DocbookDocVisitor::visitPre(DocHtmlCell *)
765 void DocbookDocVisitor::visitPost(DocHtmlCell *)
771 void DocbookDocVisitor::visitPre(DocHtmlCaption *)
777 void DocbookDocVisitor::visitPost(DocHtmlCaption *)
780 m_t << "</caption>\n";
783 void DocbookDocVisitor::visitPre(DocInternal *)
786 // TODO: to be implemented
789 void DocbookDocVisitor::visitPost(DocInternal *)
792 // TODO: to be implemented
795 void DocbookDocVisitor::visitPre(DocHRef *href)
798 m_t << "<link xlink:href=\"" << href->url() << "\">";
801 void DocbookDocVisitor::visitPost(DocHRef *)
807 void DocbookDocVisitor::visitPre(DocHtmlHeader *)
810 m_t << "<formalpara><title>";
813 void DocbookDocVisitor::visitPost(DocHtmlHeader *)
816 m_t << "</title></formalpara>\n";
819 void DocbookDocVisitor::visitPre(DocImage *img)
821 if (img->type()==DocImage::Latex)
825 m_t << " <figure>" << endl;
835 void DocbookDocVisitor::visitPost(DocImage *img)
837 if (img->type()==DocImage::Latex)
841 m_t << "</title>" << endl;
842 m_t << " <mediaobject>" << endl;
843 m_t << " <imageobject>" << endl;
844 QCString baseName=img->name();
846 if ((i=baseName.findRev('/'))!=-1 || (i=baseName.findRev('\\'))!=-1)
848 baseName=baseName.right(baseName.length()-i-1);
850 m_t << " <imagedata";
851 if (!img->width().isEmpty())
854 filter(img->width());
857 else if (!img->height().isEmpty())
860 filter(img->height());
863 m_t << " align=\"center\" fileref=\"" << baseName << "\">";
864 m_t << "</imagedata>" << endl;
865 m_t << " </imageobject>" << endl;
866 m_t << " </mediaobject>" << endl;
867 m_t << " </figure>" << endl;
868 // copy the image to the output dir
871 FileDef *fd=findFileDef(Doxygen::imageNameDict, baseName, ambig);
874 m_file=fd->absFilePath();
876 QFile inImage(m_file);
877 QFile outImage(Config_getString("DOCBOOK_OUTPUT")+"/"+baseName.data());
878 if (inImage.open(IO_ReadOnly))
880 if (outImage.open(IO_WriteOnly))
882 char *buffer = new char[inImage.size()];
883 inImage.readBlock(buffer,inImage.size());
884 outImage.writeBlock(buffer,inImage.size());
896 void DocbookDocVisitor::visitPre(DocDotFile *df)
899 startDotFile(df->file(),df->width(),df->height(),df->hasCaption());
902 void DocbookDocVisitor::visitPost(DocDotFile *df)
905 endDotFile(df->hasCaption());
908 void DocbookDocVisitor::visitPre(DocMscFile *df)
911 startMscFile(df->file(),df->width(),df->height(),df->hasCaption());
914 void DocbookDocVisitor::visitPost(DocMscFile *df)
917 endMscFile(df->hasCaption());
919 void DocbookDocVisitor::visitPre(DocDiaFile *df)
922 startDiaFile(df->file(),df->width(),df->height(),df->hasCaption());
925 void DocbookDocVisitor::visitPost(DocDiaFile *df)
928 endDiaFile(df->hasCaption());
931 void DocbookDocVisitor::visitPre(DocLink *lnk)
934 startLink(lnk->file(),lnk->anchor());
937 void DocbookDocVisitor::visitPost(DocLink *)
943 void DocbookDocVisitor::visitPre(DocRef *ref)
946 if (!ref->file().isEmpty()) startLink(ref->file(),ref->anchor());
947 if (!ref->hasLinkText()) filter(ref->targetTitle());
950 void DocbookDocVisitor::visitPost(DocRef *ref)
953 if (!ref->file().isEmpty()) endLink();
956 void DocbookDocVisitor::visitPre(DocSecRefItem *ref)
959 m_t << "<tocitem id=\"" << ref->file() << "_1" << ref->anchor() << "\">";
962 void DocbookDocVisitor::visitPost(DocSecRefItem *)
965 m_t << "</tocitem>" << endl;
968 void DocbookDocVisitor::visitPre(DocSecRefList *)
971 m_t << "<toclist>" << endl;
974 void DocbookDocVisitor::visitPost(DocSecRefList *)
977 m_t << "</toclist>" << endl;
980 void DocbookDocVisitor::visitPre(DocParamSect *s)
985 case DocParamSect::Param:
988 m_t << " <formalpara>" << endl;
989 m_t << " <title/>" << endl;
990 m_t << " <table frame=\"all\">" << endl;
991 m_t << " <title>Parameters</title>" << endl;
992 m_t << " <tgroup cols=\"2\" align=\"left\" colsep=\"1\" rowsep=\"1\">" << endl;
993 m_t << " <tbody>" << endl;
996 case DocParamSect::RetVal:
999 m_t << " <formalpara>" << endl;
1000 m_t << " <title/>" << endl;
1001 m_t << " <table frame=\"all\">" << endl;
1002 m_t << " <title>Parameters</title>" << endl;
1003 m_t << " <tgroup cols=\"2\" align=\"left\" colsep=\"1\" rowsep=\"1\">" << endl;
1004 m_t << " <tbody>" << endl;
1007 case DocParamSect::Exception:
1008 m_t << "exception"; break;
1009 case DocParamSect::TemplateParam:
1010 m_t << "templateparam"; break;
1016 void DocbookDocVisitor::visitPost(DocParamSect *)
1019 m_t << " </tbody>" << endl;
1020 m_t << " </tgroup>" << endl;
1021 m_t << " </table>" << endl;
1022 m_t << " </formalpara>" << endl;
1026 void DocbookDocVisitor::visitPre(DocParamList *pl)
1029 QListIterator<DocNode> li(pl->parameters());
1031 m_t << " <row>" << endl;
1034 m_t << " <entry></entry>" << endl;
1040 for (li.toFirst();(param=li.current());++li)
1046 if (param->kind()==DocNode::Kind_Word)
1048 visit((DocWord*)param);
1050 else if (param->kind()==DocNode::Kind_LinkedWord)
1052 visit((DocLinkedWord*)param);
1056 m_t << "</entry>" << endl;
1061 void DocbookDocVisitor::visitPost(DocParamList *)
1064 m_t << "</entry>" << endl;
1065 m_t << " </row>" << endl;
1068 void DocbookDocVisitor::visitPre(DocXRefItem *x)
1071 if (x->title().isEmpty()) return;
1072 m_t << "<para><link linkend=\"";
1073 m_t << x->file() << "_1" << x->anchor();
1080 void DocbookDocVisitor::visitPost(DocXRefItem *x)
1083 if (x->title().isEmpty()) return;
1087 void DocbookDocVisitor::visitPre(DocInternalRef *ref)
1090 startLink(ref->file(),ref->anchor());
1093 void DocbookDocVisitor::visitPost(DocInternalRef *)
1100 void DocbookDocVisitor::visitPre(DocCopy *)
1103 // TODO: to be implemented
1107 void DocbookDocVisitor::visitPost(DocCopy *)
1110 // TODO: to be implemented
1114 void DocbookDocVisitor::visitPre(DocText *)
1116 // TODO: to be implemented
1120 void DocbookDocVisitor::visitPost(DocText *)
1122 // TODO: to be implemented
1126 void DocbookDocVisitor::visitPre(DocHtmlBlockQuote *)
1129 m_t << "<blockquote>";
1132 void DocbookDocVisitor::visitPost(DocHtmlBlockQuote *)
1135 m_t << "</blockquote>";
1138 void DocbookDocVisitor::visitPre(DocVhdlFlow *)
1140 // TODO: to be implemented
1144 void DocbookDocVisitor::visitPost(DocVhdlFlow *)
1146 // TODO: to be implemented
1149 void DocbookDocVisitor::visitPre(DocParBlock *)
1153 void DocbookDocVisitor::visitPost(DocParBlock *)
1158 void DocbookDocVisitor::filter(const char *str)
1160 m_t << convertToXML(str);
1163 void DocbookDocVisitor::startLink(const QCString &file,const QCString &anchor)
1165 m_t << "<link linkend=\"" << file;
1166 if (!anchor.isEmpty()) m_t << "_1" << anchor;
1170 void DocbookDocVisitor::endLink()
1175 void DocbookDocVisitor::pushEnabled()
1177 m_enabled.push(new bool(m_hide));
1180 void DocbookDocVisitor::popEnabled()
1182 bool *v=m_enabled.pop();
1188 void DocbookDocVisitor::writeMscFile(const QCString &baseName)
1190 QCString shortName = baseName;
1192 if ((i=shortName.findRev('/'))!=-1)
1194 shortName=shortName.right(shortName.length()-i-1);
1196 QCString outDir = Config_getString("DOCBOOK_OUTPUT");
1197 writeMscGraphFromFile(baseName+".msc",outDir,shortName,MSC_BITMAP);
1198 m_t << " <imagedata";
1199 m_t << " align=\"center\" fileref=\"" << shortName << ".png" << "\">";
1200 m_t << "</imagedata>" << endl;
1203 void DocbookDocVisitor::startMscFile(const QCString &fileName,
1204 const QCString &width,
1205 const QCString &height,
1209 QCString baseName=fileName;
1211 if ((i=baseName.findRev('/'))!=-1)
1213 baseName=baseName.right(baseName.length()-i-1);
1215 if ((i=baseName.find('.'))!=-1)
1217 baseName=baseName.left(i);
1219 baseName.prepend("msc_");
1220 QCString outDir = Config_getString("DOCBOOK_OUTPUT");
1221 writeMscGraphFromFile(fileName,outDir,baseName,MSC_BITMAP);
1222 m_t << "<para>" << endl;
1223 m_t << " <figure>" << endl;
1224 m_t << " <title></title>" << endl;
1225 m_t << " <mediaobject>" << endl;
1226 m_t << " <imageobject>" << endl;
1227 m_t << " <imagedata";
1228 if (!width.isEmpty())
1234 else if (!height.isEmpty())
1240 m_t << " align=\"center\" fileref=\"" << baseName << ".png" << "\">";
1241 m_t << "</imagedata>" << endl;
1242 m_t << " </imageobject>" << endl;
1245 m_t << " <caption>" << endl;
1249 void DocbookDocVisitor::endMscFile(bool hasCaption)
1255 m_t << " </caption>" << endl;
1257 m_t << " </mediaobject>" << endl;
1258 m_t << " </figure>" << endl;
1259 m_t << "</para>" << endl;
1262 void DocbookDocVisitor::writeDiaFile(const QCString &baseName)
1264 QCString shortName = baseName;
1266 if ((i=shortName.findRev('/'))!=-1)
1268 shortName=shortName.right(shortName.length()-i-1);
1270 QCString outDir = Config_getString("DOCBOOK_OUTPUT");
1271 writeDiaGraphFromFile(baseName+".dia",outDir,shortName,DIA_BITMAP);
1272 m_t << " <imagedata";
1273 m_t << " align=\"center\" fileref=\"" << shortName << ".png" << "\">";
1274 m_t << "</imagedata>" << endl;
1277 void DocbookDocVisitor::startDiaFile(const QCString &fileName,
1278 const QCString &width,
1279 const QCString &height,
1283 QCString baseName=fileName;
1285 if ((i=baseName.findRev('/'))!=-1)
1287 baseName=baseName.right(baseName.length()-i-1);
1289 if ((i=baseName.find('.'))!=-1)
1291 baseName=baseName.left(i);
1293 baseName.prepend("msc_");
1294 QCString outDir = Config_getString("DOCBOOK_OUTPUT");
1295 writeDiaGraphFromFile(fileName,outDir,baseName,DIA_BITMAP);
1296 m_t << "<para>" << endl;
1297 m_t << " <figure>" << endl;
1298 m_t << " <title></title>" << endl;
1299 m_t << " <mediaobject>" << endl;
1300 m_t << " <imageobject>" << endl;
1301 m_t << " <imagedata";
1302 if (!width.isEmpty())
1308 else if (!height.isEmpty())
1314 m_t << " align=\"center\" fileref=\"" << baseName << ".png" << "\">";
1315 m_t << "</imagedata>" << endl;
1316 m_t << " </imageobject>" << endl;
1319 m_t << " <caption>" << endl;
1323 void DocbookDocVisitor::endDiaFile(bool hasCaption)
1329 m_t << " </caption>" << endl;
1331 m_t << " </mediaobject>" << endl;
1332 m_t << " </figure>" << endl;
1333 m_t << "</para>" << endl;
1336 void DocbookDocVisitor::writeDotFile(const QCString &baseName)
1338 QCString shortName = baseName;
1340 if ((i=shortName.findRev('/'))!=-1)
1342 shortName=shortName.right(shortName.length()-i-1);
1344 QCString outDir = Config_getString("DOCBOOK_OUTPUT");
1345 writeDotGraphFromFile(baseName+".dot",outDir,shortName,BITMAP);
1346 m_t << " <imagedata";
1347 m_t << " align=\"center\" fileref=\"" << shortName << ".png" << "\">";
1348 m_t << "</imagedata>" << endl;
1351 void DocbookDocVisitor::startDotFile(const QCString &fileName,
1352 const QCString &width,
1353 const QCString &height,
1357 QCString baseName=fileName;
1359 if ((i=baseName.findRev('/'))!=-1)
1361 baseName=baseName.right(baseName.length()-i-1);
1363 if ((i=baseName.find('.'))!=-1)
1365 baseName=baseName.left(i);
1367 baseName.prepend("dot_");
1368 QCString outDir = Config_getString("DOCBOOK_OUTPUT");
1369 writeDotGraphFromFile(fileName,outDir,baseName,BITMAP);
1370 m_t << "<para>" << endl;
1371 m_t << " <figure>" << endl;
1372 m_t << " <title></title>" << endl;
1373 m_t << " <mediaobject>" << endl;
1374 m_t << " <imageobject>" << endl;
1375 m_t << " <imagedata";
1376 if (!width.isEmpty())
1382 else if (!height.isEmpty())
1388 m_t << " align=\"center\" fileref=\"" << baseName << ".png" << "\">";
1389 m_t << "</imagedata>" << endl;
1390 m_t << " </imageobject>" << endl;
1393 m_t << " <caption>" << endl;
1397 void DocbookDocVisitor::endDotFile(bool hasCaption)
1403 m_t << " </caption>" << endl;
1405 m_t << " </mediaobject>" << endl;
1406 m_t << " </figure>" << endl;
1407 m_t << "</para>" << endl;