Skip to content

Instantly share code, notes, and snippets.

@ajpalkovic
Created May 16, 2011 23:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ajpalkovic/975627 to your computer and use it in GitHub Desktop.
Save ajpalkovic/975627 to your computer and use it in GitHub Desktop.
syntax :html do
# apply this syntax to .html and .htm files
extension "html", "htm"
# color an entire tag green
green :begin => "<", :end => ">" do
#apply the following rules only to the stuff between the <>
# color the tag content yellow (so the <> are green)
yellow /.*/
# color div/span tag names as blue, all others will be yellow
blue /div|span/
# color stray <> as red
red "<", ">"
end
end
syntax :ruby do
# apply this syntax to files that have the .rb extension or start with #!/usr/bin/ruby
extension ".rb"
matches{|content| content.match(/^#!.*ruby/)}
end
syntax :erb do
extension ".erb", ".rhtml"
# .erb files will first try to process erb rules. if none match, then it will assume the text is html
default :html
# content between <% %> will be treated as ruby, but the <% %> will not be colored
match :begin => "<%", :end => "%>", :is => :ruby
# content between <%= %> will be colored green and treated as ruby
green :begin => "<%=", :end => "%>", :is => :ruby
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment