Author: vfr
Date: Sat Mar 19 11:37:24 2011
New Revision: 37960
URL: http://www.lyx.org/trac/changeset/37960

Log:
Simplify logic in InsetRef::latex().

Modified:
   lyx-devel/trunk/src/insets/InsetRef.cpp

Modified: lyx-devel/trunk/src/insets/InsetRef.cpp
==============================================================================
--- lyx-devel/trunk/src/insets/InsetRef.cpp     Sat Mar 19 11:34:59 2011        
(r37959)
+++ lyx-devel/trunk/src/insets/InsetRef.cpp     Sat Mar 19 11:37:24 2011        
(r37960)
@@ -140,34 +140,25 @@
 void InsetRef::latex(otexstream & os, OutputParams const & rp) const
 {
        string const cmd = getCmdName();
+       docstring const data = getEscapedLabel(rp);
 
-       // refstyle defines its own version of \eqref
-       if (cmd != "formatted" &&
-           !(cmd == "eqref" && buffer().params().use_refstyle)
-          ) {
+       if (cmd == "eqref" && buffer().params().use_refstyle) {
+               os << '(' << from_ascii("\\ref{") << data << from_ascii("})");
+       } 
+       else if (cmd == "formatted") {
+               docstring label;
+               docstring prefix;
+               docstring const fcmd = getFormattedCmd(data, label, prefix);
+               os << fcmd << '{' << label << '}';
+       }
+       else {
                // We don't want to output p_["name"], since that is only used 
                // in docbook. So we construct new params, without it, and use 
that.
                InsetCommandParams p(REF_CODE, cmd);
                docstring const ref = getParam("reference");
                p["reference"] = ref;
                os << p.getCommand(rp);
-               return;
-       }
-
-       // so we're doing a formatted reference of some kind.
-       docstring const data = getEscapedLabel(rp);
-
-       // what we say in the UI is that an "eqref" is supposed to surround the
-       // reference with parentheses, so let's do that.
-       if (cmd == "eqref" /* && buffer().params().use_refstyle */) {
-               os << '(' << from_ascii("\\ref{") << data << from_ascii("})");
-               return;
        }
-
-       docstring label;
-       docstring prefix;
-       docstring const fcmd = getFormattedCmd(data, label, prefix);
-       os << fcmd << '{' << label << '}';
 }
 
 

Reply via email to