]> git.lyx.org Git - features.git/commitdiff
Make bibtex works with embedded bib file
authorBo Peng <bpeng@lyx.org>
Fri, 11 Jan 2008 03:57:22 +0000 (03:57 +0000)
committerBo Peng <bpeng@lyx.org>
Fri, 11 Jan 2008 03:57:22 +0000 (03:57 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22487 a592a061-630c-0410-9148-cb99ea01b6c8

src/insets/InsetBibtex.cpp

index d337641f2515cab9b80836f2850cb69e80602d3f..9996cd23f0089e36b0c1376c986dca4a30615816 100644 (file)
@@ -192,22 +192,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<char_type> Separator;
-       typedef boost::tokenizer<Separator, docstring::const_iterator, docstring> 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 +226,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));