- ifstream ifs(f.c_str());
- string token;
- bool using_bibtex = false;
- LRegex reg1("\\\\bibdata{([^}]+)}");
- LRegex reg2("\\\\bibstyle{([^}]+)}");
- while (getline(ifs, token)) {
- if (reg1.exact_match(token)) {
- using_bibtex = true;
- LRegex::SubMatches const & sub = reg1.exec(token);
- string data = LSubstring(token, sub[1].first,
- sub[1].second);
- // data is now all the bib files separated by ','
- // get them one by one and pass them to the helper
- string::size_type b;
- do {
- b = data.find_first_of(',', 0);
- string l;
- if (b == string::npos)
- l = data;
- else {
- l = data.substr(0, b - 0);
- data.erase(0, b + 1);
- }
- string full_l =
- findtexfile(
- ChangeExtension(l, "bib", false),
- "bib");
- lyxerr[Debug::LATEX] << "Bibtex database: `"
- << full_l << "'" << endl;
- if (!full_l.empty()) {
- // add full_l to the dep file.
- dep.insert(full_l, true);
- }
- } while (b != string::npos);
- } else if (reg2.exact_match(token)) {
- using_bibtex = true;
- LRegex::SubMatches const & sub = reg2.exec(token);
- string style = LSubstring(token, sub[1].first,
- sub[1].second);
- // token is now the style file
- // pass it to the helper
- string full_l =
- findtexfile(
- ChangeExtension(style, "bst", false),
- "bst");
- lyxerr[Debug::LATEX] << "Bibtex style: `"
- << full_l << "'" << endl;
- if (!full_l.empty()) {
- // add full_l to the dep file.
- dep.insert(full_l, true);
- }
+ //string aux = OnlyFilename(ChangeExtension(file, ".aux"));
+
+ for (vector<Aux_Info>::const_iterator it = bibtex_info.begin();
+ it != bibtex_info.end(); ++it) {
+ for (set<string>::const_iterator it2 = it->databases.begin();
+ it2 != it->databases.end(); ++it2) {
+ string file = findtexfile(*it2, "bib");
+ if (!file.empty())
+ dep.insert(file, true);
+ }
+
+ for (set<string>::const_iterator it2 = it->styles.begin();
+ it2 != it->styles.end(); ++it2) {
+ string file = findtexfile(*it2, "bst");
+ if (!file.empty())
+ dep.insert(file, true);