summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/cite.cpp61
-rw-r--r--templates/html/doxygen.bst12
-rwxr-xr-x[-rw-r--r--]testing/012/citelist.xml65
-rwxr-xr-x[-rw-r--r--]testing/012/indexpage.xml25
-rw-r--r--testing/012_cite.dox2
-rw-r--r--testing/sample.bib25
6 files changed, 143 insertions, 47 deletions
diff --git a/src/cite.cpp b/src/cite.cpp
index 4f88611..fd7b0e4 100644
--- a/src/cite.cpp
+++ b/src/cite.cpp
@@ -22,11 +22,13 @@
#include "language.h"
#include "ftextstream.h"
#include "resourcemgr.h"
+#include "doxygen.h"
#include <qdir.h>
//--------------------------------------------------------------------------
const QCString CiteConsts::fileName("citelist");
+/* when changing this also take doxygen.bst into account */
const QCString CiteConsts::anchorPrefix("CITEREF_");
const QCString bibTmpFile("bibTmpFile_");
const QCString bibTmpDir("bibTmpDir/");
@@ -118,8 +120,58 @@ void CiteDict::generatePage() const
// do not generate an empty citations page
if (isEmpty()) return; // nothing to cite
- // 1. generate file with markers and citations to OUTPUT_DIRECTORY
+ // 0. add cross references from the bib files to the cite dictionary
QFile f;
+ QStrList &citeDataList = Config_getList(CITE_BIB_FILES);
+ const char *bibdata = citeDataList.first();
+ while (bibdata)
+ {
+ QCString bibFile = bibdata;
+ if (!bibFile.isEmpty() && bibFile.right(4)!=".bib") bibFile+=".bib";
+ QFileInfo fi(bibFile);
+ if (fi.exists())
+ {
+ if (!bibFile.isEmpty())
+ {
+ f.setName(bibFile);
+ if (!f.open(IO_ReadOnly))
+ {
+ err("could not open file %s for reading\n",bibFile.data());
+ }
+ QCString doc;
+ QFileInfo fi(bibFile);
+ QCString input(fi.size()+1);
+ f.readBlock(input.rawData(),fi.size());
+ f.close();
+ input.at(fi.size())='\0';
+ int p=0,s;
+ while ((s=input.find('\n',p))!=-1)
+ {
+ QCString line = input.mid(p,s-p);
+ p=s+1;
+
+ int i;
+ if ((i = line.find("crossref")) != -1) /* assumption crosreference is on one line and the only item */
+ {
+ int j=line.find("{",i);
+ int k=line.find("}",i);
+ if (j!=-1 && k!=-1)
+ {
+ QCString label = line.mid(j+1,k-j-1);
+ if (!m_entries.find(label)) Doxygen::citeDict->insert(label.data());
+ }
+ }
+ }
+ }
+ }
+ else if (!fi.exists())
+ {
+ err("bib file %s not found!\n",bibFile.data());
+ }
+ bibdata = citeDataList.next();
+ }
+
+ // 1. generate file with markers and citations to OUTPUT_DIRECTORY
QCString outputDir = Config_getString(OUTPUT_DIRECTORY);
QCString citeListFile = outputDir+"/citelist.doc";
f.setName(citeListFile);
@@ -154,12 +206,11 @@ void CiteDict::generatePage() const
// so bibtex can find them without path (bibtex doesn't support paths or
// filenames with spaces!)
// Strictly not required when only latex is generated
- QStrList &citeDataList = Config_getList(CITE_BIB_FILES);
QCString bibOutputDir = outputDir+"/"+bibTmpDir;
QCString bibOutputFiles = "";
QDir thisDir;
thisDir.mkdir(bibOutputDir);
- const char *bibdata = citeDataList.first();
+ bibdata = citeDataList.first();
int i = 0;
while (bibdata)
{
@@ -175,10 +226,6 @@ void CiteDict::generatePage() const
bibOutputFiles = bibOutputFiles + " " + bibTmpDir + bibTmpFile + QCString().setNum(i) + ".bib";
}
}
- else if (!fi.exists())
- {
- err("bib file %s not found!\n",bibFile.data());
- }
bibdata = citeDataList.next();
}
diff --git a/templates/html/doxygen.bst b/templates/html/doxygen.bst
index c6ae7a8..3bdb4f4 100644
--- a/templates/html/doxygen.bst
+++ b/templates/html/doxygen.bst
@@ -549,7 +549,7 @@ FUNCTION {format.tr.number}
FUNCTION {format.article.crossref}
{
- "In <a href=" quote$ * "#" * crossref * quote$ * ">" *
+ "In <a href=" quote$ * "#" * "CITEREF_" * crossref * quote$ * ">" *
key empty$
{ journal empty$
{ "need key or journal for " cite$ * " to crossref " * crossref *
@@ -561,7 +561,7 @@ FUNCTION {format.article.crossref}
}
{ key * }
if$
- "</a> \citelabel{" * crossref * "}" *
+ "</a> \citelabel{" * "CITEREF_" * crossref * "}" *
}
FUNCTION {format.crossref.editor}
@@ -590,7 +590,7 @@ FUNCTION {format.book.crossref}
" of " *
}
if$
- "<a href=" * quote$ * "#" * crossref * quote$ * ">" *
+ "<a href=" * "CITEREF_" * quote$ * "#" * crossref * quote$ * ">" *
editor empty$
editor field.or.null author field.or.null =
or
@@ -608,12 +608,12 @@ FUNCTION {format.book.crossref}
}
{ format.crossref.editor * }
if$
- "</a> \citelabel{" * crossref * "}" *
+ "</a> \citelabel{" * "CITEREF_" * crossref * "}" *
}
FUNCTION {format.incoll.inproc.crossref}
{
- "In <a href=" quote$ * "#" * crossref * quote$ * ">" *
+ "In <a href=" quote$ * "#" * "CITEREF_" * crossref * quote$ * ">" *
editor empty$
editor field.or.null author field.or.null =
or
@@ -631,7 +631,7 @@ FUNCTION {format.incoll.inproc.crossref}
}
{ format.crossref.editor * }
if$
- "</a> \citelabel{" * crossref * "}" *
+ "</a> \citelabel{" * "CITEREF_" * crossref * "}" *
}
FUNCTION {article}
diff --git a/testing/012/citelist.xml b/testing/012/citelist.xml
index f415968..cb039fd 100644..100755
--- a/testing/012/citelist.xml
+++ b/testing/012/citelist.xml
@@ -1,22 +1,43 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="">
- <compounddef id="citelist" kind="page">
- <compoundname>citelist</compoundname>
- <title>Bibliography</title>
- <briefdescription>
- </briefdescription>
- <detaileddescription>
- <para>
- <variablelist>
- <varlistentry>
- <term><anchor id="citelist_1CITEREF_knuth79"/>[1]</term>
- </varlistentry>
- <listitem>
- <para>Donald<nonbreakablespace/>E. Knuth. <emphasis>Tex and Metafont, New Directions in Typesetting</emphasis>. American Mathematical Society and Digital Press, Stanford, 1979.</para>
- <para/>
- </listitem>
- </variablelist>
- </para>
- </detaileddescription>
- </compounddef>
-</doxygen>
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="">
+ <compounddef id="citelist" kind="page">
+ <compoundname>citelist</compoundname>
+ <title>Bibliography</title>
+ <briefdescription>
+ </briefdescription>
+ <detaileddescription>
+ <para>
+ <variablelist>
+ <varlistentry>
+ <term><anchor id="citelist_1CITEREF_Be09"/>[1]</term>
+ </varlistentry>
+ <listitem>
+ <para>P.<nonbreakablespace/>Belotti. <ulink url="http://doi.org/10.1007/978-1-4614-1927-3_5">Disjunctive cuts for non-convex MINLP</ulink>. In <ulink url="#CITEREF_LeLe12">Lee and Leyffer</ulink> <ulink url="#CITEREF_LeLe12">[4]</ulink>, pages 117<ndash/>144.</para>
+ <para/>
+ </listitem>
+ <varlistentry>
+ <term><anchor id="citelist_1CITEREF_BertholdHeinzVigerske2009"/>[2]</term>
+ </varlistentry>
+ <listitem>
+ <para>T.<nonbreakablespace/>Berthold, S.<nonbreakablespace/>Heinz, and S.<nonbreakablespace/>Vigerske. <ulink url="http://doi.org/10.1007/978-1-4614-1927-3_15">Extending a CIP framework to solve MIQCPs</ulink>. In <ulink url="#CITEREF_LeLe12">Lee and Leyffer</ulink> <ulink url="#CITEREF_LeLe12">[4]</ulink>, pages 427<ndash/>444.</para>
+ <para/>
+ </listitem>
+ <varlistentry>
+ <term><anchor id="citelist_1CITEREF_knuth79"/>[3]</term>
+ </varlistentry>
+ <listitem>
+ <para>Donald<nonbreakablespace/>E. Knuth. <emphasis>Tex and Metafont, New Directions in Typesetting</emphasis>. American Mathematical Society and Digital Press, Stanford, 1979.</para>
+ <para/>
+ </listitem>
+ <varlistentry>
+ <term><anchor id="citelist_1CITEREF_LeLe12"/>[4]</term>
+ </varlistentry>
+ <listitem>
+ <para>Jon Lee and Sven Leyffer, editors. <ulink url="http://doi.org/10.1007/978-1-4614-1927-3"><emphasis>Mixed Integer Nonlinear Programming</emphasis></ulink>, volume 154 of <emphasis>The IMA Volumes in Mathematics and its Applications</emphasis>. Springer, 2012.</para>
+ <para/>
+ </listitem>
+ </variablelist>
+ </para>
+ </detaileddescription>
+ </compounddef>
+</doxygen>
diff --git a/testing/012/indexpage.xml b/testing/012/indexpage.xml
index 73fb669..e682540 100644..100755
--- a/testing/012/indexpage.xml
+++ b/testing/012/indexpage.xml
@@ -1,12 +1,13 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="">
- <compounddef id="indexpage" kind="page">
- <compoundname>index</compoundname>
- <title>My Project</title>
- <briefdescription>
- </briefdescription>
- <detaileddescription>
- <para>See <ref refid="citelist_1CITEREF_knuth79" kindref="member">[1]</ref> for more info. </para>
- </detaileddescription>
- </compounddef>
-</doxygen>
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="">
+ <compounddef id="indexpage" kind="page">
+ <compoundname>index</compoundname>
+ <title>My Project</title>
+ <briefdescription>
+ </briefdescription>
+ <detaileddescription>
+ <para>See <ref refid="citelist_1CITEREF_knuth79" kindref="member">[3]</ref> for more info.</para>
+ <para>Oter references with crosreference see <ref refid="citelist_1CITEREF_Be09" kindref="member">[1]</ref> and <ref refid="citelist_1CITEREF_BertholdHeinzVigerske2009" kindref="member">[2]</ref> for more info. </para>
+ </detaileddescription>
+ </compounddef>
+</doxygen>
diff --git a/testing/012_cite.dox b/testing/012_cite.dox
index 94be5e7..4b5e40d 100644
--- a/testing/012_cite.dox
+++ b/testing/012_cite.dox
@@ -4,4 +4,6 @@
// config: CITE_BIB_FILES = $INPUTDIR/sample.bib
/** \mainpage
* See \cite knuth79 for more info.
+ *
+ * Oter references with crosreference see \cite Be09 and \cite BertholdHeinzVigerske2009 for more info.
*/
diff --git a/testing/sample.bib b/testing/sample.bib
index 436e8cd..c20175d 100644
--- a/testing/sample.bib
+++ b/testing/sample.bib
@@ -5,3 +5,28 @@
publisher = "American Mathematical Society and Digital Press",
address = "Stanford"
}
+@InCollection{ BertholdHeinzVigerske2009,
+ author = {T. Berthold and S. Heinz and S. Vigerske},
+ title = {Extending a {CIP} framework to solve {MIQCP}s},
+ crossref = {LeLe12},
+ pages = {427--444},
+ url = {http://doi.org/10.1007/978-1-4614-1927-3_15}
+}
+@Book{ LeLe12,
+ title = {Mixed Integer Nonlinear Programming},
+ booktitle = {Mixed Integer Nonlinear Programming},
+ publisher = {Springer},
+ year = {2012},
+ editor = {Jon Lee and Sven Leyffer},
+ volume = {154},
+ series = {The IMA Volumes in Mathematics and its Applications},
+ url = {http://doi.org/10.1007/978-1-4614-1927-3},
+ issn = {978-1-4614-1926-6}
+}
+@InCollection{ Be09,
+ author = {P. Belotti},
+ title = {Disjunctive cuts for non-convex {MINLP}},
+ crossref = {LeLe12},
+ pages = {117--144},
+ url = {http://doi.org/10.1007/978-1-4614-1927-3_5}
+}