X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2FInsetBibtex.cpp;h=40632057697579d6e06e7c325f73846043fbc884;hb=2c357c1d23b7b83839a9beb8225d4f1ae4f793b4;hp=d337641f2515cab9b80836f2850cb69e80602d3f;hpb=f52b73747f32ac5ca563bbabc148ced2e6157517;p=lyx.git diff --git a/src/insets/InsetBibtex.cpp b/src/insets/InsetBibtex.cpp index d337641f25..4063205769 100644 --- a/src/insets/InsetBibtex.cpp +++ b/src/insets/InsetBibtex.cpp @@ -16,11 +16,9 @@ #include "Buffer.h" #include "BufferParams.h" #include "DispatchResult.h" -#include "support/debug.h" #include "EmbeddedFiles.h" #include "Encoding.h" #include "FuncRequest.h" -#include "support/gettext.h" #include "LaTeXFeatures.h" #include "MetricsInfo.h" #include "OutputParams.h" @@ -28,15 +26,18 @@ #include "frontends/alert.h" +#include "support/debug.h" #include "support/ExceptionMessage.h" #include "support/docstream.h" #include "support/filetools.h" +#include "support/gettext.h" #include "support/lstrings.h" #include "support/os.h" #include "support/Path.h" #include "support/textutils.h" #include +#include using namespace std; using namespace lyx::support; @@ -104,8 +105,6 @@ void InsetBibtex::doDispatch(Cursor & cur, FuncRequest & cmd) embedStatus = split(embedStatus, emb, ','); while (!tmp.empty()) { EmbeddedFile file(changeExtension(tmp, "bib"), cur.buffer().filePath()); - if (!file.exists()) - continue; if (!newBibfiles.empty()) newBibfiles += ","; newBibfiles += tmp; @@ -192,22 +191,12 @@ int InsetBibtex::latex(Buffer const & buffer, odocstream & os, // use such filenames.) // Otherwise, store the (maybe absolute) path to the original, // unmangled database name. - typedef boost::char_separator Separator; - typedef boost::tokenizer Tokenizer; - - Separator const separator(from_ascii(",").c_str()); - // The tokenizer must not be called with temporary strings, since - // it does not make a copy and uses iterators of the string further - // down. getParam returns a reference, so this is OK. - Tokenizer const tokens(getParam("bibfiles"), separator); - Tokenizer::const_iterator const begin = tokens.begin(); - Tokenizer::const_iterator const end = tokens.end(); - + EmbeddedFileList const bibs = getFiles(buffer); + EmbeddedFileList::const_iterator it = bibs.begin(); + EmbeddedFileList::const_iterator it_end = bibs.end(); odocstringstream dbs; - for (Tokenizer::const_iterator it = begin; it != end; ++it) { - docstring const input = trim(*it); - // FIXME UNICODE - string utf8input = to_utf8(input); + for (; it != it_end; ++it) { + string utf8input = removeExtension(it->availableFile().absFilename()); string database = normalizeName(buffer, runparams, utf8input, ".bib"); FileName const try_in_file(makeAbsPath(database + ".bib", buffer.filePath())); @@ -236,7 +225,7 @@ int InsetBibtex::latex(Buffer const & buffer, odocstream & os, from_utf8(database)); } - if (it != begin) + if (it != bibs.begin()) dbs << ','; // FIXME UNICODE dbs << from_utf8(latex_path(database)); @@ -751,8 +740,7 @@ void InsetBibtex::fillWithBibKeys(Buffer const & buffer, docstring value; docstring commaNewline; docstring data; - BibTeXInfo keyvalmap; - keyvalmap.entryType = entryType; + BibTeXInfo keyvalmap(key, entryType); bool readNext = removeWSAndComma(ifs); @@ -778,15 +766,13 @@ void InsetBibtex::fillWithBibKeys(Buffer const & buffer, keyvalmap[name] = value; data += "\n\n" + value; - keylist.fieldNames.insert(name); + keylist.addFieldName(name); readNext = removeWSAndComma(ifs); } // add the new entry - keylist.entryTypes.insert(entryType); - keyvalmap.allData = data; - keyvalmap.isBibTeX = true; - keyvalmap.bibKey = key; + keylist.addEntryType(entryType); + keyvalmap.setAllData(data); keylist[key] = keyvalmap; } } //< searching '@'