Correctly highlight placeholders in Gherkin syntax #952
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
While placeholders (variables surrounded by angle brackets, like
<this>
) are mostly highlighted correctly, there are two cases that are not:something (<foo>)
, andWhen <foo>
.This PR addresses these two cases. Some things to note about this PR.
Text
rule in thestep
state now stops as soon as it encounters either whitespace, OR a left angle bracket. This fixes case number 1.Rouge::Lexers::Gherkin.step_regex
has been modified so that it does not added a\b
to the end of the regex, if the pattern ends with a whitespace character. In fact, I wonder if there is a disconnect between thestep_regex
function and the keyword configs, since the comment mentions patterns that end with a<
, but there are no patterns in the config that do so. This change, though, fixes case number 2.