Closed chvp closed 2 years ago
@chvp Thank you for your contribution ❤️ TIL about conversion in format string syntax.
Technically only
[asr]
is allowed after!
It will be great to constrain the rule as you said. Would it be possible to do that in this PR? FYI, Pygments
has support for conversion specifiers that we could port over to Rouge. WDYT?
I updated it so it is constrained to [asr]
. I also carried over the same categories as in pygments.
@tancnle Is anything blocking this from being merged?
@chvp Sorry for the delay. I think this is a good change.
We would have to look into extending this support for the standard string in the future.
Fixes #1800. Format string syntax can be found here: https://docs.python.org/3/library/string.html#format-string-syntax
Technically only
[asr]
is allowed after!
. If wanted, I could make the entire![asr]
punctuation (or something else entirely), but parsing the specifier as a generic Python expression (so in practice, an identifier) seems fine to me.