- /// Fills keys with BibTeX information derived from the various insets
- /// in a given buffer, in its master document.
- void fillWithBibKeys(Buffer const * const buf);
- /// return the short form of an authorlist
- docstring const getAbbreviatedAuthor(docstring const & key) const;
- /// return the year from the bibtex data record
- docstring const getYear(docstring const & key) const;
- /// Returns formatted BibTeX data associated with a given key.
- /// Empty if no info exists.
- docstring const getInfo(docstring const & key) const;
-
- /**
- * "Translates the available Citation Styles into strings for a given key,
- * either numerical or author-year depending upon the active engine. (See
- * below for those methods.)
- */
- std::vector<docstring> const
- getCiteStrings(docstring const & key, Buffer const & buf) const;
- /**
- * "Translates" the available Citation Styles into strings for a given key.
- * The returned string is displayed by the GUI.
- * [XX] is used in place of the actual reference
- * Eg, the vector will contain: [XX], Jones et al. [XX], ...
- * User supplies :
- * the key,
- * the buffer
- */
- std::vector<docstring> const
- getNumericalStrings(docstring const & key, Buffer const & buf) const;
- /**
- * "Translates" the available Citation Styles into strings for a given key.
- * The returned string is displayed by the GUI.
- * Eg, the vector will contain:
- * Jones et al. (1990), (Jones et al. 1990), Jones et al. 1990, ...
- * User supplies :
- * the key,
- * the buffer
- */
- std::vector<docstring> const
- getAuthorYearStrings(docstring const & key, Buffer const & buf) const;
-
- std::set<docstring> fieldNames;
- std::set<docstring> entryTypes;
+ /// \return author or editor list (abbreviated form by default)
+ docstring const getAuthorOrEditorList(docstring const & key, Buffer const & buf) const;
+ /// \return the year from the bibtex data record for \param key
+ /// if \param use_modifier is true, then we will also append any
+ /// modifier for this entry (e.g., 1998b).
+ /// If no legacy year field is present, check for date (common in
+ /// biblatex) and extract the year from there.
+ /// Note further that this will get the year from the crossref or xdata
+ /// if it's not present in the record itself.
+ docstring const getYear(docstring const & key,
+ bool use_modifier = false) const;
+ /// \return the year from the bibtex data record for \param key
+ /// if \param use_modifier is true, then we will also append any
+ /// modifier for this entry (e.g., 1998b).
+ /// If no legacy year field is present, check for date (common in
+ /// biblatex) and extract the year from there.
+ /// Note further that this will get the year from the crossref or xdata
+ /// if it's not present in the record itself.
+ /// If no year is found, \return "No year" translated to the buffer
+ /// language.
+ docstring const getYear(docstring const & key, Buffer const & buf,
+ bool use_modifier = false) const;
+ ///
+ docstring const getCiteNumber(docstring const & key) const;
+ /// \return formatted BibTeX data associated with a given key.
+ /// Empty if no info exists.
+ /// Note that this will retrieve data from the crossref or xdata as needed.
+ /// \param ci contains further context information, such as if it should
+ /// output any richtext tags marked in the citation format and escape < and >
+ /// elsewhere, and the general output context.
+ docstring const getInfo(docstring const & key, Buffer const & buf,
+ CiteItem const & ci) const;
+ /// \return formatted BibTeX data for citation labels.
+ /// Citation labels can have more than one key.
+ docstring const getLabel(std::vector<docstring> keys, Buffer const & buf,
+ std::string const & style, CiteItem const & ci) const;
+ /// Is this a reference from a bibtex database
+ /// or from a bibliography environment?
+ bool isBibtex(docstring const & key) const;
+ /// A vector holding a pair of lyx cite command and the respective
+ /// output for a given (list of) key(s).
+ typedef std::vector<std::pair<docstring,docstring>> CiteStringMap;
+ /// Translates the available citation styles into strings for a given
+ /// list of keys, using either numerical or author-year style depending
+ /// upon the active engine. The function returns a CiteStringMap with the first
+ /// element being the lyx cite command, the second being the formatted
+ /// citation reference.
+ CiteStringMap const getCiteStrings(
+ std::vector<docstring> const & keys,
+ std::vector<CitationStyle> const & styles, Buffer const & buf,
+ CiteItem const & ci) const;
+ /// A list of BibTeX keys cited in the current document, sorted by
+ /// the last name of the author.
+ /// Make sure you have called collectCitedEntries() before you try to
+ /// use this. You should probably call it just before you use this.
+ std::vector<docstring> const & citedEntries() const
+ { return cited_entries_; }
+ ///
+ void makeCitationLabels(Buffer const & buf);
+ ///
+ const_iterator begin() const { return bimap_.begin(); }
+ ///
+ void clear() { bimap_.clear(); }
+ ///
+ bool empty() const { return bimap_.empty(); }
+ ///
+ const_iterator end() const { return bimap_.end(); }
+ ///
+ const_iterator find(docstring const & f) const { return bimap_.find(f); }
+ ///
+ void mergeBiblioInfo(BiblioInfo const & info);
+ ///
+ BibTeXInfo & operator[](docstring const & f) { return bimap_[f]; }
+ ///
+ void addFieldName(docstring const & f) { field_names_.insert(f); }
+ ///
+ void addEntryType(docstring const & f) { entry_types_.insert(f); }
+private:
+ /// Collects the cited entries from buf.
+ void collectCitedEntries(Buffer const & buf);
+ ///
+ std::set<docstring> field_names_;
+ ///
+ std::set<docstring> entry_types_;
+ /// our map: keys --> BibTeXInfo
+ std::map<docstring, BibTeXInfo> bimap_;
+ /// a possibly sorted list of entries cited in our Buffer.
+ /// do not try to make this a vector<BibTeXInfo *> or anything of
+ /// the sort, because reloads will invalidate those pointers.
+ std::vector<docstring> cited_entries_;