]> git.lyx.org Git - lyx.git/blobdiff - src/BiblioInfo.cpp
Cmake build: Creating a define for a header file found
[lyx.git] / src / BiblioInfo.cpp
index 98d0cfe57c2262943b28f2e40954b016dfcafbcd..84ea4f035f4241bef40b625a0e432e931ed1e2f5 100644 (file)
@@ -625,14 +625,6 @@ docstring const BibTeXInfo::getLabel(BibTeXInfo const * const xref,
 {
        docstring loclabel;
 
-       /*
-       if (!is_bibtex_) {
-               BibTeXInfo::const_iterator it = find(from_ascii("ref"));
-               label_ = it->second;
-               return label_;
-       }
-       */
-
        int counter = 0;
        loclabel = expandFormat(format, xref, counter, buf,
                before, after, dialog, next);
@@ -697,6 +689,14 @@ docstring BibTeXInfo::getValueForKey(string const & key, Buffer const & buf,
                                + " [" + operator[]("year") + "]";
                else
                        return operator[]("title");
+       } else if (key == "bibentry") {
+               // Special key to provide the full bibliography entry: see getInfo()
+               CiteEngineType const engine_type = buf.params().citeEngineType();
+               DocumentClass const & dc = buf.params().documentClass();
+               string const & format = dc.getCiteFormat(engine_type, to_utf8(entry_type_));
+               int counter = 0;
+               return expandFormat(format, xref, counter, buf,
+                       docstring(), docstring(), docstring(), false);
        } else if (key == "textbefore")
                return before;
        else if (key == "textafter")
@@ -1012,6 +1012,28 @@ void BiblioInfo::makeCitationLabels(Buffer const & buf)
                        last = biit;
                }
        }
+       // Set the labels
+       it = cited_entries_.begin();
+       for (; it != en; ++it) {
+               map<docstring, BibTeXInfo>::iterator const biit = bimap_.find(*it);
+               // this shouldn't happen, but...
+               if (biit == bimap_.end())
+                       // ...fail gracefully, anyway.
+                       continue;
+               BibTeXInfo & entry = biit->second;
+               if (numbers) {
+                       entry.label(entry.citeNumber());
+               } else {
+                       docstring const auth = entry.getAbbreviatedAuthor(buf, false);
+                       // we do it this way so as to access the xref, if necessary
+                       // note that this also gives us the modifier
+                       docstring const year = getYear(*it, buf, true);
+                       if (!auth.empty() && !year.empty())
+                               entry.label(auth + ' ' + year);
+                       else
+                               entry.label(entry.key());
+               }
+       }
 }