mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 01:59:02 +00:00
Do not convert dashes/hyphens in LyX-Code.
See previous commit and #10961
This commit is contained in:
parent
145f583244
commit
1702e76a1f
@ -634,6 +634,16 @@ def convert_dashes(document):
|
|||||||
else:
|
else:
|
||||||
i = j
|
i = j
|
||||||
continue
|
continue
|
||||||
|
if document.body[i] == "\\begin_layout LyX-Code":
|
||||||
|
j = find_end_of_layout(document.body, i)
|
||||||
|
if j == -1:
|
||||||
|
document.warning("Malformed LyX document: "
|
||||||
|
"Can't find end of %s layout at line %d" % (words[1],i))
|
||||||
|
i += 1
|
||||||
|
else:
|
||||||
|
i = j
|
||||||
|
continue
|
||||||
|
|
||||||
if len(words) > 0 and words[0] in ["\\leftindent", "\\paragraph_spacing", "\\align", "\\labelwidthstring"]:
|
if len(words) > 0 and words[0] in ["\\leftindent", "\\paragraph_spacing", "\\align", "\\labelwidthstring"]:
|
||||||
# skip paragraph parameters (bug 10243)
|
# skip paragraph parameters (bug 10243)
|
||||||
i += 1
|
i += 1
|
||||||
|
@ -1871,6 +1871,12 @@ def convert_dashligatures(document):
|
|||||||
document.warning("Malformed LyX document: "
|
document.warning("Malformed LyX document: "
|
||||||
"Can't find end of %s inset at line %d" % (words[1],i))
|
"Can't find end of %s inset at line %d" % (words[1],i))
|
||||||
continue
|
continue
|
||||||
|
if line == "\\begin_layout LyX-Code":
|
||||||
|
j = find_end_of_layout(document.body, i)
|
||||||
|
if j == -1:
|
||||||
|
document.warning("Malformed LyX document: "
|
||||||
|
"Can't find end of %s layout at line %d" % (words[1],i))
|
||||||
|
continue
|
||||||
# literal dash followed by a word or no-break space:
|
# literal dash followed by a word or no-break space:
|
||||||
if re.search(u"[\u2013\u2014]([\w\u00A0]|$)", line,
|
if re.search(u"[\u2013\u2014]([\w\u00A0]|$)", line,
|
||||||
flags=re.UNICODE):
|
flags=re.UNICODE):
|
||||||
@ -1925,6 +1931,14 @@ def revert_dashligatures(document):
|
|||||||
+ words[1] + " inset at line " + str(i))
|
+ words[1] + " inset at line " + str(i))
|
||||||
new_body.append(line)
|
new_body.append(line)
|
||||||
continue
|
continue
|
||||||
|
if line == "\\begin_layout LyX-Code":
|
||||||
|
j = find_end_of_layout(document.body, i)
|
||||||
|
if j == -1:
|
||||||
|
document.warning("Malformed LyX document: "
|
||||||
|
"Can't find end of %s layout at line %d" % (words[1],i))
|
||||||
|
new_body.append(line)
|
||||||
|
continue
|
||||||
|
# TODO: skip replacement in typewriter fonts
|
||||||
line = line.replace(u'\u2013', '\\twohyphens\n')
|
line = line.replace(u'\u2013', '\\twohyphens\n')
|
||||||
line = line.replace(u'\u2014', '\\threehyphens\n')
|
line = line.replace(u'\u2014', '\\threehyphens\n')
|
||||||
lines = line.split('\n')
|
lines = line.split('\n')
|
||||||
|
Loading…
Reference in New Issue
Block a user