summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/docbookgen.cpp3
-rw-r--r--src/docbookvisitor.cpp54
-rw-r--r--src/docbookvisitor.h17
3 files changed, 42 insertions, 32 deletions
diff --git a/src/docbookgen.cpp b/src/docbookgen.cpp
index 48b5d9e..6464701 100644
--- a/src/docbookgen.cpp
+++ b/src/docbookgen.cpp
@@ -904,7 +904,8 @@ 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);
+ QList<DocNode> dummy;
+ visitPreStart(t, FALSE, NULL, dummy, relPath + fileName + ".png", NULL, NULL);
d.writeImage(t,dir,relPath,fileName,FALSE);
visitPostEnd(t, FALSE);
t << "</para>" << endl;
diff --git a/src/docbookvisitor.cpp b/src/docbookvisitor.cpp
index 7a948ec..debb7d7 100644
--- a/src/docbookvisitor.cpp
+++ b/src/docbookvisitor.cpp
@@ -49,12 +49,22 @@
#define DB_VIS_C2a(x,y)
#endif
-void visitPreStart(FTextStream &t, bool hasCaption, QCString name, QCString width, QCString height, 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);
+}
+
+void visitPreStart(FTextStream &t, bool hasCaption, DocbookDocVisitor *parent, QList<DocNode> children, QCString name, QCString width, QCString height, bool inlineImage)
{
QCString tmpStr;
if (hasCaption)
{
t << " <figure>" << endl;
+ t << " <title>" << endl;
+ visitCaption(parent, children);
+ t << " </title>" << endl;
}
else
{
@@ -80,7 +90,7 @@ void visitPreStart(FTextStream &t, bool hasCaption, QCString name, QCString wid
t << " </imageobject>" << endl;
if (hasCaption)
{
- t << " <title>" << endl;
+ t << " <!--" << endl; // Needed for general formatting with title for other formats
}
}
@@ -89,7 +99,7 @@ void 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 +112,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 +1168,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 -> hasCaption(), this, img->children(), img->relPath() + baseName, img -> width(), img -> height(),img -> isInlineImage());
}
else
{
@@ -1219,7 +1222,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 +1236,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 +1249,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,7 +1622,7 @@ 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());
+ visitPreStart(m_t, s->hasCaption(), this, s->children(), s->relPath() + shortName + ".png", s->width(),s->height());
visitCaption(this, s->children());
visitPostEnd(m_t, s->hasCaption());
}
@@ -1635,7 +1638,7 @@ 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());
+ visitPreStart(m_t, s->hasCaption(), this, s->children(), s->relPath() + shortName + ".png", s->width(),s->height());
visitCaption(this, s->children());
visitPostEnd(m_t, s->hasCaption());
}
@@ -1643,7 +1646,8 @@ DB_VIS_C
void DocbookDocVisitor::startMscFile(const QCString &fileName,
const QCString &width,
const QCString &height,
- bool hasCaption
+ bool hasCaption,
+ QList<DocNode> childs
)
{
DB_VIS_C
@@ -1661,7 +1665,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, hasCaption,this, childs, baseName + ".png", width, height);
}
void DocbookDocVisitor::endMscFile(bool hasCaption)
@@ -1683,7 +1687,7 @@ 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());
+ visitPreStart(m_t, s->hasCaption(), this, s->children(), shortName, s->width(),s->height());
visitCaption(this, s->children());
visitPostEnd(m_t, s->hasCaption());
}
@@ -1691,7 +1695,8 @@ DB_VIS_C
void DocbookDocVisitor::startDiaFile(const QCString &fileName,
const QCString &width,
const QCString &height,
- bool hasCaption
+ bool hasCaption,
+ QList<DocNode> childs
)
{
DB_VIS_C
@@ -1709,7 +1714,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, hasCaption, this, childs, baseName + ".png", width, height);
}
void DocbookDocVisitor::endDiaFile(bool hasCaption)
@@ -1731,7 +1736,7 @@ 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());
+ visitPreStart(m_t, s->hasCaption(), this, s->children(), s->relPath() + shortName + "." + getDotImageExtension(), s->width(),s->height());
visitCaption(this, s->children());
visitPostEnd(m_t, s->hasCaption());
}
@@ -1739,7 +1744,8 @@ DB_VIS_C
void DocbookDocVisitor::startDotFile(const QCString &fileName,
const QCString &width,
const QCString &height,
- bool hasCaption
+ bool hasCaption,
+ QList<DocNode> childs
)
{
DB_VIS_C
@@ -1758,7 +1764,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, hasCaption, this, childs, baseName + "." + imgExt, width, height);
}
void DocbookDocVisitor::endDotFile(bool hasCaption)
diff --git a/src/docbookvisitor.h b/src/docbookvisitor.h
index 714b679..87035f8 100644
--- a/src/docbookvisitor.h
+++ b/src/docbookvisitor.h
@@ -20,16 +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
{
public:
@@ -150,15 +148,15 @@ 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,QList<DocNode> childs);
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,QList<DocNode> childs);
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,QList<DocNode> childs);
void endDotFile(bool hasCaption);
void writeDotFile(const QCString &fileName, DocVerbatim *s);
void writePlantUMLFile(const QCString &fileName, DocVerbatim *s);
@@ -173,4 +171,9 @@ class DocbookDocVisitor : public DocVisitor
QCString m_langExt;
};
+void visitPreStart(FTextStream &t, bool hasCaption, DocbookDocVisitor *parent, QList<DocNode> children, 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. */
+
#endif