lib/rouge/lexers/gherkin.rb in rouge-3.6.0 vs lib/rouge/lexers/gherkin.rb in rouge-3.7.0

- old
+ new

@@ -6,11 +6,11 @@ class Gherkin < RegexLexer tag 'gherkin' aliases 'cucumber', 'behat' title "Gherkin" - desc 'A business-readable spec DSL ( github.com/cucumber/cucumber/wiki/Gherkin )' + desc 'A business-readable spec DSL (github.com/cucumber/cucumber/wiki/Gherkin)' filenames '*.feature' mimetypes 'text/x-gherkin' def self.detect?(text) @@ -28,10 +28,12 @@ # need word boundaries at the ends - all others do. @step_regex ||= Regexp.new( keywords[:step].map do |w| if w.end_with? '<' Regexp.escape(w.chop) + elsif w.end_with?(' ') + Regexp.escape(w) else "#{Regexp.escape(w)}\\b" end end.join('|') ) @@ -128,10 +130,10 @@ state :step do mixin :basic rule %r/<.*?>/, Name::Variable rule %r/".*?"/, Str - rule %r/\S+/, Text + rule %r/\S[^\s<]*/, Text rule rest_of_line, Text, :pop! end end end end