[LyX/master] further improve get_quoted_value
Juergen Spitzmueller
spitz at lyx.org
Thu Aug 15 15:46:09 UTC 2024
commit e1b6ad7980e815d25e528bc6d9b9070e2b6a686c
Author: Juergen Spitzmueller <spitz at lyx.org>
Date: Thu Aug 15 17:44:01 2024 +0200
further improve get_quoted_value
as per José's suggestion
---
lib/lyx2lyx/parser_tools.py | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/lib/lyx2lyx/parser_tools.py b/lib/lyx2lyx/parser_tools.py
index 254f065781..839b922278 100644
--- a/lib/lyx2lyx/parser_tools.py
+++ b/lib/lyx2lyx/parser_tools.py
@@ -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
More information about the lyx-cvs
mailing list