New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Velocity template support. #352
Conversation
lib/rouge/lexers/velocity.rb
Outdated
filenames '*.vm', '*.velocity', '*.fhtml' | ||
mimetypes 'text/html+velocity' | ||
|
||
IDENTIFIER = '[a-zA-Z_]\w*' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer if IDENTIFIER
was itself a regex - ruby has some safety features when interpolating regexes into other regexes.
Otherwise, looks good. Thanks! |
How? Would you please give me an example? |
|
Just updated Jeanine Adkisson notifications@github.com于2016年6月14日周二 上午5:56写道:
|
end | ||
|
||
state :root do | ||
rule /[^{#$]+/, Other |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of highlighting this as Other
, I'd recommend delegating it to parent
, a lexer provided by the TemplateLexer
class that by default is HTML. So:
rule /.../ do
delegate parent
end
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then after doing that, I suggest you look into the errors in the sample. Run bundle exec rackup
and view localhost:9292/velocity
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(to see in detail how it's being lexed, add ?debug=1
)
Any plans to merge that? |
@kamushadenes Sorry this has taken so long. I needed to make some changes and have resubmitted this as #1518. If you're able, could you have a look at the code over there and see how it looks to you? |
https://bitbucket.org/birkenfeld/pygments-main/src/f114940f5aeb4775eef157e7089f462b49bdc127/pygments/lexers/templates.py?at=default&fileviewer=file-view-default
We need highlight Velocity templates on GitLab web page, because we have a lot of developers use that.