diff options
author | albert-github <albert.tests@gmail.com> | 2020-07-30 09:38:57 (GMT) |
---|---|---|
committer | albert-github <albert.tests@gmail.com> | 2020-07-30 09:38:57 (GMT) |
commit | 7894dd7d82d9fcfe524cb7ff2e5dea1824816bb8 (patch) | |
tree | 939da10addf77562fa1b46eceefcf503082603a3 | |
parent | 89f9d113d0d788552a32b699a89f273f6ce58c0f (diff) | |
download | Doxygen-7894dd7d82d9fcfe524cb7ff2e5dea1824816bb8.zip Doxygen-7894dd7d82d9fcfe524cb7ff2e5dea1824816bb8.tar.gz Doxygen-7894dd7d82d9fcfe524cb7ff2e5dea1824816bb8.tar.bz2 |
crossref citations are shown unconditionally
Based on the review
- implemented tip `find("{");` instead of `find("{",0);`
- made `label..` names more expressing their content
- got a few regressions regarding endless loops (it is incorrect bib file syntax), the constructs have to be at the end of the bib file, like (also with extra newlines)
- `@book ,`
- `@book { ,`
-rw-r--r-- | src/cite.cpp | 49 |
1 files changed, 26 insertions, 23 deletions
diff --git a/src/cite.cpp b/src/cite.cpp index d02cb75..271e262 100644 --- a/src/cite.cpp +++ b/src/cite.cpp @@ -139,7 +139,7 @@ void CitationManager::generatePage() input.at(fi.size())='\0'; int pos=0; int s; - QCString label1; + QCString citeName; while ((s=input.find('\n',pos))!=-1) { QCString line = input.mid((uint)pos,(uint)(s-pos)); @@ -152,46 +152,49 @@ void CitationManager::generatePage() int k=line.find("}",i); if (j!=-1 && k!=-1) { - QCString label = line.mid((uint)(j+1),(uint)(k-j-1)); + 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(label1.data())!=p->entries.end()) && - (p->entries.find(label.data())==p->entries.end())) // not found yet + 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("{",0); + 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("{",0); + j=line.find("{"); pos=s+1; } // search for the name - label1 = ""; - while (label1.isEmpty()) + citeName = ""; + if (j != -1) // to prevent something like "@manual ," and no { found { - int k=line.find(",",j); - if (k != -1) + while (s != -1 && citeName.isEmpty()) { - label1 = line.mid((uint)(j+1),(uint)(k-j-1)); - } - else - { - label1 = line.mid((uint)(j+1)); - } - label1 = label1.stripWhiteSpace(); - j = -1; - if (label1.isEmpty() && (s=input.find('\n',pos))!=-1) - { - line = input.mid((uint)pos,(uint)(s-pos)); - pos=s+1; + int k=line.find(",",j); + if (k != -1) + { + citeName = line.mid((uint)(j+1),(uint)(k-j-1)); + } + else + { + citeName = line.mid((uint)(j+1)); + } + citeName = citeName.stripWhiteSpace(); + j = -1; + if (citeName.isEmpty() && (s=input.find('\n',pos))!=-1) + { + line = input.mid((uint)pos,(uint)(s-pos)); + pos=s+1; + } } } } |