mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-23 05:25:26 +00:00
Fix 5538.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@27633 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
d38cc523c6
commit
656ffa1079
@ -24,9 +24,9 @@
|
||||
#include "insets/InsetBibtex.h"
|
||||
#include "insets/InsetInclude.h"
|
||||
|
||||
#include "support/lassert.h"
|
||||
#include "support/docstream.h"
|
||||
#include "support/gettext.h"
|
||||
#include "support/lassert.h"
|
||||
#include "support/lstrings.h"
|
||||
|
||||
#include "boost/regex.hpp"
|
||||
@ -95,14 +95,19 @@ docstring familyName(docstring const & name)
|
||||
return rtrim(fname);
|
||||
}
|
||||
|
||||
|
||||
docstring const BibTeXInfo::getAbbreviatedAuthor() const
|
||||
{
|
||||
if (!is_bibtex_)
|
||||
return docstring();
|
||||
|
||||
if (!is_bibtex_) {
|
||||
docstring const opt = trim(getValueForField("label"));
|
||||
if (opt.empty())
|
||||
return docstring();
|
||||
|
||||
docstring authors;
|
||||
split(opt, authors, '(');
|
||||
return authors;
|
||||
}
|
||||
|
||||
docstring author = getValueForField("author");
|
||||
|
||||
if (author.empty()) {
|
||||
author = getValueForField("editor");
|
||||
if (author.empty())
|
||||
@ -113,7 +118,7 @@ docstring const BibTeXInfo::getAbbreviatedAuthor() const
|
||||
// Try to split the author list on " and "
|
||||
vector<docstring> const authors =
|
||||
getVectorFromString(author, from_ascii(" and "));
|
||||
|
||||
|
||||
if (authors.size() == 2)
|
||||
return bformat(_("%1$s and %2$s"),
|
||||
familyName(authors[0]), familyName(authors[1]));
|
||||
@ -127,9 +132,18 @@ docstring const BibTeXInfo::getAbbreviatedAuthor() const
|
||||
|
||||
docstring const BibTeXInfo::getYear() const
|
||||
{
|
||||
if (!is_bibtex_)
|
||||
return docstring();
|
||||
|
||||
if (!is_bibtex_) {
|
||||
docstring const opt = trim(getValueForField("label"));
|
||||
if (opt.empty())
|
||||
return docstring();
|
||||
|
||||
docstring authors;
|
||||
docstring const tmp = split(opt, authors, '(');
|
||||
docstring year;
|
||||
split(tmp, year, ')');
|
||||
return year;
|
||||
}
|
||||
|
||||
docstring year = getValueForField("year");
|
||||
if (year.empty())
|
||||
year = _("No year");
|
||||
|
@ -96,11 +96,9 @@ private:
|
||||
|
||||
/// Class to represent a collection of bibliographical data, whether
|
||||
/// from BibTeX or from bibliography environments.
|
||||
/// BiblioInfo.first is the bibliography key
|
||||
/// BiblioInfo.second is the data for that key
|
||||
class BiblioInfo {
|
||||
public:
|
||||
///
|
||||
/// bibliography key --> data for that key
|
||||
typedef std::map<docstring, BibTeXInfo>::const_iterator const_iterator;
|
||||
/// Returns a sorted vector of bibliography keys
|
||||
std::vector<docstring> const getKeys() const;
|
||||
|
Loading…
Reference in New Issue
Block a user