diff options
author | Dimitri van Heesch <doxygen@gmail.com> | 2020-07-31 17:34:37 (GMT) |
---|---|---|
committer | Dimitri van Heesch <doxygen@gmail.com> | 2020-07-31 17:34:37 (GMT) |
commit | 710117ba1c88da13f1cabf9f65bf780412395d56 (patch) | |
tree | 76fc30e3163cb773fe4c54327ac3cb13af4e3f55 | |
parent | d56e225889003904344d6b4e9ae4ff2338733539 (diff) | |
parent | e9853388b4c682ecf0e19d1222d75ad452039340 (diff) | |
download | Doxygen-710117ba1c88da13f1cabf9f65bf780412395d56.zip Doxygen-710117ba1c88da13f1cabf9f65bf780412395d56.tar.gz Doxygen-710117ba1c88da13f1cabf9f65bf780412395d56.tar.bz2 |
Merge branch 'feature/bug_cite_crossref' of https://github.com/albert-github/doxygen into albert-github-feature/bug_cite_crossref
-rw-r--r-- | src/cite.cpp | 49 |
1 files changed, 46 insertions, 3 deletions
diff --git a/src/cite.cpp b/src/cite.cpp index 78df0c3..f9af2b4 100644 --- a/src/cite.cpp +++ b/src/cite.cpp @@ -139,6 +139,7 @@ void CitationManager::generatePage() input.at(fi.size())='\0'; int pos=0; int s; + QCString citeName; while ((s=input.find('\n',pos))!=-1) { QCString line = input.mid((uint)pos,(uint)(s-pos)); @@ -151,13 +152,55 @@ void CitationManager::generatePage() int k=line.find("}",i); if (j!=-1 && k!=-1) { - QCString label = line.mid((uint)(j+1),(uint)(k-j-1)); - if (p->entries.find(label.data())==p->entries.end()) // not found yet + QCString crossrefName = line.mid((uint)(j+1),(uint)(k-j-1)); + // check if the reference with the cross reference is used + // insert cross refererence when cross reference has not yet been added. + if ((p->entries.find(citeName.data())!=p->entries.end()) && + (p->entries.find(crossrefName.data())==p->entries.end())) // not found yet { - insert(label); + insert(crossrefName); } } } + else if (line.stripWhiteSpace().startsWith("@")) + { + // assumption entry like: "@book { name," or "@book { name" (spaces optional) + int j=line.find("{"); + // when no {, go hunting for it + while (j==-1 && (s=input.find('\n',pos))!=-1) + { + line = input.mid((uint)pos,(uint)(s-pos)); + j=line.find("{"); + pos=s+1; + } + // search for the name + citeName = ""; + if (s != -1 && j!= -1) // to prevent something like "@manual ," and no { found + { + int k=line.find(",",j); + j++; + while (s != -1 && citeName.isEmpty()) + { + if (k != -1) + { + citeName = line.mid((uint)(j),(uint)(k-j)); + } + else + { + citeName = line.mid((uint)(j)); + } + citeName = citeName.stripWhiteSpace(); + j = 0; + if (citeName.isEmpty() && (s=input.find('\n',pos))!=-1) + { + line = input.mid((uint)pos,(uint)(s-pos)); + pos=s+1; + k=line.find(","); + } + } + } + //printf("citeName = #%s#\n",citeName.data()); + } } } } |