diff options
author | Dimitri van Heesch <doxygen@gmail.com> | 2019-12-08 15:52:39 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-08 15:52:39 (GMT) |
commit | 7f88821f11f1c64bed3fd76cbdd28552ace54437 (patch) | |
tree | 664caf376850d6c69122b69e1c79e34ec0189c25 | |
parent | ba6cf72c13b901c897e24f74f0ef8cfe3f1a4ea4 (diff) | |
parent | a390d6a9ad62019c7ca3d3689184fd3ce6afd57c (diff) | |
download | Doxygen-7f88821f11f1c64bed3fd76cbdd28552ace54437.zip Doxygen-7f88821f11f1c64bed3fd76cbdd28552ace54437.tar.gz Doxygen-7f88821f11f1c64bed3fd76cbdd28552ace54437.tar.bz2 |
Merge pull request #7186 from albert-github/feature/bug_cite_docbook
Incorrect NCName in docbook citations
-rw-r--r-- | src/docbookvisitor.cpp | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/src/docbookvisitor.cpp b/src/docbookvisitor.cpp index 08ec4dd..43673de 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<DocNode> &children) { QListIterator<DocNode> cli(children); @@ -374,7 +394,7 @@ void DocbookDocVisitor::visit(DocAnchor *anc) { DB_VIS_C if (m_hide) return; - m_t << "<anchor xml:id=\"_" << stripPath(anc->file()) << "_1" << anc->anchor() << "\"/>"; + m_t << "<anchor xml:id=\"_" << stripPath(anc->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(); } |