]> git.lyx.org Git - lyx.git/commitdiff
further improve get_quoted_value
authorJuergen Spitzmueller <spitz@lyx.org>
Thu, 15 Aug 2024 15:44:01 +0000 (17:44 +0200)
committerJuergen Spitzmueller <spitz@lyx.org>
Thu, 15 Aug 2024 15:45:40 +0000 (17:45 +0200)
as per José's suggestion

lib/lyx2lyx/parser_tools.py

index 254f065781856c37644984d3005975eec0debbed..839b922278bf6159394dcf94ae495af66380a632 100644 (file)
@@ -430,13 +430,13 @@ def get_quoted_value(lines, token, start=0, end=0, default="", delete=False):
     val = get_value(lines, token, start, end, "", delete)
     if not val:
         return default
-    # remove only outer pair of quotes,
-    # hence do not use strip('"')
-    if val.startswith('"'):
-        val = val[1:]
-    if val.endswith('"'):
-        val = val[:-1]
-    
+
+    # We only remove quoation marks if the string starts and ends with one.
+    # Also, we remove only the outer pair of quotes (think of "\"").
+    # Hence, we do not use strip('"')
+    if val.startswith('"') and val.endswith('"'):
+        val = val[1:-1]
+
     return val