From 6c4f10c375530d1baf82527787d4887cc343d9bb Mon Sep 17 00:00:00 2001 From: albert-github Date: Mon, 12 Aug 2019 15:49:28 +0200 Subject: Table caption flows in first table field for RTF output See to it that the table caption is placed on top of the table and not in the first field. (See the doxygen documentation in respect to the tables; problem with tables in tables is a a different problem.) --- src/rtfdocvisitor.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/rtfdocvisitor.cpp b/src/rtfdocvisitor.cpp index 43ac362..2b20e3d 100644 --- a/src/rtfdocvisitor.cpp +++ b/src/rtfdocvisitor.cpp @@ -1005,11 +1005,14 @@ void RTFDocVisitor::visitPost(DocHtmlTable *) void RTFDocVisitor::visitPre(DocHtmlCaption *) { DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocHtmlCaption)}\n"); + m_t << "\\pard \\qc \\b"; + m_t << "{Table \\field\\flddirty{\\*\\fldinst { SEQ Image \\\\*Arabic }}{\\fldrslt {\\noproof 1}} "; } void RTFDocVisitor::visitPost(DocHtmlCaption *) { DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocHtmlCaption)}\n"); + m_t << "}\n\\par" << endl; } void RTFDocVisitor::visitPre(DocHtmlRow *r) -- cgit v0.12 From a390d6a9ad62019c7ca3d3689184fd3ce6afd57c Mon Sep 17 00:00:00 2001 From: albert-github Date: Mon, 12 Aug 2019 18:51:01 +0200 Subject: Incorrect NCName in docbook citations In a bibtex reference it is possible to have a colon as the id, but in docbook this will result in: ``` docbook/citelist.xml:5: validity error : xml:id : attribute value _citelist_1CITEREF_pre:post is not an NCName [1] ``` So the id has to be translated. A colon in an id can only happen in case the names is provided from the outside. --- src/docbookvisitor.cpp | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/docbookvisitor.cpp b/src/docbookvisitor.cpp index ce3a845..83c34e7 100644 --- a/src/docbookvisitor.cpp +++ b/src/docbookvisitor.cpp @@ -36,6 +36,7 @@ #include "htmlentity.h" #include "emoji.h" #include "plantuml.h" +#include "growbuf.h" #if 0 #define DB_VIS_C DB_VIS_C1(m_t) @@ -49,6 +50,25 @@ #define DB_VIS_C2a(x,y) #endif +static QCString filterId(const char *s) +{ + static GrowBuf growBuf; + growBuf.clear(); + if (s==0) return ""; + const unsigned char *p=(const unsigned char *)s; + char c; + while ((c=*p++)) + { + switch (c) + { + case ':': growBuf.addStr("_1"); break; + default: growBuf.addChar(c); break; + } + } + growBuf.addChar(0); + return growBuf.get(); +} + void DocbookDocVisitor::visitCaption(const QList &children) { QListIterator cli(children); @@ -374,7 +394,7 @@ void DocbookDocVisitor::visit(DocAnchor *anc) { DB_VIS_C if (m_hide) return; - m_t << "file()) << "_1" << anc->anchor() << "\"/>"; + m_t << "file()) << "_1" << filterId(anc->anchor()) << "\"/>"; } void DocbookDocVisitor::visit(DocInclude *inc) @@ -550,7 +570,7 @@ void DocbookDocVisitor::visit(DocCite *cite) { DB_VIS_C if (m_hide) return; - if (!cite->file().isEmpty()) startLink(cite->file(),cite->anchor()); + if (!cite->file().isEmpty()) startLink(cite->file(),filterId(cite->anchor())); filter(cite->text()); if (!cite->file().isEmpty()) endLink(); } -- cgit v0.12 From 6d5ac50ae99b913a26a752fe86dfab1643b73a02 Mon Sep 17 00:00:00 2001 From: albert-github Date: Tue, 13 Aug 2019 10:29:19 +0200 Subject: Table caption flows in first table field for RTF output Tables should be numbered independent of images. --- src/rtfdocvisitor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rtfdocvisitor.cpp b/src/rtfdocvisitor.cpp index 2b20e3d..8606264 100644 --- a/src/rtfdocvisitor.cpp +++ b/src/rtfdocvisitor.cpp @@ -1006,7 +1006,7 @@ void RTFDocVisitor::visitPre(DocHtmlCaption *) { DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocHtmlCaption)}\n"); m_t << "\\pard \\qc \\b"; - m_t << "{Table \\field\\flddirty{\\*\\fldinst { SEQ Image \\\\*Arabic }}{\\fldrslt {\\noproof 1}} "; + m_t << "{Table \\field\\flddirty{\\*\\fldinst { SEQ Table \\\\*Arabic }}{\\fldrslt {\\noproof 1}} "; } void RTFDocVisitor::visitPost(DocHtmlCaption *) -- cgit v0.12 From cf82dae5f6a9fddcc24e9b7acc110f72fa0442df Mon Sep 17 00:00:00 2001 From: albert-github Date: Fri, 16 Aug 2019 12:46:21 +0200 Subject: Adding HTML s tag, XML corrections for other tags Adding the HTML `` tag (https://www.w3schools.com/tags/tag_s.asp). Adding 's' and correcting 'inc' to 'ins' in compound.xsd --- src/cmdmapper.cpp | 1 + src/cmdmapper.h | 1 + src/docbookvisitor.cpp | 1 + src/docparser.cpp | 18 +++++++++++++++++- src/docparser.h | 3 ++- src/doctokenizer.l | 4 ++-- src/htmldocvisitor.cpp | 3 +++ src/latexdocvisitor.cpp | 1 + src/mandocvisitor.cpp | 1 + src/perlmodgen.cpp | 1 + src/printdocvisitor.h | 3 +++ src/rtfdocvisitor.cpp | 1 + src/xmldocvisitor.cpp | 3 +++ templates/xml/compound.xsd | 3 ++- testing/086/086__style__tags_8h.xml | 2 +- testing/086_style_tags.h | 3 ++- 16 files changed, 42 insertions(+), 7 deletions(-) diff --git a/src/cmdmapper.cpp b/src/cmdmapper.cpp index b4d35d4..fa4f147 100644 --- a/src/cmdmapper.cpp +++ b/src/cmdmapper.cpp @@ -196,6 +196,7 @@ CommandMap htmlTagMap[] = { "div", HTML_DIV }, { "blockquote", HTML_BLOCKQUOTE }, { "strike", HTML_STRIKE }, + { "s", HTML_S }, { "u", HTML_UNDERLINE }, { "ins", HTML_INS }, { "del", HTML_DEL }, diff --git a/src/cmdmapper.h b/src/cmdmapper.h index d670cd4..d44e834 100644 --- a/src/cmdmapper.h +++ b/src/cmdmapper.h @@ -181,6 +181,7 @@ enum HtmlTagType HTML_UNDERLINE = 35, HTML_INS = 36, HTML_DEL = 37, + HTML_S = 38, XML_CmdMask = 0x100, diff --git a/src/docbookvisitor.cpp b/src/docbookvisitor.cpp index ce3a845..10d7cea 100644 --- a/src/docbookvisitor.cpp +++ b/src/docbookvisitor.cpp @@ -262,6 +262,7 @@ DB_VIS_C /* There is no equivalent Docbook tag for rendering Small text */ case DocStyleChange::Small: /* XSLT Stylesheets can be used */ break; /* HTML only */ + case DocStyleChange::S: break; case DocStyleChange::Strike: break; case DocStyleChange::Del: break; case DocStyleChange::Underline: break; diff --git a/src/docparser.cpp b/src/docparser.cpp index 9dd1c71..ad83aff 100644 --- a/src/docparser.cpp +++ b/src/docparser.cpp @@ -1020,6 +1020,7 @@ const char *DocStyleChange::styleString() const case DocStyleChange::Div: return "div"; case DocStyleChange::Span: return "span"; case DocStyleChange::Strike: return "strike"; + case DocStyleChange::S: return "s"; case DocStyleChange::Del: return "del"; case DocStyleChange::Underline: return "u"; case DocStyleChange::Ins: return "ins"; @@ -1171,7 +1172,7 @@ static void handleParameterType(DocNode *parent,QList &children,const Q { QCString name = g_token->name; // save token name QCString name1; - int p=0,i,l,ii; + int p=0,i,ii; while ((i=paramTypes.find('|',p))!=-1) { name1 = paramTypes.mid(p,i-p); @@ -1550,6 +1551,15 @@ reparsetoken: handleStyleLeave(parent,children,DocStyleChange::Bold,tokenName); } break; + case HTML_S: + if (!g_token->endTag) + { + handleStyleEnter(parent,children,DocStyleChange::S,&g_token->attribs); + } + else + { + handleStyleLeave(parent,children,DocStyleChange::S,tokenName); + } case HTML_STRIKE: if (!g_token->endTag) { @@ -5925,6 +5935,9 @@ int DocPara::handleHtmlStartTag(const QCString &tagName,const HtmlAttribList &ta case HTML_BOLD: handleStyleEnter(this,m_children,DocStyleChange::Bold,&g_token->attribs); break; + case HTML_S: + handleStyleEnter(this,m_children,DocStyleChange::S,&g_token->attribs); + break; case HTML_STRIKE: handleStyleEnter(this,m_children,DocStyleChange::Strike,&g_token->attribs); break; @@ -6346,6 +6359,9 @@ int DocPara::handleHtmlEndTag(const QCString &tagName) case HTML_BOLD: handleStyleLeave(this,m_children,DocStyleChange::Bold,"b"); break; + case HTML_S: + handleStyleLeave(this,m_children,DocStyleChange::S,"s"); + break; case HTML_STRIKE: handleStyleLeave(this,m_children,DocStyleChange::Strike,"strike"); break; diff --git a/src/docparser.h b/src/docparser.h index e608d8f..4c10d9e 100644 --- a/src/docparser.h +++ b/src/docparser.h @@ -385,7 +385,8 @@ class DocStyleChange : public DocNode Strike = (1<<10), Underline = (1<<11), Del = (1<<12), - Ins = (1<<13) + Ins = (1<<13), + S = (1<<14) }; DocStyleChange(DocNode *parent,uint position,Style s,bool enable, diff --git a/src/doctokenizer.l b/src/doctokenizer.l index 79c7d0e..d21f0c9 100644 --- a/src/doctokenizer.l +++ b/src/doctokenizer.l @@ -405,8 +405,8 @@ WORD1NQ {ESCWORD}|{CHARWORDQ}+|"{"|"}" WORD2NQ "."|","|"("|")"|"["|"]"|"::"|":"|";"|"\?"|"="|"'" CAPTION [cC][aA][pP][tT][iI][oO][nN] HTMLTAG "<"(("/")?){ID}({WS}+{ATTRIB})*{WS}*(("/")?)">" -HTMLKEYL "strong"|"center"|"table"|"caption"|"small"|"code"|"dfn"|"var"|"img"|"pre"|"sub"|"sup"|"tr"|"td"|"th"|"ol"|"ul"|"li"|"tt"|"kbd"|"em"|"hr"|"dl"|"dt"|"dd"|"br"|"i"|"a"|"b"|"p"|"strike"|"u"|"del"|"ins" -HTMLKEYU "STRONG"|"CENTER"|"TABLE"|"CAPTION"|"SMALL"|"CODE"|"DFN"|"VAR"|"IMG"|"PRE"|"SUB"|"SUP"|"TR"|"TD"|"TH"|"OL"|"UL"|"LI"|"TT"|"KBD"|"EM"|"HR"|"DL"|"DT"|"DD"|"BR"|"I"|"A"|"B"|"P"|"STRIKE"|"U"|"DEL"|"INS" +HTMLKEYL "strong"|"center"|"table"|"caption"|"small"|"code"|"dfn"|"var"|"img"|"pre"|"sub"|"sup"|"tr"|"td"|"th"|"ol"|"ul"|"li"|"tt"|"kbd"|"em"|"hr"|"dl"|"dt"|"dd"|"br"|"i"|"a"|"b"|"p"|"strike"|"u"|"del"|"ins"|"s" +HTMLKEYU "STRONG"|"CENTER"|"TABLE"|"CAPTION"|"SMALL"|"CODE"|"DFN"|"VAR"|"IMG"|"PRE"|"SUB"|"SUP"|"TR"|"TD"|"TH"|"OL"|"UL"|"LI"|"TT"|"KBD"|"EM"|"HR"|"DL"|"DT"|"DD"|"BR"|"I"|"A"|"B"|"P"|"STRIKE"|"U"|"DEL"|"INS"|"S" HTMLKEYW {HTMLKEYL}|{HTMLKEYU} REFWORD2_PRE ("#"|"::")?((({ID}{TEMPLPART}?)|{ANONNS})("."|"#"|"::"|"-"|"/"))*({ID}{TEMPLPART}?(":")?) REFWORD2 {REFWORD2_PRE}{FUNCARG2}? diff --git a/src/htmldocvisitor.cpp b/src/htmldocvisitor.cpp index c7fcaf8..f19b5ed 100644 --- a/src/htmldocvisitor.cpp +++ b/src/htmldocvisitor.cpp @@ -406,6 +406,9 @@ void HtmlDocVisitor::visit(DocStyleChange *s) case DocStyleChange::Bold: if (s->enable()) m_t << "attribs()) << ">"; else m_t << ""; break; + case DocStyleChange::S: + if (s->enable()) m_t << "attribs()) << ">"; else m_t << ""; + break; case DocStyleChange::Strike: if (s->enable()) m_t << "attribs()) << ">"; else m_t << ""; break; diff --git a/src/latexdocvisitor.cpp b/src/latexdocvisitor.cpp index a0bbf73..07ad692 100644 --- a/src/latexdocvisitor.cpp +++ b/src/latexdocvisitor.cpp @@ -291,6 +291,7 @@ void LatexDocVisitor::visit(DocStyleChange *s) case DocStyleChange::Bold: if (s->enable()) m_t << "{\\bfseries{"; else m_t << "}}"; break; + case DocStyleChange::S: case DocStyleChange::Strike: case DocStyleChange::Del: if (s->enable()) m_t << "\\sout{"; else m_t << "}"; diff --git a/src/mandocvisitor.cpp b/src/mandocvisitor.cpp index 997b24e..fe5683b 100644 --- a/src/mandocvisitor.cpp +++ b/src/mandocvisitor.cpp @@ -136,6 +136,7 @@ void ManDocVisitor::visit(DocStyleChange *s) if (s->enable()) m_t << "\\fB"; else m_t << "\\fP"; m_firstCol=FALSE; break; + case DocStyleChange::S: case DocStyleChange::Strike: case DocStyleChange::Del: /* not supported */ diff --git a/src/perlmodgen.cpp b/src/perlmodgen.cpp index a288e0e..92670d9 100644 --- a/src/perlmodgen.cpp +++ b/src/perlmodgen.cpp @@ -639,6 +639,7 @@ void PerlModDocVisitor::visit(DocStyleChange *s) switch (s->style()) { case DocStyleChange::Bold: style = "bold"; break; + case DocStyleChange::S: style = "s"; break; case DocStyleChange::Strike: style = "strike"; break; case DocStyleChange::Del: style = "del"; break; case DocStyleChange::Underline: style = "underline"; break; diff --git a/src/printdocvisitor.h b/src/printdocvisitor.h index 6b9bd75..ed4e76b 100644 --- a/src/printdocvisitor.h +++ b/src/printdocvisitor.h @@ -105,6 +105,9 @@ class PrintDocVisitor : public DocVisitor case DocStyleChange::Bold: if (s->enable()) printf(""); else printf(""); break; + case DocStyleChange::S: + if (s->enable()) printf(""); else printf(""); + break; case DocStyleChange::Strike: if (s->enable()) printf(""); else printf(""); break; diff --git a/src/rtfdocvisitor.cpp b/src/rtfdocvisitor.cpp index 43ac362..efb0bc3 100644 --- a/src/rtfdocvisitor.cpp +++ b/src/rtfdocvisitor.cpp @@ -235,6 +235,7 @@ void RTFDocVisitor::visit(DocStyleChange *s) case DocStyleChange::Bold: if (s->enable()) m_t << "{\\b "; else m_t << "} "; break; + case DocStyleChange::S: case DocStyleChange::Strike: case DocStyleChange::Del: if (s->enable()) m_t << "{\\strike "; else m_t << "} "; diff --git a/src/xmldocvisitor.cpp b/src/xmldocvisitor.cpp index a0afa9d..c873de1 100644 --- a/src/xmldocvisitor.cpp +++ b/src/xmldocvisitor.cpp @@ -187,6 +187,9 @@ void XmlDocVisitor::visit(DocStyleChange *s) case DocStyleChange::Bold: if (s->enable()) m_t << ""; else m_t << ""; break; + case DocStyleChange::S: + if (s->enable()) m_t << ""; else m_t << ""; + break; case DocStyleChange::Strike: if (s->enable()) m_t << ""; else m_t << ""; break; diff --git a/templates/xml/compound.xsd b/templates/xml/compound.xsd index 6eb7e0a..698a0cc 100644 --- a/templates/xml/compound.xsd +++ b/templates/xml/compound.xsd @@ -410,6 +410,7 @@ + @@ -419,7 +420,7 @@ - + diff --git a/testing/086/086__style__tags_8h.xml b/testing/086/086__style__tags_8h.xml index a1803da..5a21a9b 100644 --- a/testing/086/086__style__tags_8h.xml +++ b/testing/086/086__style__tags_8h.xml @@ -5,7 +5,7 @@ - In the following the word tag has the style as indicated before it.This is a bold tag.This is a strong bold tag.This is an italic tag.This is an em italic tag.This is a strike through tag.This is an underline tag.This is an insterted tag.This is a deleted tag.This is a typewriter tag. + In the following the word tag has the style as indicated before it.This is a bold tag.This is a strong bold tag.This is an italic tag.This is an em italic tag.This is a strike through tag.This is a s strike through tag.This is an underline tag.This is an ins inserted tag.This is a deleted tag.This is a typewriter tag. diff --git a/testing/086_style_tags.h b/testing/086_style_tags.h index 105adca..625e245 100644 --- a/testing/086_style_tags.h +++ b/testing/086_style_tags.h @@ -9,8 +9,9 @@ In the following the word tag has the style as indicated before it. - This is an italic tag. - This is an `em` italic tag. - This is a strike through tag. +- This is a `s` strike through tag. - This is an underline tag. -- This is an insterted tag. +- This is an `ins` inserted tag. - This is a deleted tag. - This is a typewriter tag. */ -- cgit v0.12 From 5b1eaf616f0edd430637d31eae51eea26fbac408 Mon Sep 17 00:00:00 2001 From: albert-github Date: Fri, 16 Aug 2019 16:04:47 +0200 Subject: Adding HTML s tag, XML corrections for other tags Added documentation. --- doc/htmlcmds.doc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/htmlcmds.doc b/doc/htmlcmds.doc index 12347ab..8af2305 100644 --- a/doc/htmlcmds.doc +++ b/doc/htmlcmds.doc @@ -87,6 +87,8 @@ of a HTML tag are passed on to the HTML output only
  • \ Ends a \ section.
  • \ Starts an inline text fragment with a specific style (HTML only)
  • \ Ends an inline text fragment with a specific style (HTML only) +
  • \ Starts a section of strike through text. +
  • \ Ends a section of strike through text.
  • \ Starts a section of strike through text.
  • \ Ends a section of strike through text.
  • \ Starts a section of bold text. -- cgit v0.12 From d43815b2d1aed4fd10a918f18688c35995298677 Mon Sep 17 00:00:00 2001 From: albert-github Date: Mon, 19 Aug 2019 14:39:12 +0200 Subject: Warning in case of usage of a single quote in a code span. When we have a single quotes in a codespan we can get the warning: ``` warning: found tag without matching ``` Added the workaround to the documentation. --- doc/markdown.doc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/doc/markdown.doc b/doc/markdown.doc index 5edbaf9..883e831 100644 --- a/doc/markdown.doc +++ b/doc/markdown.doc @@ -193,10 +193,12 @@ code spans appear inline in a paragraph. An example: Use the `printf()` function. -To show a literal backtick inside a code span use double backticks, i.e. +To show a literal backtick or single quote inside a code span use double backticks, i.e. To assign the output of command `ls` to `var` use ``var=`ls```. + To assign the text 'text' to `var` use ``var='text'``. + See section \ref mddox_code_spans for more info how doxygen handles code spans slightly different than standard Markdown. @@ -606,6 +608,9 @@ In other words; a single quote cancels the special treatment of a code span wrapped in a pair of backtick characters. This extra restriction was added for backward compatibility reasons. +In case you want to have single quotes inside a code span, don't use +one backtick but two backticks around the code span. + \subsection mddox_lists Lists Extensions With Markdown two lists separated by an empty line are joined together into -- cgit v0.12 From 5576550317561f0fc33c26db144d0bea5561bc9f Mon Sep 17 00:00:00 2001 From: albert-github Date: Tue, 20 Aug 2019 12:34:59 +0200 Subject: issue #7210: 1.8.16: Image inclusion is inconsistent The consequence of #7084 (Missing warning about ambiguous files) was that in case a file was ambiguous only a message was given. Now a warning is given plus one of the ambiguous files is used (might be the wrong one). --- src/docparser.cpp | 62 +++++++++++++++++++++++++++---------------------------- 1 file changed, 30 insertions(+), 32 deletions(-) diff --git a/src/docparser.cpp b/src/docparser.cpp index 9dd1c71..4ec4b52 100644 --- a/src/docparser.cpp +++ b/src/docparser.cpp @@ -287,8 +287,17 @@ static QCString findAndCopyImage(const char *fileName,DocImage::Type type, bool bool ambig; FileDef *fd; //printf("Search for %s\n",fileName); - if ((fd=findFileDef(Doxygen::imageNameDict,fileName,ambig)) && !ambig) + if (fd=findFileDef(Doxygen::imageNameDict,fileName,ambig)) { + if (ambig & dowarn) + { + QCString text; + text.sprintf("image file name %s is ambiguous.\n",qPrint(fileName)); + text+="Possible candidates:\n"; + text+=showFileDefMatches(Doxygen::imageNameDict,fileName); + warn_doc_error(g_fileName,doctokenizerYYlineno,text); + } + QCString inputFile = fd->absFilePath(); QFile inImage(inputFile); if (inImage.open(IO_ReadOnly)) @@ -378,17 +387,6 @@ static QCString findAndCopyImage(const char *fileName,DocImage::Type type, bool return baseName; } } - else if (ambig) - { - if (dowarn) - { - QCString text; - text.sprintf("image file name %s is ambiguous.\n",qPrint(fileName)); - text+="Possible candidates:\n"; - text+=showFileDefMatches(Doxygen::imageNameDict,fileName); - warn_doc_error(g_fileName,doctokenizerYYlineno,text); - } - } else { result=fileName; @@ -1846,16 +1844,16 @@ static void readTextFileByName(const QCString &file,QCString &text) // as a fallback we also look in the exampleNameDict bool ambig; FileDef *fd; - if ((fd=findFileDef(Doxygen::exampleNameDict,file,ambig)) && !ambig) + if (fd=findFileDef(Doxygen::exampleNameDict,file,ambig)) { text = fileToString(fd->absFilePath(),Config_getBool(FILTER_SOURCE_FILES)); - } - else if (ambig) - { - warn_doc_error(g_fileName,doctokenizerYYlineno,"included file name %s is ambiguous" + if (ambig) + { + warn_doc_error(g_fileName,doctokenizerYYlineno,"included file name %s is ambiguous" "Possible candidates:\n%s",qPrint(file), qPrint(showFileDefMatches(Doxygen::exampleNameDict,file)) ); + } } else { @@ -2748,17 +2746,17 @@ bool DocDotFile::parse() { fd = findFileDef(Doxygen::dotFileNameDict,m_name+".dot",ambig); } - if (fd && !ambig) + if (fd) { m_file = fd->absFilePath(); ok = true; - } - else if (ambig) - { - warn_doc_error(g_fileName,doctokenizerYYlineno,"included dot file name %s is ambiguous.\n" + if (ambig) + { + warn_doc_error(g_fileName,doctokenizerYYlineno,"included dot file name %s is ambiguous.\n" "Possible candidates:\n%s",qPrint(m_name), qPrint(showFileDefMatches(Doxygen::dotFileNameDict,m_name)) ); + } } else { @@ -2785,17 +2783,17 @@ bool DocMscFile::parse() { fd = findFileDef(Doxygen::mscFileNameDict,m_name+".msc",ambig); } - if (fd && !ambig) + if (fd) { m_file = fd->absFilePath(); ok = true; - } - else if (ambig) - { - warn_doc_error(g_fileName,doctokenizerYYlineno,"included msc file name %s is ambiguous.\n" + if (ambig) + { + warn_doc_error(g_fileName,doctokenizerYYlineno,"included msc file name %s is ambiguous.\n" "Possible candidates:\n%s",qPrint(m_name), qPrint(showFileDefMatches(Doxygen::mscFileNameDict,m_name)) ); + } } else { @@ -2824,17 +2822,17 @@ bool DocDiaFile::parse() { fd = findFileDef(Doxygen::diaFileNameDict,m_name+".dia",ambig); } - if (fd && !ambig) + if (fd) { m_file = fd->absFilePath(); ok = true; - } - else if (ambig) - { - warn_doc_error(g_fileName,doctokenizerYYlineno,"included dia file name %s is ambiguous.\n" + if (ambig) + { + warn_doc_error(g_fileName,doctokenizerYYlineno,"included dia file name %s is ambiguous.\n" "Possible candidates:\n%s",qPrint(m_name), qPrint(showFileDefMatches(Doxygen::diaFileNameDict,m_name)) ); + } } else { -- cgit v0.12 From 4e2a1ac22f27046f16acc95ea7d763a67bb7f344 Mon Sep 17 00:00:00 2001 From: albert-github Date: Fri, 23 Aug 2019 15:15:37 +0200 Subject: Text ' ' appears in code segments In case we have the UTF-8 code for nbsp in our source this is (see #6983) replaced with ` `, though in code fragments this is unwanted as here the text appears literally. the UTF-8 nbsp is temporary replaced by a "doxygen" tag and for fenced code blocks, backtick blocks and special bloc commands (code, verbatim, htmlonly, formulas,...) replaced back with the UTF-8 version, the remaining "doxygen" tags are at the end replaced with ` ` --- src/markdown.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/markdown.cpp b/src/markdown.cpp index 2cbdcb5..a3455ab 100644 --- a/src/markdown.cpp +++ b/src/markdown.cpp @@ -108,7 +108,8 @@ static Entry *g_current; static QCString g_fileName; static int g_lineNr; static int g_indentLevel=0; // 0 is outside markdown, -1=page level - +static char g_doxynbsputf8[3] = {'\xc2', '\xa0', '\0'}; // UTF-8 nbsp +static char *g_doxynbsp = "&_doxy_nbsp;"; //---------- const int codeBlockIndent = 4; @@ -1044,7 +1045,7 @@ static int processSpecialCommand(GrowBuf &out, const char *data, int offset, int if (qstrncmp(&data[i+1],endBlockName,l)==0) { //printf("found end at %d\n",i); - out.addStr(data,i+1+l); + out.addStr(substitute(QCString(data).left(i+1+l),g_doxynbsp,g_doxynbsputf8)); return i+1+l; } } @@ -2174,7 +2175,7 @@ static void writeFencedCodeBlock(GrowBuf &out,const char *data,const char *lng, { out.addStr("{"+lang+"}"); } - out.addStr(data+blockStart,blockEnd-blockStart); + out.addStr(substitute(QCString(data+blockStart).left(blockEnd-blockStart),g_doxynbsp,g_doxynbsputf8)); out.addStr("\n"); out.addStr("@endcode"); } @@ -2484,7 +2485,7 @@ static QCString detab(const QCString &s,int &refIndent) // special handling of the UTF-8 nbsp character 0xc2 0xa0 if (c == '\xc2' && data[i] == '\xa0') { - out.addStr(" "); + out.addStr(g_doxynbsp); i++; } else @@ -2561,7 +2562,7 @@ QCString processMarkdown(const QCString &fileName,const int lineNr,Entry *e,cons processInline(out,s,s.length()); out.addChar(0); Debug::print(Debug::Markdown,0,"======== Markdown =========\n---- input ------- \n%s\n---- output -----\n%s\n=========\n",qPrint(input),qPrint(out.get())); - return out.get(); + return substitute(out.get(),g_doxynbsp," "); } //--------------------------------------------------------------------------- -- cgit v0.12 From 6c4cd16b98e6d3abb6923b7bba0d87445cc891bf Mon Sep 17 00:00:00 2001 From: albert-github Date: Sat, 24 Aug 2019 18:21:18 +0200 Subject: Error in LaTeX with single quote in formula / math mode. When having a text like: ``` \f$ text t' text \f$ ``` and conversion this to a pdf (latex directory) we get the error: ``` ! Undefined control sequence. l.3 $ text t\text {'} text $ ? ``` --- src/latexdocvisitor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/latexdocvisitor.cpp b/src/latexdocvisitor.cpp index a0bbf73..ab03f32 100644 --- a/src/latexdocvisitor.cpp +++ b/src/latexdocvisitor.cpp @@ -621,7 +621,7 @@ void LatexDocVisitor::visit(DocFormula *f) { switch (c) { - case '\'': m_t << "\\text{'}"; break; + case '\'': m_t << "\\textnormal{\\textquotesingle}"; break; default: m_t << c; break; } } -- cgit v0.12 From fd3b60caa8bb99bec81b74d74f394c6043091c76 Mon Sep 17 00:00:00 2001 From: albert-github Date: Tue, 27 Aug 2019 16:55:47 +0200 Subject: Create possibility to define LaTeX commands for formulas To be able to have building bocks for formulas one can create a `\newcommand` (or when one wants to change a command `\renewcommand`). Due to the different handling of LaTeX commands in pure LaTeX code (latex output and formulas converted to images) and MathJax it is necessary to transform LaTeX commands to the MathJax equivalent. This is done in a transparent way by providing the new commands in a file and add this verbatim to the pure LaTeX code and to translate the `\newcommand` and `\renewcomamnd` to MathJax macros. --- addon/doxywizard/expert.cpp | 3 + doc/formulas.doc | 20 ++++- src/config.xml | 10 +++ src/configgen.py | 2 + src/formula.cpp | 14 ++++ src/htmlgen.cpp | 185 +++++++++++++++++++++++++++++++++++++++++++- src/latexgen.cpp | 10 +++ 7 files changed, 242 insertions(+), 2 deletions(-) diff --git a/addon/doxywizard/expert.cpp b/addon/doxywizard/expert.cpp index 64df27f..1303a22 100644 --- a/addon/doxywizard/expert.cpp +++ b/addon/doxywizard/expert.cpp @@ -398,6 +398,7 @@ static QString getDocsForNode(const QDomElement &child) // Remove / replace doxygen markup strings // the regular expressions are hard to read so the intention will be given + // Note: see also configgen.py in the src directory for other doxygen parts QRegExp regexp; // remove \n at end and replace by a space regexp.setPattern(SA("\\n$")); @@ -432,6 +433,8 @@ static QString getDocsForNode(const QDomElement &child) docs.replace(regexp,SA("\"External Indexing and Searching\"")); regexp.setPattern(SA("\\\\ref[ ]+external")); docs.replace(regexp,SA("\"Linking to external documentation\"")); + regexp.setPattern(SA("\\\\ref[ ]+formulas")); + docs.replace(regexp,SA("\"Including formulas\"")); // fallback for not handled docs.replace(SA("\\\\ref"),SA("")); // \b word -> word<\b> diff --git a/doc/formulas.doc b/doc/formulas.doc index 520f089..88a8725 100644 --- a/doc/formulas.doc +++ b/doc/formulas.doc @@ -100,9 +100,27 @@ the section should contain valid command for the specific environment. \warning Currently, doxygen is not very fault tolerant in recovering from typos in formulas. It may be necessary to remove the -files formula.repository that are written to the html and rtf directories to +files formula.repository that are written to the html, rtf etc. directories to get rid of an incorrect formula as well as the form_* files. +To have the possibility to define your own \LaTeX commands, for e.g. formula building blocks +or consistent writing of certain words, the configuration option \ref cfg_formula_macrofile "FORMULA_MACROFILE" +can be used. to supply a file with \LaTeX commands. +This file can contain \LaTeX `\newcommand` and \`renewcommand` commands and they are included +formulas (image version and MathJax version) as well as in the generated \LaTeX output (for PDF generation).
    +The `\newcommand` (and `\renewcommand`) are restricted to a version without optional +parameters so only the following types are supported: +``` +\newcommand{\cmd}{replacement} + and +\newcommand{\cmd}[nr]{replacement} +``` +e.g. +``` +\newcommand{\E}{\mathrm{E}} +\newcommand{\ccSum}[3]{\sum_{#1}^{#2}{#3}} +``` + \htmlonly Go to the next section or return to the index. diff --git a/src/config.xml b/src/config.xml index e68b3d7..a226863 100644 --- a/src/config.xml +++ b/src/config.xml @@ -2377,6 +2377,16 @@ The \c DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. ]]> +