]> git.lyx.org Git - features.git/commitdiff
Get XHTML output for InsetRef working, again in a fairly primitive way. We just
authorRichard Heck <rgheck@comcast.net>
Sat, 14 Nov 2009 14:12:37 +0000 (14:12 +0000)
committerRichard Heck <rgheck@comcast.net>
Sat, 14 Nov 2009 14:12:37 +0000 (14:12 +0000)
use the label name as associated text, and put it into square brackets. It'd be
nice to be able to do more, but for that we'd need to associate counters with
the labels, which would be nice for display, too. But we don't have that yet.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31976 a592a061-630c-0410-9148-cb99ea01b6c8

src/insets/InsetRef.cpp
src/insets/InsetRef.h

index e24bd4f0127c3f32f3a4d4fe12f60be7c69845bf..179ce9d9906ac0a2eb96812b01f0bf65d701c9f6 100644 (file)
@@ -18,6 +18,7 @@
 #include "LaTeXFeatures.h"
 #include "LyXFunc.h"
 #include "OutputParams.h"
+#include "output_xhtml.h"
 #include "ParIterator.h"
 #include "sgml.h"
 #include "TocBackend.h"
@@ -115,6 +116,16 @@ int InsetRef::docbook(odocstream & os, OutputParams const & runparams) const
 }
 
 
+docstring InsetRef::xhtml(odocstream & os, OutputParams const &) const
+{
+       // FIXME What we'd really like to do is to be able to output some
+       // appropriate sort of text here. But to do that, we need to associate
+       // some sort of counter with the label, and we don't have that yet.
+       docstring const ref = html::htmlize(getParam("reference"));
+       os << "<a href=\"" << ref << "\">[" << ref << "]</a>";
+       return docstring();
+}
+
 void InsetRef::tocString(odocstream & os) const
 {
        plaintext(os, OutputParams(0));
index 1271ad1fd0f0528d6b2df06f23232258625d7c7c..ae88ccdcf293a9b4fa7906df75890955abe06f6f 100644 (file)
@@ -54,6 +54,8 @@ public:
        int plaintext(odocstream &, OutputParams const &) const;
        ///
        int docbook(odocstream &, OutputParams const &) const;
+       ///
+       docstring xhtml(odocstream &, OutputParams const &) const;
        /// the string that is passed to the TOC
        void tocString(odocstream &) const;
        ///
@@ -61,7 +63,7 @@ public:
        ///
        static ParamInfo const & findInfo(std::string const &);
        ///
-       static std::string defaultCommand() { return "ref"; };
+       static std::string defaultCommand() { return "ref"; }
        ///
        static bool isCompatibleCommand(std::string const & s);
        ///