#include "DispatchResult.h"
#include "FuncRequest.h"
#include "LaTeXFeatures.h"
+#include "output_xhtml.h"
#include "ParIterator.h"
#include "TocBackend.h"
// We don't currently use the full or forceUCase fields.
string cite_type = asValidLatexCommand(citeType, engine);
if (cite_type[0] == 'C')
- //If we were going to use them, this would mean ForceUCase
+ // If we were going to use them, this would mean ForceUCase
cite_type = string(1, 'c') + cite_type.substr(1);
if (cite_type[cite_type.size() - 1] == '*')
- //and this would mean FULL
+ // and this would mean FULL
cite_type = cite_type.substr(0, cite_type.size() - 1);
docstring before_str;
ParamInfo InsetCitation::param_info_;
-InsetCitation::InsetCitation(InsetCommandParams const & p)
- : InsetCommand(p, "citation")
+InsetCitation::InsetCitation(Buffer * buf, InsetCommandParams const & p)
+ : InsetCommand(buf, p, "citation")
{}
}
-void InsetCitation::updateLabels(ParIterator const &)
+void InsetCitation::updateLabels(ParIterator const &, bool)
{
CiteEngine const engine = buffer().params().citeEngine();
if (cache.params == params() && cache.engine == engine)
void InsetCitation::addToToc(DocIterator const & cpit)
{
Toc & toc = buffer().tocBackend().toc("citation");
- toc.push_back(TocItem(cpit, 0, cache.screen_label));
+ toc.push_back(TocItem(cpit, 0, getParam("key")));
}
}
-int InsetCitation::xhtml(odocstream & os, OutputParams const &) const
+docstring InsetCitation::xhtml(XHTMLStream & xs, OutputParams const &) const
{
BiblioInfo const & bi = buffer().masterBibInfo();
- docstring const & keyList = getParam("key");
- if (keyList.empty())
- return 0;
+ docstring const & key_list = getParam("key");
+ if (key_list.empty())
+ return docstring();
- // FIXME We shuld do a better job outputing different things for the
+ // FIXME We should do a better job outputing different things for the
// different citation styles. For now, we use square brackets for every
// case.
- os << '[';
+ xs << "[";
docstring const & before = getParam("before");
if (!before.empty())
- os << before << " ";
+ xs << before << " ";
- vector<docstring> keys = getVectorFromString(keyList);
+ vector<docstring> const keys = getVectorFromString(key_list);
vector<docstring>::const_iterator it = keys.begin();
- vector<docstring>::const_iterator en = keys.end();
+ vector<docstring>::const_iterator const en = keys.end();
bool first = true;
for (; it != en; ++it) {
BiblioInfo::const_iterator const bt = bi.find(*it);
continue;
BibTeXInfo const & bibinfo = bt->second;
if (!first) {
- os << ", ";
+ xs << ", ";
first = false;
}
docstring const & label = bibinfo.label();
docstring const & target = label.empty() ? *it : label;
- os << "<a href='#" << *it << "'>" << target << "</a>";
+ string const attr = "href='#" + to_utf8(*it) + "'";
+ xs << StartTag("a", attr) << target << EndTag("a");
}
docstring const & after = getParam("after");
if (!after.empty())
- os << ", " << after;
- os << "]\n";
- return 0;
+ xs << ", " << after;
+ xs << "]";
+ return docstring();
}