diff options
author | Dimitri van Heesch <doxygen@gmail.com> | 2021-06-13 08:58:42 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-13 08:58:42 (GMT) |
commit | 64c7301d7ffa1c6eef5a1f9a4a58268d2b735da4 (patch) | |
tree | edd544203ef32da2ea670358697cba1746c9fee7 | |
parent | 8516c0a1a979aff077ad029acd9a18271086542f (diff) | |
parent | 0ee3c373963c91bc5cbaf220764483a6f05d977e (diff) | |
download | Doxygen-64c7301d7ffa1c6eef5a1f9a4a58268d2b735da4.zip Doxygen-64c7301d7ffa1c6eef5a1f9a4a58268d2b735da4.tar.gz Doxygen-64c7301d7ffa1c6eef5a1f9a4a58268d2b735da4.tar.bz2 |
Merge pull request #8589 from albert-github/feature/bug_cite
Problem with cite command (tests 12)
-rw-r--r-- | src/docbookvisitor.cpp | 9 | ||||
-rw-r--r-- | src/docparser.cpp | 4 | ||||
-rw-r--r-- | src/docparser.h | 6 | ||||
-rw-r--r-- | src/rtfdocvisitor.cpp | 7 | ||||
-rw-r--r-- | src/util.cpp | 6 |
5 files changed, 24 insertions, 8 deletions
diff --git a/src/docbookvisitor.cpp b/src/docbookvisitor.cpp index 0bc2042..65081ef 100644 --- a/src/docbookvisitor.cpp +++ b/src/docbookvisitor.cpp @@ -1190,7 +1190,14 @@ void DocbookDocVisitor::visitPre(DocHRef *href) { DB_VIS_C if (m_hide) return; - m_t << "<link xlink:href=\"" << convertToDocBook(href->url()) << "\">"; + if (href->url().at(0) != '#') + { + m_t << "<link xlink:href=\"" << convertToDocBook(href->url()) << "\">"; + } + else + { + startLink(href->file(),filterId(href->url().mid(1))); + } } void DocbookDocVisitor::visitPost(DocHRef *) diff --git a/src/docparser.cpp b/src/docparser.cpp index a53a29b..d386b48 100644 --- a/src/docparser.cpp +++ b/src/docparser.cpp @@ -998,7 +998,9 @@ static int handleAHref(DocNode *parent,DocNodeList &children,const HtmlAttribLis HtmlAttribList attrList = tagHtmlAttribs; // and remove the href attribute attrList.erase(attrList.begin()+index); - DocHRef *href = new DocHRef(parent,attrList,opt.value,g_relPath); + QCString relPath; + if (opt.value.at(0) != '#') relPath = g_relPath; + DocHRef *href = new DocHRef(parent,attrList,opt.value,relPath,convertNameToFile(g_fileName,FALSE,TRUE)); children.push_back(std::unique_ptr<DocHRef>(href)); g_insideHtmlLink=TRUE; retval = href->parse(); diff --git a/src/docparser.h b/src/docparser.h index f256c56..e76dc16 100644 --- a/src/docparser.h +++ b/src/docparser.h @@ -915,10 +915,11 @@ class DocHRef : public CompAccept<DocHRef> { public: DocHRef(DocNode *parent,const HtmlAttribList &attribs,const QCString &url, - const QCString &relPath) : - m_attribs(attribs), m_url(url), m_relPath(relPath) { m_parent = parent; } + const QCString &relPath, const QCString &file) : + m_attribs(attribs), m_url(url), m_relPath(relPath), m_file(file) { m_parent = parent; } int parse(); QCString url() const { return m_url; } + QCString file() const { return m_file; } QCString relPath() const { return m_relPath; } Kind kind() const override { return Kind_HRef; } const HtmlAttribList &attribs() const { return m_attribs; } @@ -926,6 +927,7 @@ class DocHRef : public CompAccept<DocHRef> private: HtmlAttribList m_attribs; QCString m_url; + QCString m_file; QCString m_relPath; }; diff --git a/src/rtfdocvisitor.cpp b/src/rtfdocvisitor.cpp index b1df440..025cc90 100644 --- a/src/rtfdocvisitor.cpp +++ b/src/rtfdocvisitor.cpp @@ -1135,12 +1135,11 @@ void RTFDocVisitor::visitPre(DocHRef *href) DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocHRef)}\n"); if (Config_getBool(RTF_HYPERLINKS)) { - if (href->url().startsWith("#CITEREF")) + if (href->url().startsWith("#")) { - // when starting with #CITEREF it is a doxygen generated "url"a - // so a local link + // when starting with # so a local link QCString cite; - cite = "citelist_" + href->url().right(href->url().length()-1); + cite = href->file() + "_" + href->url().right(href->url().length()-1); m_t << "{\\field " "{\\*\\fldinst " "{ HYPERLINK \\\\l \"" << rtfFormatBmkStr(cite) << "\" " diff --git a/src/util.cpp b/src/util.cpp index 7c469ab..75a86a1 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -5205,6 +5205,12 @@ QCString rtfFormatBmkStr(const QCString &name) // substitute a short arbitrary string for the name // supplied, and keep track of the correspondence // between names and strings. + auto it = g_tagMap.find(name.str()); + if (it!=g_tagMap.end()) // already known + { + return QCString(it->second); + } + QCString tag = g_nextTag; auto result = g_tagMap.insert( std::make_pair(name.str(), g_nextTag.str()) ); |