Created
May 16, 2011 23:59
-
-
Save ajpalkovic/975627 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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