lib/rouge/lexers/tex.rb in rouge-0.4.0 vs lib/rouge/lexers/tex.rb in rouge-0.5.0
- old
+ new
@@ -16,56 +16,56 @@
end
command = /\\([a-z]+|\s+|.)/i
state :general do
- rule /%.*$/, 'Comment'
- rule /[{}&_^]/, 'Punctuation'
+ rule /%.*$/, Comment
+ rule /[{}&_^]/, Punctuation
end
state :root do
- rule /\\\[/, 'Punctuation', :displaymath
- rule /\\\(/, 'Punctuation', :inlinemath
- rule /\$\$/, 'Punctuation', :displaymath
- rule /\$/, 'Punctuation', :inlinemath
- rule /\\(begin|end)\{.*?\}/, 'Name.Tag'
+ rule /\\\[/, Punctuation, :displaymath
+ rule /\\\(/, Punctuation, :inlinemath
+ rule /\$\$/, Punctuation, :displaymath
+ rule /\$/, Punctuation, :inlinemath
+ rule /\\(begin|end)\{.*?\}/, Name::Tag
rule /(\\verb)\b(\S)(.*?)(\2)/ do |m|
- group 'Name.Builtin'
- group 'Keyword.Pseudo'
- group 'Literal.String.Other'
- group 'Keyword.Pseudo'
+ group Name::Builtin
+ group Keyword::Pseudo
+ group Str::Other
+ group Keyword::Pseudo
end
- rule command, 'Keyword', :command
+ rule command, Keyword, :command
mixin :general
- rule /[^\\$%&_^{}]+/, 'Text'
+ rule /[^\\$%&_^{}]+/, Text
end
state :math do
- rule command, 'Name.Variable'
+ rule command, Name::Variable
mixin :general
- rule /[0-9]+/, 'Literal.Number'
- rule /[-=!+*\/()\[\]]/, 'Operator'
- rule /[^=!+*\/()\[\]\\$%&_^{}0-9-]+/, 'Name.Builtin'
+ rule /[0-9]+/, Num
+ rule /[-=!+*\/()\[\]]/, Operator
+ rule /[^=!+*\/()\[\]\\$%&_^{}0-9-]+/, Name::Builtin
end
state :inlinemath do
- rule /\\\)/, 'Punctuation', :pop!
- rule /\$/, 'Punctuation', :pop!
+ rule /\\\)/, Punctuation, :pop!
+ rule /\$/, Punctuation, :pop!
mixin :math
end
state :displaymath do
- rule /\\\]/, 'Punctuation', :pop!
- rule /\$\$/, 'Punctuation', :pop!
- rule /\$/, 'Name.Builtin'
+ rule /\\\]/, Punctuation, :pop!
+ rule /\$\$/, Punctuation, :pop!
+ rule /\$/, Name::Builtin
mixin :math
end
state :command do
- rule /\[.*?\]/, 'Name.Attribute'
- rule /\*/, 'Keyword'
+ rule /\[.*?\]/, Name::Attribute
+ rule /\*/, Keyword
rule(//) { pop! }
end
end
end
end