]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetRef.cpp
How about if we write a script to do some of this and stop doing it
[lyx.git] / src / insets / InsetRef.cpp
index 20e98dc3d488b4f7fd52021c8b25d27dca2ef6ec..7e0eb6db33f8dc78092998e30294916cd70ab800 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"
@@ -33,7 +34,7 @@ namespace lyx {
 
 
 InsetRef::InsetRef(Buffer * buf, InsetCommandParams const & p)
-       : InsetCommand(p, "ref"), isLatex(buf->isLatex())
+       : InsetCommand(buf, p, "ref"), isLatex(buf->isLatex())
 {}
 
 
@@ -115,13 +116,27 @@ int InsetRef::docbook(odocstream & os, OutputParams const & runparams) const
 }
 
 
+docstring InsetRef::xhtml(XHTMLStream & xs, 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::cleanAttr(getParam("reference"));
+       string const attr = "href=\"#" + to_utf8(ref) + "\"";
+       xs << StartTag("a", attr);
+       xs << ref;
+       xs << EndTag("a");
+       return docstring();
+}
+
+
 void InsetRef::tocString(odocstream & os) const
 {
        plaintext(os, OutputParams(0));
 }
 
 
-void InsetRef::updateLabels(ParIterator const & it)
+void InsetRef::updateLabels(ParIterator const & it, bool)
 {
        docstring const & label = getParam("reference");
        // register this inset into the buffer reference cache.
@@ -133,7 +148,7 @@ void InsetRef::updateLabels(ParIterator const & it)
                        break;
                }
        }
-       screen_label_ += getParam("reference");
+       screen_label_ += label;
 
        if (!isLatex && !getParam("name").empty()) {
                screen_label_ += "||";