diff options
author | Dimitri van Heesch <doxygen@gmail.com> | 2021-05-01 12:05:36 (GMT) |
---|---|---|
committer | Dimitri van Heesch <doxygen@gmail.com> | 2021-05-01 12:05:36 (GMT) |
commit | 22ce9444ca5c73c8a343685309c1812c7f8d263b (patch) | |
tree | ff40f0535e20dbecdb9c061e4d6b7b30a7a63625 /src | |
parent | 65ad3c5747b855c34498f822a65e1492f1495983 (diff) | |
parent | 0dbc0d1c0b58bc06651137cd310a945a1db25151 (diff) | |
download | Doxygen-22ce9444ca5c73c8a343685309c1812c7f8d263b.zip Doxygen-22ce9444ca5c73c8a343685309c1812c7f8d263b.tar.gz Doxygen-22ce9444ca5c73c8a343685309c1812c7f8d263b.tar.bz2 |
Merge branch 'feature/bug_startuml' of https://github.com/albert-github/doxygen into albert-github-feature/bug_startuml
Diffstat (limited to 'src')
-rw-r--r-- | src/docbookvisitor.cpp | 2 | ||||
-rw-r--r-- | src/docparser.cpp | 66 | ||||
-rw-r--r-- | src/docparser.h | 3 | ||||
-rw-r--r-- | src/doctokenizer.l | 4 | ||||
-rw-r--r-- | src/htmldocvisitor.cpp | 2 | ||||
-rw-r--r-- | src/latexdocvisitor.cpp | 2 | ||||
-rw-r--r-- | src/plantuml.cpp | 6 | ||||
-rw-r--r-- | src/plantuml.h | 3 | ||||
-rw-r--r-- | src/rtfdocvisitor.cpp | 2 | ||||
-rw-r--r-- | src/vhdldocgen.cpp | 2 |
10 files changed, 79 insertions, 13 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..d7c044e 100644 --- a/src/docparser.cpp +++ b/src/docparser.cpp @@ -79,6 +79,10 @@ static const char *sectionLevelToName[] = "subparagraph" }; +static const char *plantumlStart[] = {"uml", "bpm", "wire", "dot", "ditaa", + "salt", "math", "latex", "gantt", "mindmap", + "wbs", "yaml", "creole", "json", "flow", + "board", "git"}; //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- @@ -5534,8 +5538,68 @@ 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); + QCString cmdName; + 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.lower(); + for (int i = 0; i < sizeof(plantumlStart) / sizeof(*plantumlStart); i++) + { + if (locOpt == plantumlStart[i]) + { + if (!engine.isEmpty()) + { + warn(g_fileName,getDoctokinizerLineNr(), "Multiple definition of engine for '\\startuml'"); + } + engine = plantumlStart[i]; + found = true; + break; + } + } + 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); 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); } |