[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: convert-ly rule for tocItem

From: Jean Abou Samra
Subject: Re: convert-ly rule for tocItem
Date: Mon, 24 Aug 2020 23:26:49 +0200

I can confirm the issue. And I think it is a bug in 
python/convertrules.py:4267. I found this:
s = re.sub(r'\\tocItem\s+\"', r'\\tocItem \\markup \"', s) In the replacement 
string the " does not need to be escaped. And with the raw string r'' the 
backslash is interpreted literally.

JAS-> Correct.

Btw, pylint reveals (among many other things) 27 warnings about: W1401: 
Anomalous backslash in string: '\m'. String constant might be missing an r 
prefix. (anomalous-backslash-in-string)
which shows that backslashes are not placed properly. In the case of `\m` this 
is interpreted as `\\m` but in cases of `\n` it is a new line.

JAS-> I've scratched that itch nearly everywhere in the other Python files, but 
for convert-ly I was just too tired and it made little sense until we actually 
had a linter in CI because convertrules.py is read infrequently.

... and yep. Not sure it needs to be escaped in the regular expression?

JAS-> I don't think it needs this escape, though I can't check.

I've opened
just so it doesn't get lost. If you want to, feel free to submit the fix as a 
merge request 😉

 JAS-> Absolutely!


reply via email to

[Prev in Thread] Current Thread [Next in Thread]