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 f17438620e08b245bcf133c422bed433fb46bc13 Mon Sep 17 00:00:00 2001 From: albert-github Date: Fri, 18 Oct 2019 10:20:27 +0200 Subject: issue #7313 VHDL attribute 'subtype is not supported and breaks parser Add the `'subtype` construct for variables etc. --- vhdlparser/vhdlparser.jj | 3 +++ 1 file changed, 3 insertions(+) diff --git a/vhdlparser/vhdlparser.jj b/vhdlparser/vhdlparser.jj index 126118c..2f0c466 100644 --- a/vhdlparser/vhdlparser.jj +++ b/vhdlparser/vhdlparser.jj @@ -1614,6 +1614,9 @@ QCString name_ext1() : {QCString s,s1,s2;} { ( + LOOKAHEAD() + {s+="'subtype";} +| LOOKAHEAD( suffix()) s1=suffix(){s+=".";s+=s1;} | -- cgit v0.12 From a2f09d6aae1260822fecf2f0de9c1d3fbcc312e7 Mon Sep 17 00:00:00 2001 From: Roel Standaert Date: Wed, 4 Dec 2019 00:32:28 +0100 Subject: Fix incorrect reference resolving of enum class values When they share enum value names inside the same namespace. This is a proposed fix for issue #7427: "Incorrect resolving of references to enum class values with shared names inside the same namespace" --- src/util.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util.cpp b/src/util.cpp index 5868b62..570a09c 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -4283,7 +4283,7 @@ bool getDefs(const QCString &scName, int ni=namespaceName.findRev("::"); //printf("namespaceName=%s ni=%d\n",namespaceName.data(),ni); bool notInNS = tmd && ni==-1 && tmd->getNamespaceDef()==0 && (mScope.isEmpty() || mScope==tmd->name()); - bool sameNS = tmd && tmd->getNamespaceDef() && namespaceName.left(ni)==tmd->getNamespaceDef()->name(); + bool sameNS = tmd && tmd->getNamespaceDef() && namespaceName.left(ni)==tmd->getNamespaceDef()->name() && namespaceName.mid(ni+2)==tmd->name(); //printf("notInNS=%d sameNS=%d\n",notInNS,sameNS); if (tmd && tmd->isStrong() && // C++11 enum class (notInNS || sameNS) && -- cgit v0.12 From 72eed17195c6650d503c191fb8e3ed54d3426df4 Mon Sep 17 00:00:00 2001 From: albert-github Date: Fri, 6 Dec 2019 12:46:49 +0100 Subject: Email address seen as code starter Some email addresses give problems in the comment converter as they contain e.g. `@code`, so we try to detect Email addresses (analogous to doctokenizer.l) to prevent these false positives. The given warning would ne like: ``` aa.h:13: warning: Reached end of file while still inside a (nested) comment. Nesting level 1 (probable line reference: 1) ``` --- src/commentcnv.l | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/commentcnv.l b/src/commentcnv.l index 13a21c3..66aada1 100644 --- a/src/commentcnv.l +++ b/src/commentcnv.l @@ -119,6 +119,8 @@ static void replaceComment(yyscan_t yyscanner,int offset); %} +MAILADR ("mailto:")?[a-z_A-Z0-9.+-]+"@"[a-z_A-Z0-9-]+("."[a-z_A-Z0-9\-]+)+[a-z_A-Z0-9\-]+ + %option noyywrap %x Scan @@ -335,6 +337,10 @@ static void replaceComment(yyscan_t yyscanner,int offset); yyextra->commentStack.push(new CommentCtx(yyextra->lineNr)); } } +{MAILADR} | +"<"{MAILADR}">" { // Mail address, to prevent seeing e.g x@code-factory.org as start of a code block + copyToOutput(yyscanner,yytext,(int)yyleng); + } "{@code"/[ \t\n] { copyToOutput(yyscanner,"@code",5); yyextra->lastCommentContext = YY_START; @@ -519,7 +525,7 @@ static void replaceComment(yyscan_t yyscanner,int offset); copyToOutput(yyscanner,yytext,(int)yyleng); } -[^\\!@*\n{\"\/]* { /* anything that is not a '*' or command */ +[^ <\\!@*\n{\"\/]* { /* anything that is not a '*' or command */ copyToOutput(yyscanner,yytext,(int)yyleng); } "*"+[^*/\\@\n{\"]* { /* stars without slashes */ -- cgit v0.12