Skip to content

Commit

Permalink
Accept colon(s) in YAML key names
Browse files Browse the repository at this point in the history
as it's ok according to the YAML specs and is widely used in the real world,
f.e. in Puppet's Hiera
(https://puppet.com/docs/puppet/7/hiera_quick.html#values_common_data)
  • Loading branch information
gdubicki committed Nov 14, 2022
1 parent 78af25c commit 5ffffc1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rouge/lexers/yaml.rb
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def set_indent(match, opts={})

state :block_nodes do
# implicit key
rule %r/([^#,:?\[\]{}"'\n]+)(:)(?=\s|$)/ do |m|
rule %r/([^#,?\[\]{}"'\n]+)(:)(?=\s|$)/ do |m|
groups Name::Attribute, Punctuation::Indicator
set_indent m[0], :implicit => true
end
Expand Down
1 change: 1 addition & 0 deletions spec/visual/samples/yaml
Original file line number Diff line number Diff line change
Expand Up @@ -358,3 +358,4 @@ Stack:
foo/bar: We are great
foo.bar: Are we really?
foo+bar: Maybe not
foo:bar: ...or maybe we are?

0 comments on commit 5ffffc1

Please sign in to comment.