]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetRef.cpp
DocBook: support bookauthor in bibliographies.
[lyx.git] / src / insets / InsetRef.cpp
index fcd28d234659c430a9c54676cf0d0dd420505d51..c8bc837a5f4d50b0ec74dd843fe87d12426aed16 100644 (file)
@@ -432,7 +432,7 @@ docstring InsetRef::xhtml(XMLStream & xs, OutputParams const & op) const
        // some sort of counter with the label, and we don't have that yet.
        docstring const attr = "href=\"#" + xml::cleanAttr(ref) + '"';
        xs << xml::StartTag("a", to_utf8(attr));
-       xs << displayString(ref, cmd, op.local_font->language()->lang());;
+       xs << displayString(ref, cmd, getLocalOrDefaultLang(op)->lang());
        xs << xml::EndTag("a");
        return docstring();
 }
@@ -537,11 +537,10 @@ void InsetRef::updateBuffer(ParIterator const & it, UpdateType, bool const /*del
        } else
                tooltip_ = from_ascii("");
 
-       if (use_formatted_ref && cmd != "pageref" && cmd != "vpageref"
-                       && cmd != "vref" && cmd != "labelonly")
-               screen_label_ = displayString(ref, cmd);
-       else
-               screen_label_ = label;
+       screen_label_ = label;
+       // If use_formatted_ref is active, this will be overwritten in addToToc.
+       // (We can't do it now because it might be a forward-reference
+       // and so the reference might not be in the label cache yet.
        broken_ = false;
        setBroken(broken_);
 }
@@ -565,10 +564,18 @@ void InsetRef::addToToc(DocIterator const & cpit, bool output_active,
                        shared_ptr<Toc> toc2 = backend.toc("brokenrefs");
                        toc2->push_back(TocItem(cpit, 0, screenLabel(), output_active));
                }
-               // This InsetRef has already been taken care of in InsetLabel::addToToc().
+
+               // Code for display of formatted references
+               bool const use_formatted_ref = buffer().params().use_formatted_ref;
+               if (use_formatted_ref) {
+                       string const & cmd = getCmdName();
+                       docstring const & ref = getParam("reference");
+                       if (cmd != "pageref" && cmd != "vpageref" && cmd != "vref" &&
+                                       cmd != "labelonly")
+                               screen_label_ = displayString(ref, cmd);
+               }
                return;
        }
-
        // It seems that this reference does not point to any valid label.
        broken_ = true;
        setBroken(broken_);