summaryrefslogtreecommitdiffstats
path: root/src/doctokenizer.l
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/doctokenizer.l
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/doctokenizer.l')
-rw-r--r--src/doctokenizer.l84
1 files changed, 75 insertions, 9 deletions
diff --git a/src/doctokenizer.l b/src/doctokenizer.l
index e0e72a7..9fd3c46 100644
--- a/src/doctokenizer.l
+++ b/src/doctokenizer.l
@@ -400,6 +400,7 @@ REFWORD {LABELID}|{REFWORD2}|{REFWORD3}|{LNKWORD2}
%x St_Para
%x St_Comment
%x St_Title
+%x St_Caption
%x St_TitleN
%x St_TitleQ
%x St_TitleA
@@ -853,14 +854,18 @@ REFWORD {LABELID}|{REFWORD2}|{REFWORD3}|{LNKWORD2}
<St_Msc>. { /* msc text */
g_token->verb+=yytext;
}
-<St_PlantUMLOpt>\n {
- g_token->sectionId=g_token->sectionId.stripWhiteSpace();
- BEGIN(St_PlantUML);
- }
-<St_PlantUMLOpt>["{}] { // skip curly brackets or quotes around the optional image name
+<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();
+ return RetVal_OK;
}
<St_PlantUMLOpt>. {
- g_token->sectionId += yytext;
+ g_token->sectionId = "";
+ unput(*yytext);
+ return RetVal_OK;
}
<St_PlantUML>{CMD}"enduml" {
return RetVal_OK;
@@ -870,6 +875,19 @@ REFWORD {LABELID}|{REFWORD2}|{REFWORD3}|{LNKWORD2}
<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);
}
@@ -940,10 +958,38 @@ REFWORD {LABELID}|{REFWORD2}|{REFWORD3}|{LNKWORD2}
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.find('=')).stripWhiteSpace();
BEGIN(St_TitleV);
}
<St_TitleV>[^ \t\r\n]+ { // attribute value
@@ -951,6 +997,10 @@ REFWORD {LABELID}|{REFWORD2}|{REFWORD3}|{LNKWORD2}
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;
@@ -1224,7 +1274,7 @@ REFWORD {LABELID}|{REFWORD2}|{REFWORD3}|{LNKWORD2}
return TK_COMMAND;
}
<*>. {
- warn(g_fileName,yylineno,"Unexpected character `%s'",yytext);
+ warn(g_fileName,yylineno,"Unexpected character `%s'",yytext);
}
%%
@@ -1267,6 +1317,16 @@ void doctokenizerYYsetStateTitle()
BEGIN(St_Title);
}
+void doctokenizerYYsetStateCaption()
+{
+ BEGIN(St_Caption);
+}
+
+void doctokenizerYYsetStateTitleAttr()
+{
+ BEGIN(St_TitleA);
+}
+
void doctokenizerYYsetStateTitleAttrValue()
{
BEGIN(St_TitleV);
@@ -1341,13 +1401,19 @@ void doctokenizerYYsetStateMsc()
BEGIN(St_Msc);
}
-void doctokenizerYYsetStatePlantUML()
+void doctokenizerYYsetStatePlantUMLOpt()
{
g_token->verb="";
g_token->sectionId="";
BEGIN(St_PlantUMLOpt);
}
+void doctokenizerYYsetStatePlantUML()
+{
+ g_token->verb="";
+ BEGIN(St_PlantUML);
+}
+
void doctokenizerYYsetStateParam()
{
BEGIN(St_Param);