diff options
author | Dimitri van Heesch <doxygen@gmail.com> | 2018-11-24 18:59:20 (GMT) |
---|---|---|
committer | Dimitri van Heesch <doxygen@gmail.com> | 2018-11-24 18:59:20 (GMT) |
commit | 549d5aeecdc909e6aa0434a2ddb30b735423ec03 (patch) | |
tree | 5bb069463344355e0d3c951415c5748fa05ed73b | |
parent | f46deb857a112f0991582ffa280dab6900cb4e60 (diff) | |
parent | 3820f6a841115bd66ed409221c73824ec41ae6ab (diff) | |
download | Doxygen-549d5aeecdc909e6aa0434a2ddb30b735423ec03.zip Doxygen-549d5aeecdc909e6aa0434a2ddb30b735423ec03.tar.gz Doxygen-549d5aeecdc909e6aa0434a2ddb30b735423ec03.tar.bz2 |
Merge branch 'albert-github-feature/bug_docbook_figure'
-rw-r--r-- | src/docbookgen.cpp | 10 | ||||
-rw-r--r-- | src/docbookvisitor.cpp | 73 | ||||
-rw-r--r-- | src/docbookvisitor.h | 20 |
3 files changed, 64 insertions, 39 deletions
diff --git a/src/docbookgen.cpp b/src/docbookgen.cpp index 48b5d9e..97c602d 100644 --- a/src/docbookgen.cpp +++ b/src/docbookgen.cpp @@ -904,9 +904,15 @@ DB_GEN_C void DocbookGenerator::endClassDiagram(const ClassDiagram &d, const char *fileName,const char *) { DB_GEN_C - visitPreStart(t, FALSE, relPath + fileName + ".png", NULL, NULL); + t << " <informalfigure>" << endl; + t << " <mediaobject>" << endl; + t << " <imageobject>" << endl; + t << " <imagedata width=\"50%\" align=\"center\" valign=\"middle\" scalefit=\"0\" fileref=\"" + << relPath << fileName << ".png\">" << "</imagedata>" << endl; + t << " </imageobject>" << endl; d.writeImage(t,dir,relPath,fileName,FALSE); - visitPostEnd(t, FALSE); + t << " </mediaobject>" << endl; + t << " </informalfigure>" << endl; t << "</para>" << endl; } void DocbookGenerator::startLabels() diff --git a/src/docbookvisitor.cpp b/src/docbookvisitor.cpp index 7a948ec..51d1755 100644 --- a/src/docbookvisitor.cpp +++ b/src/docbookvisitor.cpp @@ -49,12 +49,27 @@ #define DB_VIS_C2a(x,y) #endif -void visitPreStart(FTextStream &t, bool hasCaption, QCString name, QCString width, QCString height, bool inlineImage) +void DocbookDocVisitor::visitCaption(const QList<DocNode> &children) +{ + QListIterator<DocNode> cli(children); + DocNode *n; + for (cli.toFirst();(n=cli.current());++cli) n->accept(this); +} + +void DocbookDocVisitor::visitPreStart(FTextStream &t, + const QList<DocNode> &children, + bool hasCaption, + const QCString &name, + const QCString &width, + const QCString &height, + bool inlineImage) { - QCString tmpStr; if (hasCaption) { t << " <figure>" << endl; + t << " <title>" << endl; + visitCaption(children); + t << " </title>" << endl; } else { @@ -73,23 +88,23 @@ void visitPreStart(FTextStream &t, bool hasCaption, QCString name, QCString wid } if (!height.isEmpty()) { - t << " depth=\"" << convertToDocBook(tmpStr) << "\""; + t << " depth=\"" << convertToDocBook(height) << "\""; } t << " align=\"center\" valign=\"middle\" scalefit=\"0\" fileref=\"" << name << "\">"; t << "</imagedata>" << endl; t << " </imageobject>" << endl; if (hasCaption) { - t << " <title>" << endl; + t << " <!--" << endl; // Needed for general formatting with title for other formats } } -void visitPostEnd(FTextStream &t, bool hasCaption, bool inlineImage) +void DocbookDocVisitor::visitPostEnd(FTextStream &t, bool hasCaption, bool inlineImage) { t << endl; if (hasCaption) { - t << " </title>" << endl; + t << " -->" << endl; // Needed for general formatting with title for other formats } t << " </mediaobject>" << endl; if (hasCaption) @@ -102,13 +117,6 @@ void visitPostEnd(FTextStream &t, bool hasCaption, bool inlineImage) } } -static void visitCaption(DocbookDocVisitor *parent, QList<DocNode> children) -{ - QListIterator<DocNode> cli(children); - DocNode *n; - for (cli.toFirst();(n=cli.current());++cli) n->accept(parent); -} - DocbookDocVisitor::DocbookDocVisitor(FTextStream &t,CodeOutputInterface &ci) : DocVisitor(DocVisitor_Docbook), m_t(t), m_ci(ci), m_insidePre(FALSE), m_hide(FALSE) { @@ -1165,7 +1173,7 @@ DB_VIS_C { baseName=baseName.right(baseName.length()-i-1); } - visitPreStart(m_t, img -> hasCaption(), img->relPath() + baseName, img -> width(), img -> height(),img -> isInlineImage()); + visitPreStart(m_t, img->children(), img->hasCaption(), img->relPath() + baseName, img->width(), img->height(), img->isInlineImage()); } else { @@ -1219,7 +1227,7 @@ void DocbookDocVisitor::visitPre(DocDotFile *df) { DB_VIS_C if (m_hide) return; - startDotFile(df->file(),df->width(),df->height(),df->hasCaption()); + startDotFile(df->file(),df->width(),df->height(),df->hasCaption(),df->children()); } void DocbookDocVisitor::visitPost(DocDotFile *df) @@ -1233,7 +1241,7 @@ void DocbookDocVisitor::visitPre(DocMscFile *df) { DB_VIS_C if (m_hide) return; - startMscFile(df->file(),df->width(),df->height(),df->hasCaption()); + startMscFile(df->file(),df->width(),df->height(),df->hasCaption(),df->children()); } void DocbookDocVisitor::visitPost(DocMscFile *df) @@ -1246,7 +1254,7 @@ void DocbookDocVisitor::visitPre(DocDiaFile *df) { DB_VIS_C if (m_hide) return; - startDiaFile(df->file(),df->width(),df->height(),df->hasCaption()); + startDiaFile(df->file(),df->width(),df->height(),df->hasCaption(),df->children()); } void DocbookDocVisitor::visitPost(DocDiaFile *df) @@ -1619,8 +1627,8 @@ DB_VIS_C } QCString outDir = Config_getString(DOCBOOK_OUTPUT); writeMscGraphFromFile(baseName+".msc",outDir,shortName,MSC_BITMAP); - visitPreStart(m_t, s->hasCaption(), s->relPath() + shortName + ".png", s->width(),s->height()); - visitCaption(this, s->children()); + visitPreStart(m_t, s->children(), s->hasCaption(), s->relPath() + shortName + ".png", s->width(), s->height()); + visitCaption(s->children()); visitPostEnd(m_t, s->hasCaption()); } @@ -1635,15 +1643,16 @@ DB_VIS_C } QCString outDir = Config_getString(DOCBOOK_OUTPUT); generatePlantUMLOutput(baseName,outDir,PUML_BITMAP); - visitPreStart(m_t, s->hasCaption(), s->relPath() + shortName + ".png", s->width(),s->height()); - visitCaption(this, s->children()); + visitPreStart(m_t, s->children(), s->hasCaption(), s->relPath() + shortName + ".png", s->width(),s->height()); + visitCaption(s->children()); visitPostEnd(m_t, s->hasCaption()); } void DocbookDocVisitor::startMscFile(const QCString &fileName, const QCString &width, const QCString &height, - bool hasCaption + bool hasCaption, + const QList<DocNode> &children ) { DB_VIS_C @@ -1661,7 +1670,7 @@ DB_VIS_C QCString outDir = Config_getString(DOCBOOK_OUTPUT); writeMscGraphFromFile(fileName,outDir,baseName,MSC_BITMAP); m_t << "<para>" << endl; - visitPreStart(m_t, hasCaption, baseName + ".png", width, height); + visitPreStart(m_t, children, hasCaption, baseName + ".png", width, height); } void DocbookDocVisitor::endMscFile(bool hasCaption) @@ -1683,15 +1692,16 @@ DB_VIS_C } QCString outDir = Config_getString(DOCBOOK_OUTPUT); writeDiaGraphFromFile(baseName+".dia",outDir,shortName,DIA_BITMAP); - visitPreStart(m_t, s->hasCaption(), shortName, s->width(),s->height()); - visitCaption(this, s->children()); + visitPreStart(m_t, s->children(), s->hasCaption(), shortName, s->width(),s->height()); + visitCaption(s->children()); visitPostEnd(m_t, s->hasCaption()); } void DocbookDocVisitor::startDiaFile(const QCString &fileName, const QCString &width, const QCString &height, - bool hasCaption + bool hasCaption, + const QList<DocNode> &children ) { DB_VIS_C @@ -1709,7 +1719,7 @@ DB_VIS_C QCString outDir = Config_getString(DOCBOOK_OUTPUT); writeDiaGraphFromFile(fileName,outDir,baseName,DIA_BITMAP); m_t << "<para>" << endl; - visitPreStart(m_t, hasCaption, baseName + ".png", width, height); + visitPreStart(m_t, children, hasCaption, baseName + ".png", width, height); } void DocbookDocVisitor::endDiaFile(bool hasCaption) @@ -1731,15 +1741,16 @@ DB_VIS_C } QCString outDir = Config_getString(DOCBOOK_OUTPUT); writeDotGraphFromFile(baseName+".dot",outDir,shortName,GOF_BITMAP); - visitPreStart(m_t, s->hasCaption(), s->relPath() + shortName + "." + getDotImageExtension(), s->width(),s->height()); - visitCaption(this, s->children()); + visitPreStart(m_t, s->children(), s->hasCaption(), s->relPath() + shortName + "." + getDotImageExtension(), s->width(),s->height()); + visitCaption(s->children()); visitPostEnd(m_t, s->hasCaption()); } void DocbookDocVisitor::startDotFile(const QCString &fileName, const QCString &width, const QCString &height, - bool hasCaption + bool hasCaption, + const QList<DocNode> &children ) { DB_VIS_C @@ -1758,7 +1769,7 @@ DB_VIS_C QCString imgExt = getDotImageExtension(); writeDotGraphFromFile(fileName,outDir,baseName,GOF_BITMAP); m_t << "<para>" << endl; - visitPreStart(m_t, hasCaption, baseName + "." + imgExt, width, height); + visitPreStart(m_t, children, hasCaption, baseName + "." + imgExt, width, height); } void DocbookDocVisitor::endDotFile(bool hasCaption) diff --git a/src/docbookvisitor.h b/src/docbookvisitor.h index 714b679..24b1fbb 100644 --- a/src/docbookvisitor.h +++ b/src/docbookvisitor.h @@ -20,15 +20,14 @@ #include "docvisitor.h" #include <qstack.h> +#include <qlist.h> #include <qcstring.h> +#include <docparser.h> class FTextStream; class CodeOutputInterface; class QCString; -void visitPreStart(FTextStream &t, bool hasCaption, QCString name, QCString width, QCString height, bool inlineImage=FALSE); -void visitPostEnd(FTextStream &t, bool hasCaption, bool inlineImage = FALSE); - /*! @brief Concrete visitor implementation for Docbook output. */ class DocbookDocVisitor : public DocVisitor { @@ -150,18 +149,27 @@ class DocbookDocVisitor : public DocVisitor void pushEnabled(); void popEnabled(); void startMscFile(const QCString &fileName,const QCString &width, - const QCString &height, bool hasCaption); + const QCString &height, bool hasCaption,const QList<DocNode> &children); void endMscFile(bool hasCaption); void writeMscFile(const QCString &fileName, DocVerbatim *s); void startDiaFile(const QCString &fileName,const QCString &width, - const QCString &height, bool hasCaption); + const QCString &height, bool hasCaption,const QList<DocNode> &children); void endDiaFile(bool hasCaption); void writeDiaFile(const QCString &fileName, DocVerbatim *s); void startDotFile(const QCString &fileName,const QCString &width, - const QCString &height, bool hasCaption); + const QCString &height, bool hasCaption,const QList<DocNode> &children); void endDotFile(bool hasCaption); void writeDotFile(const QCString &fileName, DocVerbatim *s); void writePlantUMLFile(const QCString &fileName, DocVerbatim *s); + void visitPreStart(FTextStream &t, + const QList<DocNode> &children, + bool hasCaption, + const QCString &name, + const QCString &width, + const QCString &height, + bool inlineImage = FALSE); + void visitPostEnd(FTextStream &t, bool hasCaption, bool inlineImage = FALSE); + void visitCaption(const QList<DocNode> &children); //-------------------------------------- // state variables //-------------------------------------- |