From 26006c8ffca453dafc4aff95381f42b9f91e4d8a Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Mon, 30 Nov 2009 22:59:18 +0000 Subject: [PATCH] Restore XHTML output for InsetCitation. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32262 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/insets/InsetCitation.cpp | 24 +++++++++++++----------- src/insets/InsetCitation.h | 2 +- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/insets/InsetCitation.cpp b/src/insets/InsetCitation.cpp index 5cc3768ef9..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" @@ -504,24 +505,24 @@ int InsetCitation::docbook(odocstream & os, OutputParams const &) const } -docstring 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()) + 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,18 +530,19 @@ docstring 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"; + xs << ", " << after; + xs << "]"; return docstring(); } diff --git a/src/insets/InsetCitation.h b/src/insets/InsetCitation.h index 1ead91b5d0..e85c3b7d0f 100644 --- a/src/insets/InsetCitation.h +++ b/src/insets/InsetCitation.h @@ -50,7 +50,7 @@ public: /// int docbook(odocstream &, OutputParams const &) const; /// - docstring xhtml(odocstream &, OutputParams const &) const; + docstring xhtml(XHTMLStream &, OutputParams const &) const; /// the string that is passed to the TOC void tocString(odocstream &) const; /// -- 2.39.5