+docstring InsetCitation::xhtml(XHTMLStream & xs, OutputParams const &) const
+{
+ BiblioInfo const & bi = buffer().masterBibInfo();
+ docstring const & key_list = getParam("key");
+ if (key_list.empty())
+ return docstring();
+
+ // FIXME We shuld do a better job outputing different things for the
+ // different citation styles. For now, we use square brackets for every
+ // case.
+ xs << "[";
+ docstring const & before = getParam("before");
+ if (!before.empty())
+ xs << before << " ";
+
+ vector<docstring> const keys = getVectorFromString(key_list);
+ vector<docstring>::const_iterator it = keys.begin();
+ vector<docstring>::const_iterator const en = keys.end();
+ bool first = true;
+ for (; it != en; ++it) {
+ BiblioInfo::const_iterator const bt = bi.find(*it);
+ if (bt == bi.end())
+ continue;
+ BibTeXInfo const & bibinfo = bt->second;
+ if (!first) {
+ xs << ", ";
+ first = false;
+ }
+ docstring const & label = bibinfo.label();
+ docstring const & target = label.empty() ? *it : label;
+ string const attr = "href='#" + to_utf8(*it) + "'";
+ xs << StartTag("a", attr) << target << EndTag("a");
+ }
+
+ docstring const & after = getParam("after");
+ if (!after.empty())
+ xs << ", " << after;
+ xs << "]";
+ return docstring();
+}
+
+