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);
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, "*"))
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);
docstring tip;
tip += "<ol>";
+ int count = 0;
for (docstring const & key : keys) {
docstring const key_info = bi.getInfo(key, buffer(), ci);
+ // limit to reasonable size.
+ if (count > 9 && keys.size() > 11) {
+ tip.push_back(0x2026);// HORIZONTAL ELLIPSIS
+ tip += "<p>"
+ + bformat(_("+ %1$d more entries."), int(keys.size() - count))
+ + "</p>";
+ break;
+ }
if (key_info.empty())
continue;
tip += "<li>" + key_info + "</li>";
+ ++count;
}
tip += "</ol>";
return tip;
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;
void InsetCitation::addToToc(DocIterator const & cpit, bool output_active,
- UpdateType) const
+ UpdateType, TocBackend & backend) const
{
// NOTE
// BiblioInfo::collectCitedEntries() uses the TOC to collect the citations
// by both XHTML and plaintext output. So, if we change what goes into the TOC,
// then we will also need to change that routine.
docstring const tocitem = getParam("key");
- shared_ptr<Toc> toc = buffer().tocBackend().toc("citation");
- toc->push_back(TocItem(cpit, 0, tocitem, output_active));
+ TocBuilder & b = backend.builder("citation");
+ b.pushItem(cpit, tocitem, output_active);
+ b.pop();
}
// engine, e.g. \cite[]{} for the basic engine.
void InsetCitation::latex(otexstream & os, OutputParams const & runparams) const
{
- vector<CitationStyle> citation_styles = buffer().params().citeStyles();
- CitationStyle cs = asValidLatexCommand(buffer().params(), getCmdName(), citation_styles);
BiblioInfo const & bi = buffer().masterBibInfo();
+ if (getCmdName() == "keyonly") {
+ // Special command to only return the key
+ if (!bi.isBibtex(getParam("key")))
+ // escape chars with bibitems
+ os << escape(cleanupWhitespace(getParam("key")));
+ else
+ os << cleanupWhitespace(getParam("key"));
+ return;
+ }
+ 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));