Some master/child biblio fixes.

This commit is contained in:
Juergen Spitzmueller 2017-01-14 14:44:18 +01:00
parent b3cc07e3a6
commit ed7d3a33ab
2 changed files with 21 additions and 20 deletions

View File

@ -172,7 +172,7 @@ void InsetBibtex::editDatabases() const
bool InsetBibtex::usingBiblatex() const
{
return buffer().masterBuffer()->params().useBiblatex();
return buffer().masterParams().useBiblatex();
}
@ -279,9 +279,9 @@ void InsetBibtex::latex(otexstream & os, OutputParams const & runparams) const
buffer().prepareBibFilePaths(runparams, getBibFiles(), false);
// Style options
if (style == "default")
style = buffer().params().defaultBiblioStyle();
if (!style.empty() && !buffer().params().use_bibtopic) {
string base = buffer().prepareFileNameForLaTeX(style, ".bst", runparams.nice);
style = buffer().masterParams().defaultBiblioStyle();
if (!style.empty() && !buffer().masterParams().use_bibtopic) {
string base = buffer().masterBuffer()->prepareFileNameForLaTeX(style, ".bst", runparams.nice);
FileName const try_in_file =
makeAbsPath(base + ".bst", buffer().filePath());
bool const not_from_texmf = try_in_file.isReadableFile();
@ -316,7 +316,7 @@ void InsetBibtex::latex(otexstream & os, OutputParams const & runparams) const
"BibTeX will be unable to find it."));
}
// Handle the bibtopic case
if (!db_out.empty() && buffer().params().use_bibtopic) {
if (!db_out.empty() && buffer().masterParams().use_bibtopic) {
os << "\\begin{btSect}";
if (!style.empty())
os << "[" << style << "]";
@ -329,17 +329,17 @@ void InsetBibtex::latex(otexstream & os, OutputParams const & runparams) const
<< "\\end{btSect}\n";
}
// bibtotoc option
if (!bibtotoc.empty() && !buffer().params().use_bibtopic) {
if (!bibtotoc.empty() && !buffer().masterParams().use_bibtopic) {
// set label for hyperref, see http://www.lyx.org/trac/ticket/6470
if (buffer().params().pdfoptions().use_hyperref)
if (buffer().masterParams().pdfoptions().use_hyperref)
os << "\\phantomsection";
if (buffer().params().documentClass().hasLaTeXLayout("chapter"))
if (buffer().masterParams().documentClass().hasLaTeXLayout("chapter"))
os << "\\addcontentsline{toc}{chapter}{\\bibname}";
else if (buffer().params().documentClass().hasLaTeXLayout("section"))
else if (buffer().masterParams().documentClass().hasLaTeXLayout("section"))
os << "\\addcontentsline{toc}{section}{\\refname}";
}
// The bibliography command
if (!db_out.empty() && !buffer().params().use_bibtopic) {
if (!db_out.empty() && !buffer().masterParams().use_bibtopic) {
docstring btprint = getParam("btprint");
if (btprint == "btPrintAll") {
os << "\\nocite{*}\n";
@ -651,7 +651,7 @@ void InsetBibtex::parseBibTeXFiles() const
support::FileNamePairList::const_iterator en = files.end();
for (; it != en; ++ it) {
ifdocstream ifs(it->second.toFilesystemEncoding().c_str(),
ios_base::in, buffer().params().encoding().iconvName());
ios_base::in, buffer().masterParams().encoding().iconvName());
char_type ch;
VarMap strings;
@ -862,7 +862,7 @@ bool InsetBibtex::delDatabase(docstring const & db)
void InsetBibtex::validate(LaTeXFeatures & features) const
{
if (features.bufferParams().use_bibtopic)
if (features.buffer().masterParams().use_bibtopic)
features.require("bibtopic");
// FIXME XHTML
// It'd be better to be able to get this from an InsetLayout, but at present

View File

@ -123,7 +123,7 @@ void InsetCitation::doDispatch(Cursor & cur, FuncRequest & cmd)
if (cmd.getArg(0) == "toggleparam") {
string cmdname = getCmdName();
string const alias =
buffer().params().getCiteAlias(cmdname);
buffer().masterParams().getCiteAlias(cmdname);
if (!alias.empty())
cmdname = alias;
string const par = cmd.getArg(1);
@ -157,7 +157,7 @@ bool InsetCitation::getStatus(Cursor & cur, FuncRequest const & cmd,
if (cmd.getArg(0) == "changetype") {
string cmdname = getCmdName();
string const alias =
buffer().params().getCiteAlias(cmdname);
buffer().masterParams().getCiteAlias(cmdname);
if (!alias.empty())
cmdname = alias;
if (suffixIs(cmdname, "*"))
@ -169,12 +169,12 @@ bool InsetCitation::getStatus(Cursor & cur, FuncRequest const & cmd,
if (cmd.getArg(0) == "toggleparam") {
string cmdname = getCmdName();
string const alias =
buffer().params().getCiteAlias(cmdname);
buffer().masterParams().getCiteAlias(cmdname);
if (!alias.empty())
cmdname = alias;
vector<CitationStyle> citation_styles =
buffer().params().citeStyles();
CitationStyle cs = getCitationStyle(buffer().params(),
buffer().masterParams().citeStyles();
CitationStyle cs = getCitationStyle(buffer().masterParams(),
cmdname, citation_styles);
if (cmd.getArg(1) == "star") {
status.setEnabled(cs.hasStarredVersion);
@ -349,7 +349,7 @@ docstring InsetCitation::complexLabel(bool for_xhtml) const
cite_type = cite_type.substr(0, cite_type.size() - 1);
// handle alias
string const alias = buf.params().getCiteAlias(cite_type);
string const alias = buf.masterParams().getCiteAlias(cite_type);
if (!alias.empty())
cite_type = alias;
@ -518,8 +518,9 @@ void InsetCitation::latex(otexstream & os, OutputParams const & runparams) const
os << cleanupWhitespace(getParam("key"));
return;
}
vector<CitationStyle> citation_styles = buffer().params().citeStyles();
CitationStyle cs = asValidLatexCommand(buffer().params(), getCmdName(), citation_styles);
vector<CitationStyle> citation_styles = buffer().masterParams().citeStyles();
CitationStyle cs = asValidLatexCommand(buffer().masterParams(),
getCmdName(), citation_styles);
// FIXME UNICODE
docstring const cite_str = from_utf8(citationStyleToString(cs, true));