]> git.lyx.org Git - features.git/commitdiff
Remove Nameref support. Too many issues involving translation, quotes,
authorRichard Heck <rgheck@comcast.net>
Fri, 16 Jul 2010 15:19:04 +0000 (15:19 +0000)
committerRichard Heck <rgheck@comcast.net>
Fri, 16 Jul 2010 15:19:04 +0000 (15:19 +0000)
etc.

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

development/FORMAT
lib/lyx2lyx/lyx_2_0.py
lib/ui/stdcontext.inc
src/Buffer.cpp
src/insets/InsetRef.cpp

index 7040ca4b74e5337e86383658830096c15ad60aa6..60583231d9b75d4fe9c9d0a1b42a9163214f1405 100644 (file)
@@ -7,6 +7,10 @@ The good example would be 2010-01-10 entry.
 
 -----------------------
 
+2010-07-16 Richard Heck <rgheck@comcast.net>
+       * Format incremented to 397 (r34884)
+         Remove Nameref support
+
 2010-07-13 Richard Heck <rgheck@comcast.net>
        * Format incremented to 396 (r34884)
          nameref support
index a375de916c45acc09e24e780f826a9bc53119ef5..283da64c3873eaa0906387783faa5c4a7fa91504 100644 (file)
@@ -2001,6 +2001,35 @@ def revert_nameref(document):
     add_to_preamble(document, "\usepackage{nameref}")
 
 
+def remove_Nameref(document):
+  " Convert Nameref commands to nameref commands "
+  i = 0
+  while 1:
+    # It seems better to look for this, as most of the reference
+    # insets won't be ones we care about.
+    i = find_token(document.body, "LatexCommand Nameref" , i)
+    if i == -1:
+      break
+    cmdloc = i
+    i += 1
+    
+    # Make sure it is actually in an inset!
+    # We could just check document.lines[i-1], but that relies
+    # upon something that might easily change.
+    # We'll look back a few lines.
+    stins = cmdloc - 10
+    if stins < 0:
+      stins = 0
+    stins = find_token(document.body, "\\begin_inset CommandInset ref", stins)
+    if stins == -1 or stins > cmdloc:
+      continue
+    endins = find_end_of_inset(document.body, stins)
+    if endins == -1:
+      document.warning("Can't find end of inset at line " + stins + "!!")
+      continue
+    if endins < cmdloc:
+      continue
+    document.body[cmdloc] = "LatexCommand nameref"
 
 
 ##
@@ -2058,10 +2087,12 @@ convert = [[346, []],
            [393, [convert_optarg]],
            [394, []],
            [395, []],
-           [396, []]
+           [396, []],
+           [397, [remove_Nameref]]
           ]
 
-revert =  [[395, [revert_nameref]],
+revert =  [[396, []],
+           [395, [revert_nameref]],
            [394, [revert_DIN_C_pagesizes]],
            [393, [revert_makebox]],
            [392, [revert_argument]],
index 1e0bbb1131eccdd3f328e2b2b70a825877754f84..159dcea20b998c4a4155c8829d68ebbb3eca785e 100644 (file)
@@ -92,7 +92,6 @@ Menuset
                Item "<Reference> on Page <Page>|f" "inset-modify changetype vref"
                Item "Formatted Reference|t" "inset-modify changetype prettyref"
                Item "Textual Reference|x" "inset-modify changetype nameref"
-               Item "Textual Reference plus <page>|l" "inset-modify changetype Nameref"
                Separator
                Item "Settings...|S" "inset-settings"
        End
index d71381e009773590e1904accae9431a62e73e3ba..b399f6483117539f03861d0271d942d4d2425324 100644 (file)
@@ -126,7 +126,7 @@ namespace {
 
 // Do not remove the comment below, so we get merge conflict in
 // independent branches. Instead add your own.
-int const LYX_FORMAT = 396; // rgh: nameref
+int const LYX_FORMAT = 397; // rgh: remove Nameref support
 
 typedef map<string, bool> DepClean;
 typedef map<docstring, pair<InsetLabel const *, Buffer::References> > RefCache;
index 85100e809918be6e8ebfa41229d2356de81dd2f1..0d09af17f0180a65a2f46e8cca99067bccad1486 100644 (file)
@@ -53,8 +53,7 @@ bool InsetRef::isCompatibleCommand(string const & s) {
                || s == "vpageref"
                || s == "prettyref"
                || s == "eqref"
-               || s == "nameref"
-               || s == "Nameref";
+               || s == "nameref";
 }
 
 
@@ -137,7 +136,7 @@ docstring InsetRef::xhtml(XHTMLStream & xs, OutputParams const &) const
                else if (cmd == "prettyref" 
                         // we don't really have the ability to handle these 
                         // properly in XHTML output
-                        || cmd == "nameref" || cmd == "Nameref")
+                        || cmd == "nameref")
                        display_string = il->prettyCounter();
        } else 
                        display_string = ref;
@@ -217,7 +216,7 @@ void InsetRef::validate(LaTeXFeatures & features) const
                features.require("prettyref");
        else if (cmd == "eqref")
                features.require("amsmath");
-       else if (cmd == "nameref" || cmd == "Nameref")
+       else if (cmd == "nameref")
                features.require("nameref");
 }
 
@@ -230,7 +229,6 @@ InsetRef::type_info InsetRef::types[] = {
        { "vref",      N_("Standard+Textual Page"), N_("Ref+Text: ")},
        { "prettyref", N_("PrettyRef"),             N_("FrmtRef: ")},
        { "nameref",   N_("Reference to Name"),     N_("NameRef:")},
-       { "Nameref",   N_("Name+Textual Page"),     N_("NamePgRef:")},
        { "", "", "" }
 };