summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDimitri van Heesch <dimitri@stack.nl>2014-12-22 10:14:03 (GMT)
committerDimitri van Heesch <dimitri@stack.nl>2014-12-22 10:14:03 (GMT)
commit223e7de6478019c8eebcfd87085fe22d3bfeec0e (patch)
tree2297b1d3beea204dfe48f39e41a95286f5581e8e /src
parent67e8d626fec0c4365106902dcd16b988b8cceb10 (diff)
downloadDoxygen-223e7de6478019c8eebcfd87085fe22d3bfeec0e.zip
Doxygen-223e7de6478019c8eebcfd87085fe22d3bfeec0e.tar.gz
Doxygen-223e7de6478019c8eebcfd87085fe22d3bfeec0e.tar.bz2
various fixes and restructuring
Diffstat (limited to 'src')
-rw-r--r--src/docbookvisitor.cpp27
-rw-r--r--src/docparser.cpp220
-rw-r--r--src/docparser.h10
-rw-r--r--src/doctokenizer.h2
-rw-r--r--src/doctokenizer.l90
-rw-r--r--src/htmldocvisitor.cpp6
-rw-r--r--src/latexdocvisitor.cpp12
-rw-r--r--src/latexgen.cpp4
-rw-r--r--src/xmldocvisitor.cpp23
9 files changed, 100 insertions, 294 deletions
diff --git a/src/docbookvisitor.cpp b/src/docbookvisitor.cpp
index 35cc342..90262e3 100644
--- a/src/docbookvisitor.cpp
+++ b/src/docbookvisitor.cpp
@@ -46,14 +46,7 @@ static void visitPreStart(FTextStream &t, const bool hasCaption, QCString name,
t << " <imagedata";
if (!width.isEmpty())
{
- tmpStr = width;
- tmpStr = tmpStr.replace(QRegExp("min *width"),"minwidth");
- tmpStr = tmpStr.replace(QRegExp("max *width"),"maxwidth");
- tmpStr = tmpStr.replace(QRegExp("="),"=\"");
- tmpStr = tmpStr.replace(QRegExp(","),"\" ") + "\"";
- tmpStr = tmpStr.replace(QRegExp("\"\""),"\"");
- tmpStr = tmpStr.replace(QRegExp("\\"),"\\\\");
- t << " " << tmpStr;
+ t << " width=\"" << convertToXML(width) << "\"";
}
else
{
@@ -61,15 +54,7 @@ static void visitPreStart(FTextStream &t, const bool hasCaption, QCString name,
}
if (!height.isEmpty())
{
- tmpStr = height;
- tmpStr = tmpStr.replace(QRegExp("min *height"),"mindepth");
- tmpStr = tmpStr.replace(QRegExp("max *height"),"maxdepth");
- tmpStr = tmpStr.replace(QRegExp("height="),"depth=");
- tmpStr = tmpStr.replace(QRegExp("="),"=\"");
- tmpStr = tmpStr.replace(QRegExp(","),"\" ") + "\"";
- tmpStr = tmpStr.replace(QRegExp("\"\""),"\"");
- tmpStr = tmpStr.replace(QRegExp("\\"),"\\\\");
- t << " " << tmpStr;
+ t << " depth=\"" << convertToXML(tmpStr) << "\"";
}
t << " align=\"center\" valign=\"middle\" scalefit=\"1\" fileref=\"" << name << "\">";
t << "</imagedata>" << endl;
@@ -1238,7 +1223,7 @@ void DocbookDocVisitor::writeMscFile(const QCString &baseName, DocVerbatim *s)
QCString outDir = Config_getString("DOCBOOK_OUTPUT");
writeMscGraphFromFile(baseName+".msc",outDir,shortName,MSC_BITMAP);
visitPreStart(m_t, s->hasCaption(), shortName, s->width(),s->height());
- visitCaption(this, s->m_children);
+ visitCaption(this, s->children());
visitPostEnd(m_t, s->hasCaption());
}
@@ -1253,7 +1238,7 @@ void DocbookDocVisitor::writePlantUMLFile(const QCString &baseName, DocVerbatim
QCString outDir = Config_getString("DOCBOOK_OUTPUT");
generatePlantUMLOutput(baseName,outDir,PUML_BITMAP);
visitPreStart(m_t, s->hasCaption(), shortName, s->width(),s->height());
- visitCaption(this, s->m_children);
+ visitCaption(this, s->children());
visitPostEnd(m_t, s->hasCaption());
}
@@ -1298,7 +1283,7 @@ void DocbookDocVisitor::writeDiaFile(const QCString &baseName, DocVerbatim *s)
QCString outDir = Config_getString("DOCBOOK_OUTPUT");
writeDiaGraphFromFile(baseName+".dia",outDir,shortName,DIA_BITMAP);
visitPreStart(m_t, s->hasCaption(), shortName, s->width(),s->height());
- visitCaption(this, s->m_children);
+ visitCaption(this, s->children());
visitPostEnd(m_t, s->hasCaption());
}
@@ -1344,7 +1329,7 @@ void DocbookDocVisitor::writeDotFile(const QCString &baseName, DocVerbatim *s)
QCString imgExt = Config_getEnum("DOT_IMAGE_FORMAT");
writeDotGraphFromFile(baseName+".dot",outDir,shortName,GOF_BITMAP);
visitPreStart(m_t, s->hasCaption(), baseName + ".dot", s->width(),s->height());
- visitCaption(this, s->m_children);
+ visitCaption(this, s->children());
visitPostEnd(m_t, s->hasCaption());
}
diff --git a/src/docparser.cpp b/src/docparser.cpp
index a97a6cb..f73ef7e 100644
--- a/src/docparser.cpp
+++ b/src/docparser.cpp
@@ -839,9 +839,6 @@ static bool findDocsForMemberOrCompound(const char *commandName,
static bool defaultHandleToken(DocNode *parent,int tok,
QList<DocNode> &children,bool
handleWord=TRUE);
-static void defaultHandleCaptionSize(const int cmd, DocNode *parent, QList<DocNode> &children,
- QCString &height, QCString &width);
-
static int handleStyleArgument(DocNode *parent,QList<DocNode> &children,
const QCString &cmdName)
@@ -1243,65 +1240,32 @@ static DocAnchor *handleAnchor(DocNode *parent)
}
-/* Helper function that deals with the Caption and size argument.
- * @param parent Parent node, owner of the children list passed as
- * the third argument.
- * @param children The list of child nodes to which the node representing
- * the token can be added.
- * @param height Storagre for, optional, height
- * @param width Storagre for, optional, width
+/* Helper function that deals with the title, width, and height arguments of various commands.
+ * @param[in] cmd Command id for which to extract caption and size info.
+ * @param[in] parent Parent node, owner of the children list passed as
+ * the third argument.
+ * @param[in] children The list of child nodes to which the node representing
+ * the token can be added.
+ * @param[out] width the extracted width specifier
+ * @param[out] height the extracted height specifier
*/
-static void defaultHandleCaptionSize(const int cmd, DocNode *parent, QList<DocNode> &children, QCString &height, QCString &width)
+static void defaultHandleTitleAndSize(const int cmd, DocNode *parent, QList<DocNode> &children, QCString &width,QCString &height)
{
- QCString preamble = "";
- int insideString = 0;
g_nodeStack.push(parent);
// parse title
- doctokenizerYYsetStateCaption();
+ doctokenizerYYsetStateTitle();
int tok;
while ((tok=doctokenizerYYlex()))
{
- if (tok==TK_WORD && g_token->name=="width=")
- {
- // special case: no title, but we do have a size indicator
- doctokenizerYYsetStateTitleAttr();
- // strip =
- width=preamble + g_token->name + g_token->chars;
- g_token->chars = "";
- g_token->name = "";
- preamble = "";
- do
- {
- tok=doctokenizerYYlex();
- } while (tok == TK_WHITESPACE);
- break;
- }
- if (tok==TK_WORD && g_token->name=="height=")
+ if (tok==TK_WORD && (g_token->name=="width=" || g_token->name=="height="))
{
// special case: no title, but we do have a size indicator
- doctokenizerYYsetStateTitleAttr();
+ doctokenizerYYsetStateTitleAttrValue();
// strip =
- height=preamble + g_token->name + g_token->chars;
- g_token->chars = "";
- g_token->name = "";
- preamble = "";
- do
- {
- tok=doctokenizerYYlex();
- } while (tok == TK_WHITESPACE);
+ g_token->name = g_token->name.left(g_token->name.length()-1);
break;
}
- if (tok==TK_WORD && (g_token->name=="min" || g_token->name=="max"))
- {
- // special case: no title, but we do have a size indicator min or max
- if (!insideString)
- {
- preamble = g_token->name + " ";
- break;
- }
- }
- insideString = 1;
if (!defaultHandleToken(parent,tok,children))
{
switch (tok)
@@ -1330,41 +1294,18 @@ static void defaultHandleCaptionSize(const int cmd, DocNode *parent, QList<DocNo
{
if (g_token->name=="width")
{
- if (!width.isEmpty()) width += ",";
- width+=preamble + "width=" + g_token->chars;
- preamble = "";
- doctokenizerYYsetStateTitleAttr();
+ width = g_token->chars;
}
else if (g_token->name=="height")
{
- if (!height.isEmpty()) height += ",";
- height+=preamble + "height=" + g_token->chars;
- preamble = "";
- doctokenizerYYsetStateTitleAttr();
- }
- else if (g_token->name=="max")
- {
- preamble = "max ";
- }
- else if (g_token->name=="min")
- {
- preamble = "min ";
+ height = g_token->chars;
}
else
{
- warn_doc_error(g_fileName,doctokenizerYYlineno,"Unknown option %s after \\%s command",
+ warn_doc_error(g_fileName,doctokenizerYYlineno,"Unknown option '%s' after \\%s command, expected 'width' or 'height'",
qPrint(g_token->name), Mappers::cmdMapper->find(cmd).data());
}
-
- do
- {
- tok=doctokenizerYYlex();
- if (tok==TK_WORD && (g_token->name=="width=" || g_token->name=="height="))
- {
- g_token->name=g_token->name.left(g_token->name.length()-1);
- tok=doctokenizerYYlex();
- }
- } while (tok == TK_WHITESPACE);
+ tok=doctokenizerYYlex();
}
doctokenizerYYsetStatePara();
@@ -1372,6 +1313,7 @@ static void defaultHandleCaptionSize(const int cmd, DocNode *parent, QList<DocNo
DocNode *n=g_nodeStack.pop();
ASSERT(n==parent);
}
+
/* Helper function that deals with the most common tokens allowed in
* title like sections.
* @param parent Parent node, owner of the children list passed as
@@ -2786,7 +2728,7 @@ DocDotFile::DocDotFile(DocNode *parent,const QCString &name,const QCString &cont
void DocDotFile::parse()
{
- defaultHandleCaptionSize(CMD_DOTFILE,this,m_children,m_height, m_width);
+ defaultHandleTitleAndSize(CMD_DOTFILE,this,m_children,m_width,m_height);
bool ambig;
FileDef *fd = findFileDef(Doxygen::dotFileNameDict,m_name,ambig);
@@ -2820,7 +2762,7 @@ DocMscFile::DocMscFile(DocNode *parent,const QCString &name,const QCString &cont
void DocMscFile::parse()
{
- defaultHandleCaptionSize(CMD_MSCFILE,this,m_children,m_height, m_width);
+ defaultHandleTitleAndSize(CMD_MSCFILE,this,m_children,m_width,m_height);
bool ambig;
FileDef *fd = findFileDef(Doxygen::mscFileNameDict,m_name,ambig);
@@ -2856,7 +2798,7 @@ DocDiaFile::DocDiaFile(DocNode *parent,const QCString &name,const QCString &cont
void DocDiaFile::parse()
{
- defaultHandleCaptionSize(CMD_DIAFILE,this,m_children,m_height, m_width);
+ defaultHandleTitleAndSize(CMD_DIAFILE,this,m_children,m_width,m_height);
bool ambig;
FileDef *fd = findFileDef(Doxygen::diaFileNameDict,m_name,ambig);
@@ -2903,7 +2845,7 @@ void DocVhdlFlow::parse()
switch (tok)
{
case TK_COMMAND:
- warn_doc_error(g_fileName,doctokenizerYYlineno,"Illegal command %s as part of a \\mscfile",
+ warn_doc_error(g_fileName,doctokenizerYYlineno,"Illegal command %s as part of a \\vhdlflow",
qPrint(g_token->name));
break;
case TK_SYMBOL:
@@ -2942,7 +2884,7 @@ DocImage::DocImage(DocNode *parent,const HtmlAttribList &attribs,const QCString
void DocImage::parse()
{
- defaultHandleCaptionSize(CMD_IMAGE,this,m_children,m_height, m_width);
+ defaultHandleTitleAndSize(CMD_IMAGE,this,m_children,m_width,m_height);
}
@@ -5006,7 +4948,7 @@ void DocPara::handleImage(const QCString &cmdName)
"%s is not valid",
qPrint(imgType),qPrint(cmdName));
return;
- }
+ }
doctokenizerYYsetStateFile();
tok=doctokenizerYYlex();
doctokenizerYYsetStatePara();
@@ -5022,55 +4964,8 @@ void DocPara::handleImage(const QCString &cmdName)
img->parse();
}
-void DocPara::handleDotFile(const QCString &cmdName)
-{
- int tok=doctokenizerYYlex();
- if (tok!=TK_WHITESPACE)
- {
- warn_doc_error(g_fileName,doctokenizerYYlineno,"expected whitespace after %s command",
- qPrint(cmdName));
- return;
- }
- doctokenizerYYsetStateFile();
- tok=doctokenizerYYlex();
- doctokenizerYYsetStatePara();
- if (tok!=TK_WORD)
- {
- warn_doc_error(g_fileName,doctokenizerYYlineno,"unexpected token %s as the argument of %s",
- tokToString(tok),qPrint(cmdName));
- return;
- }
- QCString name = g_token->name;
- DocDotFile *df = new DocDotFile(this,name,g_context);
- m_children.append(df);
- df->parse();
-}
-
-void DocPara::handleMscFile(const QCString &cmdName)
-{
- int tok=doctokenizerYYlex();
- if (tok!=TK_WHITESPACE)
- {
- warn_doc_error(g_fileName,doctokenizerYYlineno,"expected whitespace after %s command",
- qPrint(cmdName));
- return;
- }
- doctokenizerYYsetStateFile();
- tok=doctokenizerYYlex();
- doctokenizerYYsetStatePara();
- if (tok!=TK_WORD)
- {
- warn_doc_error(g_fileName,doctokenizerYYlineno,"unexpected token %s as the argument of %s",
- tokToString(tok),qPrint(cmdName));
- return;
- }
- QCString name = g_token->name;
- DocMscFile *df = new DocMscFile(this,name,g_context);
- m_children.append(df);
- df->parse();
-}
-
-void DocPara::handleDiaFile(const QCString &cmdName)
+template<class T>
+void DocPara::handleFile(const QCString &cmdName)
{
int tok=doctokenizerYYlex();
if (tok!=TK_WHITESPACE)
@@ -5089,7 +4984,7 @@ void DocPara::handleDiaFile(const QCString &cmdName)
return;
}
QCString name = g_token->name;
- DocDiaFile *df = new DocDiaFile(this,name,g_context);
+ T *df = new T(this,name,g_context);
m_children.append(df);
df->parse();
}
@@ -5520,21 +5415,15 @@ int DocPara::handleCommand(const QCString &cmdName)
break;
case CMD_DOT:
{
- /*
- * need a temporary variable to store information for width, height and caption
- * which will be written into te right variable.
- */
- DocVerbatim *tmp_dv = new DocVerbatim(this,g_context,g_token->verb,DocVerbatim::Dot,g_isExample,g_exampleName);
+ DocVerbatim *dv = new DocVerbatim(this,g_context,g_token->verb,DocVerbatim::Dot,g_isExample,g_exampleName);
doctokenizerYYsetStatePara();
- defaultHandleCaptionSize(CMD_DOT,tmp_dv,tmp_dv->m_children,tmp_dv->m_height,tmp_dv-> m_width);
-
+ QCString width,height;
+ defaultHandleTitleAndSize(CMD_DOT,dv,dv->children(),width,height);
doctokenizerYYsetStateDot();
retval = doctokenizerYYlex();
- DocVerbatim *dv = new DocVerbatim(this,g_context,g_token->verb,DocVerbatim::Dot,g_isExample,g_exampleName);
- dv -> m_width = tmp_dv -> m_width;
- dv -> m_height = tmp_dv -> m_height;
- dv -> m_children = tmp_dv -> m_children;
- delete tmp_dv;
+ dv->setText(g_token->verb);
+ dv->setWidth(width);
+ dv->setHeight(height);
m_children.append(dv);
if (retval==0) warn_doc_error(g_fileName,doctokenizerYYlineno,"dot section ended without end marker");
doctokenizerYYsetStatePara();
@@ -5542,21 +5431,15 @@ int DocPara::handleCommand(const QCString &cmdName)
break;
case CMD_MSC:
{
- /*
- * need a temporary variable to store information for width, height and caption
- * which will be written into te right variable.
- */
- DocVerbatim *tmp_dv = new DocVerbatim(this,g_context,g_token->verb,DocVerbatim::Msc,g_isExample,g_exampleName);
+ DocVerbatim *dv = new DocVerbatim(this,g_context,g_token->verb,DocVerbatim::Msc,g_isExample,g_exampleName);
doctokenizerYYsetStatePara();
- defaultHandleCaptionSize(CMD_MSC,tmp_dv,tmp_dv->m_children,tmp_dv->m_height,tmp_dv-> m_width);
-
+ QCString width,height;
+ defaultHandleTitleAndSize(CMD_MSC,dv,dv->children(),width,height);
doctokenizerYYsetStateMsc();
retval = doctokenizerYYlex();
- DocVerbatim *dv = new DocVerbatim(this,g_context,g_token->verb,DocVerbatim::Msc,g_isExample,g_exampleName);
- dv -> m_width = tmp_dv -> m_width;
- dv -> m_height = tmp_dv -> m_height;
- dv -> m_children = tmp_dv -> m_children;
- delete tmp_dv;
+ dv->setText(g_token->verb);
+ dv->setWidth(width);
+ dv->setHeight(height);
m_children.append(dv);
if (retval==0) warn_doc_error(g_fileName,doctokenizerYYlineno,"msc section ended without end marker");
doctokenizerYYsetStatePara();
@@ -5568,27 +5451,22 @@ int DocPara::handleCommand(const QCString &cmdName)
doctokenizerYYsetStatePlantUMLOpt();
retval = doctokenizerYYlex();
QCString plantFile(g_token->sectionId);
- /*
- * need a temporary variable to store information for width, height and caption
- * which will be written into te right variable.
- */
- DocVerbatim *tmp_dv = new DocVerbatim(this,g_context,g_token->verb,DocVerbatim::Msc,g_isExample,g_exampleName);
+ DocVerbatim *dv = new DocVerbatim(this,g_context,g_token->verb,DocVerbatim::PlantUML,FALSE,plantFile);
doctokenizerYYsetStatePara();
- defaultHandleCaptionSize(CMD_STARTUML,tmp_dv,tmp_dv->m_children,tmp_dv->m_height,tmp_dv-> m_width);
-
+ QCString width,height;
+ defaultHandleTitleAndSize(CMD_STARTUML,dv,dv->children(),width,height);
doctokenizerYYsetStatePlantUML();
retval = doctokenizerYYlex();
+ dv->setText(g_token->verb);
+ dv->setWidth(width);
+ dv->setHeight(height);
if (jarPath.isEmpty())
{
warn_doc_error(g_fileName,doctokenizerYYlineno,"ignoring \\startuml command because PLANTUML_JAR_PATH is not set");
+ delete dv;
}
else
{
- DocVerbatim *dv = new DocVerbatim(this,g_context,g_token->verb,DocVerbatim::PlantUML,FALSE,plantFile);
- dv -> m_width = tmp_dv -> m_width;
- dv -> m_height = tmp_dv -> m_height;
- dv -> m_children = tmp_dv -> m_children;
- delete tmp_dv;
m_children.append(dv);
}
if (retval==0) warn_doc_error(g_fileName,doctokenizerYYlineno,"startuml section ended without end marker");
@@ -5707,16 +5585,16 @@ int DocPara::handleCommand(const QCString &cmdName)
handleImage(cmdName);
break;
case CMD_DOTFILE:
- handleDotFile(cmdName);
+ handleFile<DocDotFile>(cmdName);
break;
case CMD_VHDLFLOW:
handleVhdlFlow();
break;
case CMD_MSCFILE:
- handleMscFile(cmdName);
+ handleFile<DocMscFile>(cmdName);
break;
case CMD_DIAFILE:
- handleDiaFile(cmdName);
+ handleFile<DocDiaFile>(cmdName);
break;
case CMD_LINK:
handleLink(cmdName,FALSE);
diff --git a/src/docparser.h b/src/docparser.h
index 51698b8..e8ef754 100644
--- a/src/docparser.h
+++ b/src/docparser.h
@@ -451,7 +451,10 @@ class DocVerbatim : public DocNode
QCString width() const { return m_width; }
QCString height() const { return m_height; }
const QList<DocNode> &children() const { return m_children; }
- QList<DocNode> &children() { return m_children; }
+ QList<DocNode> &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; }
private:
QCString m_context;
@@ -462,7 +465,6 @@ class DocVerbatim : public DocNode
QCString m_relPath;
QCString m_lang;
bool m_isBlock;
- public:
QCString m_width;
QCString m_height;
QList<DocNode> m_children;
@@ -1123,9 +1125,7 @@ class DocPara : public CompAccept<DocPara>, public DocNode
int direction);
void handleIncludeOperator(const QCString &cmdName,DocIncOperator::Type t);
void handleImage(const QCString &cmdName);
- void handleDotFile(const QCString &cmdName);
- void handleMscFile(const QCString &cmdName);
- void handleDiaFile(const QCString &cmdName);
+ template<class T> void handleFile(const QCString &cmdName);
void handleInclude(const QCString &cmdName,DocInclude::Type t);
void handleLink(const QCString &cmdName,bool isJavaLink);
void handleCite();
diff --git a/src/doctokenizer.h b/src/doctokenizer.h
index cfcf65f..ead8da1 100644
--- a/src/doctokenizer.h
+++ b/src/doctokenizer.h
@@ -131,10 +131,8 @@ void doctokenizerYYpushContext();
bool doctokenizerYYpopContext();
int doctokenizerYYlex();
void doctokenizerYYsetStatePara();
-void doctokenizerYYsetStateCaption();
void doctokenizerYYsetStateTitle();
void doctokenizerYYsetStateTitleAttrValue();
-void doctokenizerYYsetStateTitleAttr();
void doctokenizerYYsetStateCode();
void doctokenizerYYsetStateXmlCode();
void doctokenizerYYsetStateHtmlOnly();
diff --git a/src/doctokenizer.l b/src/doctokenizer.l
index fcaa516..a6276af 100644
--- a/src/doctokenizer.l
+++ b/src/doctokenizer.l
@@ -404,7 +404,6 @@ REFWORD {LABELID}|{REFWORD2}|{REFWORD3}|{REFWORD4}
%x St_Para
%x St_Comment
%x St_Title
-%x St_Caption
%x St_TitleN
%x St_TitleQ
%x St_TitleA
@@ -860,12 +859,22 @@ REFWORD {LABELID}|{REFWORD2}|{REFWORD3}|{REFWORD4}
<St_Msc>. { /* msc text */
g_token->verb+=yytext;
}
-<St_PlantUMLOpt>{BLANK}*"{"[^}]*"}" { // skip curly brackets around the optional image name
- g_token->sectionId = yytext;
- g_token->sectionId = g_token->sectionId.stripWhiteSpace();
- g_token->sectionId = g_token->sectionId.left(g_token->sectionId.length()-1);
- g_token->sectionId = g_token->sectionId.right(g_token->sectionId.length()-1);
- g_token->sectionId = g_token->sectionId.stripWhiteSpace();
+<St_PlantUMLOpt>{BLANK}*"{"[^}]*"}" { // case 1: file name is specified as {filename}
+ 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
+ g_token->sectionId = QCString(yytext).stripWhiteSpace();
+ return RetVal_OK;
+ }
+<St_PlantUMLOpt>{BLANK}*{FILEMASK}{BLANK}+/"\"" { // case 3: plain file name specified followed by a quoted title
+ g_token->sectionId = QCString(yytext).stripWhiteSpace();
+ return RetVal_OK;
+ }
+<St_PlantUMLOpt>{BLANK}*{FILEMASK}{BLANK}*/\n { // case 4: plain file name specified without title or attributes
+ g_token->sectionId = QCString(yytext).stripWhiteSpace();
return RetVal_OK;
}
<St_PlantUMLOpt>. {
@@ -881,22 +890,9 @@ REFWORD {LABELID}|{REFWORD2}|{REFWORD3}|{REFWORD4}
<St_PlantUML>. { /* plantuml text */
g_token->verb+=yytext;
}
-<St_Caption>"\"" { // quoted title
- BEGIN(St_TitleQ);
- return TK_WORD;
- }
-<St_Caption>[ \t]+ {
- g_token->name="";
- g_token->chars=yytext;
- return TK_WHITESPACE;
- }
-<St_Caption>\n {
- unput(*yytext);
- return 0;
- }
<St_Title>"\"" { // quoted title
BEGIN(St_TitleQ);
- }
+ }
<St_Title>[ \t]+ {
g_token->chars=yytext;
return TK_WHITESPACE;
@@ -921,6 +917,13 @@ REFWORD {LABELID}|{REFWORD2}|{REFWORD3}|{REFWORD4}
g_token->paramDir=TokenInfo::Unspecified;
return TK_COMMAND;
}
+<St_TitleN>{ID}"=" { /* attribute */
+ if (yytext[0]=='%') // strip % if present
+ g_token->name = &yytext[1];
+ else
+ g_token->name = yytext;
+ return TK_WORD;
+ }
<St_TitleN>{WORD1} |
<St_TitleN>{WORD2} { /* word */
if (yytext[0]=='%') // strip % if present
@@ -964,38 +967,9 @@ REFWORD {LABELID}|{REFWORD2}|{REFWORD3}|{REFWORD4}
unput(*yytext);
return 0;
}
-<St_Caption>{BLANK}*"min"{BLANK}* { // title special case min / max
- g_token->name = "min";
- BEGIN(St_TitleA);
- return TK_WORD;
- }
-<St_Caption>{BLANK}*"max"{BLANK}* { // title special case min / max
- g_token->name = "max";
- BEGIN(St_TitleA);
- return TK_WORD;
- }
-<St_Caption>{BLANK}*"width="{BLANK}* { // title attribute
- g_token->name = yytext;
- g_token->name = g_token->name.stripWhiteSpace();
- BEGIN(St_TitleV);
- }
-<St_Caption>{BLANK}*"height="{BLANK}* { // title attribute
- g_token->name = yytext;
- g_token->name = g_token->name.stripWhiteSpace();
- BEGIN(St_TitleV);
- }
-<St_TitleA>{BLANK}*"min"{BLANK}* { // title special case min / max
- g_token->name = "min";
- return TK_WORD;
- }
-<St_TitleA>{BLANK}*"max"{BLANK}* { // title special case min / max
- g_token->name = "max";
- return TK_WORD;
- }
<St_TitleA>{BLANK}*{ID}{BLANK}*"="{BLANK}* { // title attribute
g_token->name = yytext;
- g_token->name = g_token->name.left(
- g_token->name.find('=')).stripWhiteSpace();
+ g_token->name = g_token->name.left(g_token->name.find('=')).stripWhiteSpace();
BEGIN(St_TitleV);
}
<St_TitleV>[^ \t\r\n]+ { // attribute value
@@ -1003,10 +977,6 @@ REFWORD {LABELID}|{REFWORD2}|{REFWORD3}|{REFWORD4}
BEGIN(St_TitleN);
return TK_WORD;
}
-<St_TitleV,St_TitleA>[ \t] {
- g_token->chars=yytext;
- return TK_WHITESPACE;
- }
<St_TitleV,St_TitleA>. {
unput(*yytext);
return 0;
@@ -1351,16 +1321,6 @@ void doctokenizerYYsetStateTitle()
BEGIN(St_Title);
}
-void doctokenizerYYsetStateCaption()
-{
- BEGIN(St_Caption);
-}
-
-void doctokenizerYYsetStateTitleAttr()
-{
- BEGIN(St_TitleA);
-}
-
void doctokenizerYYsetStateTitleAttrValue()
{
BEGIN(St_TitleV);
diff --git a/src/htmldocvisitor.cpp b/src/htmldocvisitor.cpp
index 4d61ca7..cd6b635 100644
--- a/src/htmldocvisitor.cpp
+++ b/src/htmldocvisitor.cpp
@@ -427,7 +427,7 @@ void HtmlDocVisitor::visit(DocVerbatim *s)
m_t << "<div align=\"center\">" << endl;
writeDotFile(fileName,s->relPath(),s->context());
visitPreCaption(m_t, s);
- visitCaption(this, s->m_children);
+ visitCaption(this, s->children());
visitPostCaption(m_t, s);
m_t << "</div>" << endl;
@@ -464,7 +464,7 @@ void HtmlDocVisitor::visit(DocVerbatim *s)
m_t << "<div align=\"center\">" << endl;
writeMscFile(baseName+".msc",s->relPath(),s->context());
visitPreCaption(m_t, s);
- visitCaption(this, s->m_children);
+ visitCaption(this, s->children());
visitPostCaption(m_t, s);
m_t << "</div>" << endl;
@@ -482,7 +482,7 @@ void HtmlDocVisitor::visit(DocVerbatim *s)
m_t << "<div align=\"center\">" << endl;
writePlantUMLFile(baseName,s->relPath(),s->context());
visitPreCaption(m_t, s);
- visitCaption(this, s->m_children);
+ visitCaption(this, s->children());
visitPostCaption(m_t, s);
m_t << "</div>" << endl;
forceStartParagraph(s);
diff --git a/src/latexdocvisitor.cpp b/src/latexdocvisitor.cpp
index c53a45a..71e20c1 100644
--- a/src/latexdocvisitor.cpp
+++ b/src/latexdocvisitor.cpp
@@ -90,7 +90,7 @@ static void visitPreStart(FTextStream &t, const bool hasCaption, QCString name,
}
if (!width.isEmpty())
{
- t << width;
+ t << "width=" << width;
}
if (!width.isEmpty() && !height.isEmpty())
{
@@ -98,7 +98,7 @@ static void visitPreStart(FTextStream &t, const bool hasCaption, QCString name,
}
if (!height.isEmpty())
{
- t << height;
+ t << "height=" << height;
}
if (width.isEmpty() && height.isEmpty())
{
@@ -359,7 +359,7 @@ void LatexDocVisitor::visit(DocVerbatim *s)
file.close();
startDotFile(fileName,s->width(),s->height(),s->hasCaption());
- visitCaption(this, s->m_children);
+ visitCaption(this, s->children());
endDotFile(s->hasCaption());
if (Config_getBool("DOT_CLEANUP")) file.remove();
@@ -1701,7 +1701,7 @@ void LatexDocVisitor::writeMscFile(const QCString &baseName, DocVerbatim *s)
QCString outDir = Config_getString("LATEX_OUTPUT");
writeMscGraphFromFile(baseName+".msc",outDir,shortName,MSC_EPS);
visitPreStart(m_t, s->hasCaption(), shortName, s->width(),s->height());
- visitCaption(this, s->m_children);
+ visitCaption(this, s->children());
visitPostEnd(m_t, s->hasCaption());
}
@@ -1747,7 +1747,7 @@ void LatexDocVisitor::writeDiaFile(const QCString &baseName, DocVerbatim *s)
QCString outDir = Config_getString("LATEX_OUTPUT");
writeDiaGraphFromFile(baseName+".dia",outDir,shortName,DIA_EPS);
visitPreStart(m_t, s->hasCaption(), shortName, s->width(), s->height());
- visitCaption(this, s->m_children);
+ visitCaption(this, s->children());
visitPostEnd(m_t, s->hasCaption());
}
@@ -1762,7 +1762,7 @@ void LatexDocVisitor::writePlantUMLFile(const QCString &baseName, DocVerbatim *s
QCString outDir = Config_getString("LATEX_OUTPUT");
generatePlantUMLOutput(baseName,outDir,PUML_EPS);
visitPreStart(m_t, s->hasCaption(), shortName, s->width(), s->height());
- visitCaption(this, s->m_children);
+ visitCaption(this, s->children());
visitPostEnd(m_t, s->hasCaption());
}
diff --git a/src/latexgen.cpp b/src/latexgen.cpp
index a62cdb7..d4d8fae 100644
--- a/src/latexgen.cpp
+++ b/src/latexgen.cpp
@@ -1952,10 +1952,10 @@ void LatexGenerator::exceptionEntry(const char* prefix,bool closeBracket)
void LatexGenerator::writeDoc(DocNode *n,Definition *ctx,MemberDef *)
{
- LatexDocVisitor *visitor =
+ LatexDocVisitor *visitor =
new LatexDocVisitor(t,*this,ctx?ctx->getDefFileExtension():QCString(""),insideTabbing);
n->accept(visitor);
- delete visitor;
+ delete visitor;
}
void LatexGenerator::startConstraintList(const char *header)
diff --git a/src/xmldocvisitor.cpp b/src/xmldocvisitor.cpp
index afab1d3..65711ab 100644
--- a/src/xmldocvisitor.cpp
+++ b/src/xmldocvisitor.cpp
@@ -45,7 +45,7 @@ static void visitPreStart(FTextStream &t, const char *cmd, const bool doCaption,
const QCString &height)
{
QCString tmpStr;
-
+
t << "<" << cmd;
if (writeType)
{
@@ -65,27 +65,12 @@ static void visitPreStart(FTextStream &t, const char *cmd, const bool doCaption,
}
if (!width.isEmpty())
{
- tmpStr = width;
- tmpStr = tmpStr.replace(QRegExp("min *width"),"minwidth");
- tmpStr = tmpStr.replace(QRegExp("max *width"),"maxwidth");
- tmpStr = tmpStr.replace(QRegExp("="),"=\"");
- tmpStr = tmpStr.replace(QRegExp(","),"\" ") + "\"";
- tmpStr = tmpStr.replace(QRegExp("\"\""),"\"");
- tmpStr = tmpStr.replace(QRegExp("\\"),"\\\\");
- t << " " << tmpStr;
+ t << " width=\"" << convertToXML(width) << "\"";
}
- if (!height.isEmpty())
+ else if (!height.isEmpty())
{
- tmpStr = height;
- tmpStr = tmpStr.replace(QRegExp("min *height"),"minheight");
- tmpStr = tmpStr.replace(QRegExp("max *height"),"maxheight");
- tmpStr = tmpStr.replace(QRegExp("="),"=\"");
- tmpStr = tmpStr.replace(QRegExp(","),"\" ") + "\"";
- tmpStr = tmpStr.replace(QRegExp("\"\""),"\"");
- tmpStr = tmpStr.replace(QRegExp("\\"),"\\\\");
- t << " " << tmpStr;
+ t << " height=\"" << convertToXML(height) << "\"";
}
-
if (doCaption)
{
t << " caption=\"";