summaryrefslogtreecommitdiffstats
path: root/src/htmldocvisitor.cpp
diff options
context:
space:
mode:
authoralbert-github <albert.tests@gmail.com>2014-11-28 13:44:07 (GMT)
committeralbert-github <albert.tests@gmail.com>2014-11-28 13:44:07 (GMT)
commit329a4ddc036ac9dfe72b11d62cb4043bc8488c20 (patch)
tree8ca50b460259cbadced0e68f100ba3fb620faed7 /src/htmldocvisitor.cpp
parent0fea3d4ca57187f271d7580ff16f32b7ab4657df (diff)
downloadDoxygen-329a4ddc036ac9dfe72b11d62cb4043bc8488c20.zip
Doxygen-329a4ddc036ac9dfe72b11d62cb4043bc8488c20.tar.gz
Doxygen-329a4ddc036ac9dfe72b11d62cb4043bc8488c20.tar.bz2
Limit images sizes and make more uniform (LaTeX)
This patch adjusts some problems regarding image sizes in LaTeX output of doxygen (a.o. Bug 738299 - When using msc or PlantUML, the default latex for the created image should include [width=\linewidth]) this has been done is such a way that all the "image" commands (i.e. image, dot, dotfile, msc, mscfile, diafile, startuml) operate in a similar way / have the same possibilities. - commands.doc Adjusted documentation to reflect changes. - cmdmapper.cpp - cmdmapper.h Added utility function to map command id back to command name - doctokenizer.h - doctokenizer.l Handle Caption and Size indication. Required also that some other rules had to be tightened a bit (like usage of {} in startuml and usage of "" for captions. This was already described in the documentation in this way). - docparser.cpp - docparser.h Created routine to uniformly handle the Caption and size indications and store them in a general way. - latexgen.cpp Replaced graphicx package by adjustbox package (includes graphicx) to support "min width" etc. - doxygen.sty templates\latex Added commands to make commands with and without caption behave similar. - docbookvisitor.cpp - docbookvisitor.h - htmldocvisitor.cpp - latexdocvisitor.cpp - latexdocvisitor.h - printdocvisitor.h - xmldocvisitor.cpp Created routine to uniformly handle the Caption and size indications in a general way. - indexpage.xml (testing\022) - indexpage.xml (testing\031) - class_receiver.xml (testing\037) - class_sender.xml (testing\037) Adjusted example output.
Diffstat (limited to 'src/htmldocvisitor.cpp')
-rw-r--r--src/htmldocvisitor.cpp76
1 files changed, 59 insertions, 17 deletions
diff --git a/src/htmldocvisitor.cpp b/src/htmldocvisitor.cpp
index e319a1f..4d61ca7 100644
--- a/src/htmldocvisitor.cpp
+++ b/src/htmldocvisitor.cpp
@@ -325,6 +325,32 @@ void HtmlDocVisitor::visit(DocStyleChange *s)
}
+static void visitPreCaption(FTextStream &t, DocVerbatim *s)
+{
+ if (s->hasCaption())
+ {
+ t << "<div class=\"caption\">" << endl;
+ }
+}
+
+
+static void visitPostCaption(FTextStream &t, DocVerbatim *s)
+{
+ if (s->hasCaption())
+ {
+ t << "</div>" << endl;
+ }
+}
+
+
+static void visitCaption(HtmlDocVisitor *parent, QList<DocNode> children)
+{
+ QListIterator<DocNode> cli(children);
+ DocNode *n;
+ for (cli.toFirst();(n=cli.current());++cli) n->accept(parent);
+}
+
+
void HtmlDocVisitor::visit(DocVerbatim *s)
{
if (m_hide) return;
@@ -382,6 +408,7 @@ void HtmlDocVisitor::visit(DocVerbatim *s)
static int dotindex = 1;
QCString fileName(4096);
+ forceEndParagraph(s);
fileName.sprintf("%s%d%s",
(Config_getString("HTML_OUTPUT")+"/inline_dotgraph_").data(),
dotindex++,
@@ -392,16 +419,21 @@ void HtmlDocVisitor::visit(DocVerbatim *s)
{
err("Could not open file %s for writing\n",fileName.data());
}
- file.writeBlock( s->text(), s->text().length() );
- file.close();
+ else
+ {
+ file.writeBlock( s->text(), s->text().length() );
+ file.close();
- forceEndParagraph(s);
- m_t << "<div align=\"center\">" << endl;
- writeDotFile(fileName,s->relPath(),s->context());
- m_t << "</div>" << endl;
- forceStartParagraph(s);
+ m_t << "<div align=\"center\">" << endl;
+ writeDotFile(fileName,s->relPath(),s->context());
+ visitPreCaption(m_t, s);
+ visitCaption(this, s->m_children);
+ visitPostCaption(m_t, s);
+ m_t << "</div>" << endl;
- if (Config_getBool("DOT_CLEANUP")) file.remove();
+ if (Config_getBool("DOT_CLEANUP")) file.remove();
+ }
+ forceStartParagraph(s);
}
break;
case DocVerbatim::Msc:
@@ -420,17 +452,24 @@ void HtmlDocVisitor::visit(DocVerbatim *s)
{
err("Could not open file %s.msc for writing\n",baseName.data());
}
- QCString text = "msc {";
- text+=s->text();
- text+="}";
+ else
+ {
+ QCString text = "msc {";
+ text+=s->text();
+ text+="}";
- file.writeBlock( text, text.length() );
- file.close();
+ file.writeBlock( text, text.length() );
+ file.close();
- m_t << "<div align=\"center\">" << endl;
- writeMscFile(baseName+".msc",s->relPath(),s->context());
- if (Config_getBool("DOT_CLEANUP")) file.remove();
- m_t << "</div>" << endl;
+ m_t << "<div align=\"center\">" << endl;
+ writeMscFile(baseName+".msc",s->relPath(),s->context());
+ visitPreCaption(m_t, s);
+ visitCaption(this, s->m_children);
+ visitPostCaption(m_t, s);
+ m_t << "</div>" << endl;
+
+ if (Config_getBool("DOT_CLEANUP")) file.remove();
+ }
forceStartParagraph(s);
}
break;
@@ -442,6 +481,9 @@ void HtmlDocVisitor::visit(DocVerbatim *s)
QCString baseName = writePlantUMLSource(htmlOutput,s->exampleFile(),s->text());
m_t << "<div align=\"center\">" << endl;
writePlantUMLFile(baseName,s->relPath(),s->context());
+ visitPreCaption(m_t, s);
+ visitCaption(this, s->m_children);
+ visitPostCaption(m_t, s);
m_t << "</div>" << endl;
forceStartParagraph(s);
}