Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix num literals in YAML scalar block highlighting #1239

Merged
merged 1 commit into from
Jul 1, 2019

Conversation

ashmaroli
Copy link
Contributor

Standalone num literals in a block scalar should be tokenized as Literal::Number not Str.
However if those literals are preceded or succeeded by other non-whitespace characters, then it would be a legit Str token.
The exception is if the next tokens are whitespace and a comment:

# Mapping scalars to scalars
---
hr:  65    # Home runs
avg: 0.278 # Batting average
rbi: 147   # Runs Batted In
time: 20:03:20
staff:
  - name: Mark McGwire
    hr:   65
    avg:  0.278
    addr: B 221 Block

YAML Visual Test

@pyrmont pyrmont added the needs-review The PR needs to be reviewed label Jul 1, 2019
Copy link
Contributor

@pyrmont pyrmont left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one comment from me.

lib/rouge/lexers/yaml.rb Show resolved Hide resolved
@pyrmont pyrmont added author-action The PR has been reviewed but action by the author is needed and removed needs-review The PR needs to be reviewed labels Jul 1, 2019
@pyrmont pyrmont merged commit 28f484e into rouge-ruby:master Jul 1, 2019
@pyrmont pyrmont removed the author-action The PR has been reviewed but action by the author is needed label Jul 1, 2019
@ashmaroli ashmaroli deleted the fix-yaml-num-literals branch July 3, 2019 06:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants