diff options
author | Dimitri van Heesch <dimitri@stack.nl> | 2014-08-10 18:09:33 (GMT) |
---|---|---|
committer | Dimitri van Heesch <dimitri@stack.nl> | 2014-08-10 18:09:33 (GMT) |
commit | 7506404e646f1fcc5a26ca6fca91a7f65154f05a (patch) | |
tree | f97964759aa6238f02bd5b7f853306c19965914d /src/docbookvisitor.cpp | |
parent | 97d12d058a7831adcc8c6f2cfe8c20ddd2ae5bc2 (diff) | |
download | Doxygen-7506404e646f1fcc5a26ca6fca91a7f65154f05a.zip Doxygen-7506404e646f1fcc5a26ca6fca91a7f65154f05a.tar.gz Doxygen-7506404e646f1fcc5a26ca6fca91a7f65154f05a.tar.bz2 |
Bug 731947 - Support for PlantUML
Diffstat (limited to 'src/docbookvisitor.cpp')
-rw-r--r-- | src/docbookvisitor.cpp | 94 |
1 files changed, 67 insertions, 27 deletions
diff --git a/src/docbookvisitor.cpp b/src/docbookvisitor.cpp index 5d7aafd..9f2dbe3 100644 --- a/src/docbookvisitor.cpp +++ b/src/docbookvisitor.cpp @@ -34,6 +34,7 @@ #include "msc.h" #include "dia.h" #include "htmlentity.h" +#include "plantuml.h" DocbookDocVisitor::DocbookDocVisitor(FTextStream &t,CodeOutputInterface &ci) : DocVisitor(DocVisitor_Docbook), m_t(t), m_ci(ci), m_insidePre(FALSE), m_hide(FALSE) @@ -216,35 +217,58 @@ void DocbookDocVisitor::visit(DocVerbatim *s) } break; case DocVerbatim::Msc: - static int mscindex = 1; - QCString baseName(4096); - QCString name; - QCString stext = s->text(); - m_t << "<para>" << endl; - name.sprintf("%s%d", "msc_inline_mscgraph_", mscindex); - baseName.sprintf("%s%d", - (Config_getString("DOCBOOK_OUTPUT")+"/inline_mscgraph_").data(), - mscindex++ - ); - QFile file(baseName+".msc"); - if (!file.open(IO_WriteOnly)) { - err("Could not open file %s.msc for writing\n",baseName.data()); + static int mscindex = 1; + QCString baseName(4096); + QCString name; + QCString stext = s->text(); + m_t << "<para>" << endl; + name.sprintf("%s%d", "msc_inline_mscgraph_", mscindex); + baseName.sprintf("%s%d", + (Config_getString("DOCBOOK_OUTPUT")+"/inline_mscgraph_").data(), + mscindex++ + ); + QFile file(baseName+".msc"); + if (!file.open(IO_WriteOnly)) + { + err("Could not open file %s.msc for writing\n",baseName.data()); + } + QCString text = "msc {"; + text+=stext; + text+="}"; + file.writeBlock( text, text.length() ); + file.close(); + m_t << " <figure>" << endl; + m_t << " <title>" << name << "</title>" << endl; + m_t << " <mediaobject>" << endl; + m_t << " <imageobject>" << endl; + writeMscFile(baseName); + m_t << " </imageobject>" << endl; + m_t << " </mediaobject>" << endl; + m_t << " </figure>" << endl; + m_t << "</para>" << endl; + } + break; + case DocVerbatim::PlantUML: + { + static QCString docbookOutput = Config_getString("DOCBOOK_OUTPUT"); + QCString baseName = writePlantUMLSource(docbookOutput,s->exampleFile(),s->text()); + QCString shortName = baseName; + int i; + if ((i=shortName.findRev('/'))!=-1) + { + shortName=shortName.right(shortName.length()-i-1); + } + m_t << " <figure>" << endl; + m_t << " <title>" << shortName << "</title>" << endl; + m_t << " <mediaobject>" << endl; + m_t << " <imageobject>" << endl; + writePlantUMLFile(baseName); + m_t << " </imageobject>" << endl; + m_t << " </mediaobject>" << endl; + m_t << " </figure>" << endl; + m_t << "</para>" << endl; } - QCString text = "msc {"; - text+=stext; - text+="}"; - file.writeBlock( text, text.length() ); - file.close(); - m_t << " <figure>" << endl; - m_t << " <title>" << name << "</title>" << endl; - m_t << " <mediaobject>" << endl; - m_t << " <imageobject>" << endl; - writeMscFile(baseName); - m_t << " </imageobject>" << endl; - m_t << " </mediaobject>" << endl; - m_t << " </figure>" << endl; - m_t << "</para>" << endl; break; } } @@ -1195,6 +1219,22 @@ void DocbookDocVisitor::writeMscFile(const QCString &baseName) m_t << "</imagedata>" << endl; } +void DocbookDocVisitor::writePlantUMLFile(const QCString &baseName) +{ + QCString shortName = baseName; + int i; + if ((i=shortName.findRev('/'))!=-1) + { + shortName=shortName.right(shortName.length()-i-1); + } + QCString outDir = Config_getString("DOCBOOK_OUTPUT"); + generatePlantUMLOutput(baseName,outDir,PUML_BITMAP); + m_t << " <imagedata"; + m_t << " width=\"50%\""; + m_t << " align=\"center\" valign=\"middle\" scalefit=\"1\" fileref=\"" << shortName << ".png" << "\">"; + m_t << "</imagedata>" << endl; +} + void DocbookDocVisitor::startMscFile(const QCString &fileName, const QCString &width, const QCString &height, |