[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: another pygment formatting glitch
From: |
Jean Abou Samra |
Subject: |
Re: another pygment formatting glitch |
Date: |
Sat, 29 Oct 2022 14:34:20 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.1 |
Le 29/10/2022 à 11:06, Werner LEMBERG a écrit :
Please have a look at the attached image, taken from the LM section
3.4.1. As can be seen, the second variable ('cello') is bold, while
the first one ('violin') isn't. Can this be fixed?
~/repos/lilypond $ cat test.ly
violin = #'foo
cello = #'foo
~/repos/lilypond $ pygmentize -f raw test.ly
Token.Name.Builtin.Clef 'violin'
Token.Whitespace ' '
Token.Punctuation '='
Token.Whitespace ' '
Token.Punctuation '#'
Token.Literal.String.Symbol "'foo"
Token.Whitespace '\n'
Token.Name.Lvalue 'cello'
Token.Whitespace ' '
Token.Punctuation '='
Token.Whitespace ' '
Token.Punctuation '#'
Token.Literal.String.Symbol "'foo"
Token.Whitespace '\n'
The problem is that "violin" is also the name of a clef:
\clef violin . Maybe it's possible to fix this particular
case, but in general the Pygments lexer would have to be
far smarter in order to distinguish cases where a particular
word is used as a user-defined name vs. those where it
should be highlighted as a builtin.