Skip to content
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

Closed
wants to merge 2 commits into from
Closed

Add Velocity template support. #352

wants to merge 2 commits into from

Conversation

huacnlee
Copy link

filenames '*.vm', '*.velocity', '*.fhtml'
mimetypes 'text/html+velocity'

IDENTIFIER = '[a-zA-Z_]\w*'
Copy link
Member

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.

@jneen jneen added lexer-request A request for a lexer to be developed. discussion-open labels Jun 3, 2016
@jneen
Copy link
Member

jneen commented Jun 3, 2016

Otherwise, looks good. Thanks!

@huacnlee
Copy link
Author

How? Would you please give me an example?

@jneen
Copy link
Member

jneen commented Jun 13, 2016

IDENTIFIER = /[a-zA-Z_]\w*/, that's all :]

@huacnlee
Copy link
Author

Just updated

Jeanine Adkisson notifications@github.com于2016年6月14日周二 上午5:56写道:

IDENTIFIER = /[a-zA-Z_]\w*/, that's all :]


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#352 (comment), or mute
the thread
https://github.com/notifications/unsubscribe/AAAVjhADlJWOiqeujA__9e7V6KFaqRU7ks5qLdH_gaJpZM4G0gbv
.

end

state :root do
rule /[^{#$]+/, Other
Copy link
Member

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

Copy link
Member

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.

Copy link
Member

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)

@kamushadenes
Copy link

Any plans to merge that?

@pyrmont pyrmont mentioned this pull request May 24, 2020
@pyrmont
Copy link
Contributor

pyrmont commented May 24, 2020

@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?

@pyrmont pyrmont closed this May 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion-open lexer-request A request for a lexer to be developed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants