X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FBiblioInfo.h;h=efe4bff233948d61e5785959e87a0f2815bd320f;hb=5f1bfdde1e1eb61987f178f643a08017dc3803f7;hp=77c3dab729119273e0efa3fda12e5b7db2c9e31c;hpb=782db81f771cb12977f19b050fb2cbaa8511e16e;p=lyx.git diff --git a/src/BiblioInfo.h b/src/BiblioInfo.h index 77c3dab729..efe4bff233 100644 --- a/src/BiblioInfo.h +++ b/src/BiblioInfo.h @@ -61,7 +61,8 @@ public: docstring const getXRef() const; /// \return formatted BibTeX data suitable for framing. /// \param pointer to crossref information - docstring const & getInfo(BibTeXInfo const * const xref = 0) const; + docstring const & getInfo(BibTeXInfo const * const xref, + Buffer const & buf, bool richtext) const; /// const_iterator find(docstring const & f) const { return bimap_.find(f); } /// @@ -106,6 +107,23 @@ private: /// be the one referenced in the crossref field. docstring getValueForKey(std::string const & key, BibTeXInfo const * const xref = 0) const; + /// replace %keys% in a format string with their values + /// called from getInfo() + /// format strings may contain: + /// %key%, which represents a key + /// {%key%[[format]]}, which prints format if key is non-empty + /// the latter may optionally contain an `else' clause as well: + /// {%key%[[if format]][[else format]]} + /// material intended only for rich text (HTML) output should be + /// wrapped in "{!" and "!}". it will be removed if richtext is + /// false. + /// a simple macro facility is also available. keys that look like + /// "%!key%" are substituted with their definition. + /// moreover, keys that look like "%_key%" are treated as translatable + /// so that things like "pp." and "vol." can be translated. + docstring expandFormat(std::string const & fmt, + BibTeXInfo const * const xref, int & counter, + Buffer const & buf, bool richtext) const; /// true if from BibTeX; false if from bibliography environment bool is_bibtex_; /// the BibTeX key for this entry @@ -155,7 +173,13 @@ public: /// \return formatted BibTeX data associated with a given key. /// Empty if no info exists. /// Note that this will retrieve data from the crossref as needed. - docstring const getInfo(docstring const & key) const; + /// If \param richtext is true, then it will output any richtext tags + /// marked in the citation format and escape < and > elsewhere. + docstring const getInfo(docstring const & key, Buffer const & buf, + bool richtext = false) const; + /// Is this a reference from a bibtex database + /// or from a bibliography environment? + bool isBibtex(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