X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2FInsetCitation.cpp;h=93e79263f6f64f331457a3aee8a2b1611424a5e2;hb=26006c8ffca453dafc4aff95381f42b9f91e4d8a;hp=25038a7e61db07748352816bc1e607d18b79393f;hpb=3de92f551a4e7af6081478e20e04052268771364;p=lyx.git diff --git a/src/insets/InsetCitation.cpp b/src/insets/InsetCitation.cpp index 25038a7e61..93e79263f6 100644 --- a/src/insets/InsetCitation.cpp +++ b/src/insets/InsetCitation.cpp @@ -20,6 +20,7 @@ #include "DispatchResult.h" #include "FuncRequest.h" #include "LaTeXFeatures.h" +#include "output_xhtml.h" #include "ParIterator.h" #include "TocBackend.h" @@ -355,8 +356,8 @@ docstring basicLabel(docstring const & keyList, docstring const & after) ParamInfo InsetCitation::param_info_; -InsetCitation::InsetCitation(InsetCommandParams const & p) - : InsetCommand(p, "citation") +InsetCitation::InsetCitation(Buffer * buf, InsetCommandParams const & p) + : InsetCommand(buf, p, "citation") {} @@ -466,7 +467,7 @@ void InsetCitation::updateLabels(ParIterator const &) 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"))); } @@ -504,24 +505,24 @@ int InsetCitation::docbook(odocstream & os, OutputParams const &) const } -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 // 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 keys = getVectorFromString(keyList); + vector const keys = getVectorFromString(key_list); vector::const_iterator it = keys.begin(); - vector::const_iterator en = keys.end(); + vector::const_iterator const en = keys.end(); bool first = true; for (; it != en; ++it) { BiblioInfo::const_iterator const bt = bi.find(*it); @@ -529,19 +530,20 @@ int InsetCitation::xhtml(odocstream & os, OutputParams const &) const 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 << "" << target << ""; + 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(); }