summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/docbookvisitor.cpp2
-rw-r--r--src/docparser.cpp70
-rw-r--r--src/docparser.h3
-rw-r--r--src/doctokenizer.l4
-rw-r--r--src/htmldocvisitor.cpp2
-rw-r--r--src/latexdocvisitor.cpp2
-rw-r--r--src/plantuml.cpp6
-rw-r--r--src/plantuml.h3
-rw-r--r--src/rtfdocvisitor.cpp2
-rw-r--r--src/vhdldocgen.cpp2
10 files changed, 80 insertions, 16 deletions
diff --git a/src/docbookvisitor.cpp b/src/docbookvisitor.cpp
index 2cfa6f0..e25c178 100644
--- a/src/docbookvisitor.cpp
+++ b/src/docbookvisitor.cpp
@@ -395,7 +395,7 @@ DB_VIS_C
case DocVerbatim::PlantUML:
{
static QCString docbookOutput = Config_getString(DOCBOOK_OUTPUT);
- QCString baseName = PlantumlManager::instance().writePlantUMLSource(docbookOutput,s->exampleFile(),s->text(),PlantumlManager::PUML_BITMAP);
+ QCString baseName = PlantumlManager::instance().writePlantUMLSource(docbookOutput,s->exampleFile(),s->text(),PlantumlManager::PUML_BITMAP,s->engine());
QCString shortName = baseName;
int i;
if ((i=shortName.findRev('/'))!=-1)
diff --git a/src/docparser.cpp b/src/docparser.cpp
index 6e2a6d8..de28a65 100644
--- a/src/docparser.cpp
+++ b/src/docparser.cpp
@@ -69,7 +69,7 @@
//---------------------------------------------------------------------------
-static const char *sectionLevelToName[] =
+static const char *g_sectionLevelToName[] =
{
"page",
"section",
@@ -79,6 +79,13 @@ static const char *sectionLevelToName[] =
"subparagraph"
};
+static std::set<QCString> g_plantumlEngine {
+ "uml", "bpm", "wire", "dot", "ditaa",
+ "salt", "math", "latex", "gantt", "mindmap",
+ "wbs", "yaml", "creole", "json", "flow",
+ "board", "git"
+};
+
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
@@ -5534,8 +5541,63 @@ int DocPara::handleCommand(const QCString &cmdName, const int tok)
static QCString jarPath = Config_getString(PLANTUML_JAR_PATH);
doctokenizerYYsetStatePlantUMLOpt();
retval = doctokenizerYYlex();
- QCString plantFile(g_token->sectionId);
+
+ QCString fullMatch = g_token->sectionId;
+ QCString sectionId = "";
+ int idx = fullMatch.find('{');
+ int idxEnd = fullMatch.find("}",idx+1);
+ StringVector optList;
+ QCString engine;
+ if (idx != -1) // options present
+ {
+ QCString optStr = fullMatch.mid(idx+1,idxEnd-idx-1).stripWhiteSpace();
+ optList = split(optStr.str(),",");
+ for (const auto &opt : optList)
+ {
+ if (opt.empty()) continue;
+ bool found = false;
+ QCString locOpt(opt);
+ locOpt = locOpt.stripWhiteSpace().lower();
+ if (g_plantumlEngine.find(locOpt)!=g_plantumlEngine.end())
+ {
+ if (!engine.isEmpty())
+ {
+ warn(g_fileName,getDoctokinizerLineNr(), "Multiple definition of engine for '\\startuml'");
+ }
+ engine = locOpt;
+ found = true;
+ }
+ if (!found)
+ {
+ if (sectionId.isEmpty())
+ {
+ sectionId = opt;
+ }
+ else
+ {
+ warn(g_fileName,getDoctokinizerLineNr(),"Multiple use of of filename for '\\startuml'");
+ }
+ }
+ }
+ }
+ else
+ {
+ sectionId = g_token->sectionId;
+ }
+ if (engine.isEmpty()) engine = "uml";
+
+ if (sectionId.isEmpty())
+ {
+ doctokenizerYYsetStatePlantUMLOpt();
+ retval = doctokenizerYYlex();
+
+ sectionId = g_token->sectionId;
+ sectionId = sectionId.stripWhiteSpace();
+ }
+
+ QCString plantFile(sectionId);
DocVerbatim *dv = new DocVerbatim(this,g_context,g_token->verb,DocVerbatim::PlantUML,FALSE,plantFile);
+ dv->setEngine(engine);
doctokenizerYYsetStatePara();
QCString width,height;
defaultHandleTitleAndSize(CMD_STARTUML,dv,dv->children(),width,height);
@@ -6802,7 +6864,7 @@ int DocSection::parse()
else if (retval==RetVal_Subsubsection && m_level<=Doxygen::subpageNestingLevel+2)
{
if ((m_level<=1+Doxygen::subpageNestingLevel) && !g_token->sectionId.startsWith("autotoc_md"))
- warn_doc_error(g_fileName,getDoctokinizerLineNr(),"Unexpected subsubsection command found inside %s!",sectionLevelToName[m_level]);
+ warn_doc_error(g_fileName,getDoctokinizerLineNr(),"Unexpected subsubsection command found inside %s!",g_sectionLevelToName[m_level]);
// then parse any number of nested sections
while (retval==RetVal_Subsubsection) // more sections follow
{
@@ -6816,7 +6878,7 @@ int DocSection::parse()
else if (retval==RetVal_Paragraph && m_level<=std::min(5,Doxygen::subpageNestingLevel+3))
{
if ((m_level<=2+Doxygen::subpageNestingLevel) && !g_token->sectionId.startsWith("autotoc_md"))
- warn_doc_error(g_fileName,getDoctokinizerLineNr(),"Unexpected paragraph command found inside %s!",sectionLevelToName[m_level]);
+ warn_doc_error(g_fileName,getDoctokinizerLineNr(),"Unexpected paragraph command found inside %s!",g_sectionLevelToName[m_level]);
// then parse any number of nested sections
while (retval==RetVal_Paragraph) // more sections follow
{
diff --git a/src/docparser.h b/src/docparser.h
index 3de54bd..548376d 100644
--- a/src/docparser.h
+++ b/src/docparser.h
@@ -507,11 +507,13 @@ class DocVerbatim : public DocNode
bool hasCaption() const { return !m_children.empty(); }
QCString width() const { return m_width; }
QCString height() const { return m_height; }
+ QCString engine() const { return m_engine; }
const DocNodeList &children() const { return m_children; }
DocNodeList &children() { return m_children; }
void setText(const QCString &t) { m_text=t; }
void setWidth(const QCString &w) { m_width=w; }
void setHeight(const QCString &h) { m_height=h; }
+ void setEngine(const QCString &e) { m_engine=e; }
private:
QCString m_context;
@@ -524,6 +526,7 @@ class DocVerbatim : public DocNode
bool m_isBlock = false;
QCString m_width;
QCString m_height;
+ QCString m_engine;
DocNodeList m_children;
};
diff --git a/src/doctokenizer.l b/src/doctokenizer.l
index 3897290..91aacab 100644
--- a/src/doctokenizer.l
+++ b/src/doctokenizer.l
@@ -965,10 +965,8 @@ RCSID "$"("Author"|"Date"|"Header"|"Id"|"Locker"|"Log"|"Name"|"RCSfile"|"Revisio
lineCount(yytext,yyleng);
g_token->verb+=yytext;
}
-<St_PlantUMLOpt>{BLANK}*"{"[^}]*"}" { // case 1: file name is specified as {filename}
+<St_PlantUMLOpt>{BLANK}*"{"[a-zA-Z_,:0-9\. ]*"}" { // case 1: options present
g_token->sectionId = QCString(yytext).stripWhiteSpace();
- // skip curly brackets around the optional image name
- g_token->sectionId = g_token->sectionId.mid(1,g_token->sectionId.length()-2).stripWhiteSpace();
return RetVal_OK;
}
<St_PlantUMLOpt>{BLANK}*{FILEMASK}{BLANK}+/{ID}"=" { // case 2: plain file name specified followed by an attribute
diff --git a/src/htmldocvisitor.cpp b/src/htmldocvisitor.cpp
index a11d045..a1c0fb4 100644
--- a/src/htmldocvisitor.cpp
+++ b/src/htmldocvisitor.cpp
@@ -628,7 +628,7 @@ void HtmlDocVisitor::visit(DocVerbatim *s)
{
format = PlantumlManager::PUML_SVG;
}
- QCString baseName = PlantumlManager::instance().writePlantUMLSource(htmlOutput,s->exampleFile(),s->text(),format);
+ QCString baseName = PlantumlManager::instance().writePlantUMLSource(htmlOutput,s->exampleFile(),s->text(),format,s->engine());
m_t << "<div class=\"plantumlgraph\">\n";
writePlantUMLFile(baseName,s->relPath(),s->context());
visitPreCaption(m_t, s);
diff --git a/src/latexdocvisitor.cpp b/src/latexdocvisitor.cpp
index 589cb0b..304d6eb 100644
--- a/src/latexdocvisitor.cpp
+++ b/src/latexdocvisitor.cpp
@@ -432,7 +432,7 @@ void LatexDocVisitor::visit(DocVerbatim *s)
case DocVerbatim::PlantUML:
{
QCString latexOutput = Config_getString(LATEX_OUTPUT);
- QCString baseName = PlantumlManager::instance().writePlantUMLSource(latexOutput,s->exampleFile(),s->text(),PlantumlManager::PUML_EPS);
+ QCString baseName = PlantumlManager::instance().writePlantUMLSource(latexOutput,s->exampleFile(),s->text(),PlantumlManager::PUML_EPS,s->engine());
writePlantUMLFile(baseName, s);
}
diff --git a/src/plantuml.cpp b/src/plantuml.cpp
index a88289a..12e0fee 100644
--- a/src/plantuml.cpp
+++ b/src/plantuml.cpp
@@ -23,7 +23,7 @@
#include "fileinfo.h"
#include "dir.h"
-QCString PlantumlManager::writePlantUMLSource(const QCString &outDirArg,const QCString &fileName,const QCString &content,OutputFormat format)
+QCString PlantumlManager::writePlantUMLSource(const QCString &outDirArg,const QCString &fileName,const QCString &content,OutputFormat format, const QCString &engine)
{
QCString baseName;
QCString puName;
@@ -72,9 +72,9 @@ QCString PlantumlManager::writePlantUMLSource(const QCString &outDirArg,const QC
Debug::print(Debug::Plantuml,0,"*** %s puName: %s\n","writePlantUMLSource",qPrint(puName));
Debug::print(Debug::Plantuml,0,"*** %s imgName: %s\n","writePlantUMLSource",qPrint(imgName));
- QCString text = "@startuml "+imgName+"\n";
+ QCString text = "@start"+engine+" "+imgName+"\n";
text+=content;
- text+="\n@enduml\n";
+ text+="\n@end"+engine+"\n";
QCString qcOutDir(outDir);
uint pos = qcOutDir.findRev("/");
diff --git a/src/plantuml.h b/src/plantuml.h
index 6b439f4..53c39a7 100644
--- a/src/plantuml.h
+++ b/src/plantuml.h
@@ -54,12 +54,13 @@ class PlantumlManager
* @param[in] format the image format to generate.
* @returns The name of the generated file.
*/
- QCString writePlantUMLSource(const QCString &outDir,const QCString &fileName,const QCString &content, OutputFormat format);
+ QCString writePlantUMLSource(const QCString &outDir,const QCString &fileName,const QCString &content, OutputFormat format, const QCString &engine);
/** Convert a PlantUML file to an image.
* @param[in] baseName the name of the generated file (as returned by writePlantUMLSource())
* @param[in] outDir the directory to write the resulting image into.
* @param[in] format the image format to generate.
+ * @param[in] engine the plantuml engine to be used so the start command will be `@start<engine>`
*/
void generatePlantUMLOutput(const QCString &baseName,const QCString &outDir,OutputFormat format);
diff --git a/src/rtfdocvisitor.cpp b/src/rtfdocvisitor.cpp
index 4e7cfda..1fb9bab 100644
--- a/src/rtfdocvisitor.cpp
+++ b/src/rtfdocvisitor.cpp
@@ -382,7 +382,7 @@ void RTFDocVisitor::visit(DocVerbatim *s)
case DocVerbatim::PlantUML:
{
static QCString rtfOutput = Config_getString(RTF_OUTPUT);
- QCString baseName = PlantumlManager::instance().writePlantUMLSource(rtfOutput,s->exampleFile(),s->text(),PlantumlManager::PUML_BITMAP);
+ QCString baseName = PlantumlManager::instance().writePlantUMLSource(rtfOutput,s->exampleFile(),s->text(),PlantumlManager::PUML_BITMAP,s->engine());
writePlantUMLFile(baseName, s->hasCaption());
visitCaption(this, s->children());
diff --git a/src/vhdldocgen.cpp b/src/vhdldocgen.cpp
index f0763db..7e7051f 100644
--- a/src/vhdldocgen.cpp
+++ b/src/vhdldocgen.cpp
@@ -3341,7 +3341,7 @@ void FlowChart::printUmlTree()
QCString htmlOutDir = Config_getString(HTML_OUTPUT);
QCString n=convertNameToFileName();
- n=PlantumlManager::instance().writePlantUMLSource(htmlOutDir,n,qcs,PlantumlManager::PUML_SVG);
+ n=PlantumlManager::instance().writePlantUMLSource(htmlOutDir,n,qcs,PlantumlManager::PUML_SVG,"uml");
PlantumlManager::instance().generatePlantUMLOutput(n,htmlOutDir,PlantumlManager::PUML_SVG);
}