]> git.lyx.org Git - lyx.git/blobdiff - src/tex2lyx/text.cpp
tex2lyx: refsection and bibbysection support (biblatex)
[lyx.git] / src / tex2lyx / text.cpp
index 8b8dc6180fe966b337a00294e73b0133f77ed602..559aa735b560c18e7fc8a1d0c7b7ce8eb9d75a86 100644 (file)
@@ -4671,6 +4671,35 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
                        need_commentbib = false;
                }
 
+               else if (t.cs() == "bibbysection") {
+                       context.check_layout(os);
+                       string BibOpts;
+                       string bbloptions = p.hasOpt() ? p.getArg('[', ']') : string();
+                       vector<string> opts = getVectorFromString(bbloptions);
+                       vector<string>::iterator it =
+                               find(opts.begin(), opts.end(), "heading=bibintoc");
+                       if (it != opts.end()) {
+                               opts.erase(it);
+                               BibOpts = "bibtotoc";
+                       }
+                       bbloptions = getStringFromVector(opts);
+                       begin_command_inset(os, "bibtex", "bibtex");
+                       os << "btprint " << '"' << "bibbysection" << '"' << "\n";
+                       string bibfiles;
+                       for (auto const & bf : preamble.biblatex_bibliographies) {
+                               if (!bibfiles.empty())
+                                       bibfiles += ",";
+                               bibfiles += normalize_filename(bf);
+                       }
+                       if (!bibfiles.empty())
+                               os << "bibfiles " << '"' << bibfiles << '"' << "\n";
+                       os << "options " << '"' << BibOpts << '"' << "\n";
+                       if (!bbloptions.empty())
+                               os << "biblatexopts " << '"' << bbloptions << '"' << "\n";
+                       end_inset(os);
+                       need_commentbib = false;
+               }
+
                else if (t.cs() == "parbox") {
                        // Test whether this is an outer box of a shaded box
                        p.pushPosition();