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

Clarify Rails uses erubis not stdlin ERB. [ci skip] #16773

Merged
merged 1 commit into from Sep 2, 2014

Conversation

Projects
None yet
3 participants
@cirosantilli
Contributor

cirosantilli commented Sep 2, 2014

#16766 (comment) tells me Rails uses erubis, not the stdlib ERB.

In the erubis doc, I could not find it explicitly written that it is equivalent to ERB, or ERB with some options.

As it stands, the behavior is different from ERB without options, e.g.:

  • no - without trim_mode='-'
  • and no auto line removal without trim_mode='<>'

both of which erubis and Rails do by default.

So we should say that in the docs.

zzak added a commit that referenced this pull request Sep 2, 2014

Merge pull request #16773 from cirosantilli/erb-erubis
Clarify Rails uses erubis not stdlin ERB. [ci skip]

@zzak zzak merged commit c247aa4 into rails:master Sep 2, 2014

@fxn

This comment has been minimized.

Member

fxn commented Sep 2, 2014

The template system is called eRuby, ERB and erubis are implementations.

That comment is not very accurate in my view. Also, it is weird to say that ERB is mixed with HTML, eRuby is a mix by definition. At most you could say Ruby is mixed with HTML.

@zzak

This comment has been minimized.

Member

zzak commented Sep 2, 2014

@fxn I think we should just say:

Action View templates can be written in several ways.
If the template file has a .erb extension then it uses the eRuby template system which can embed Ruby into an HTML document.
If the template file has a .builder extension then Jim Weirich's Builder::XmlMarkup library is used.

@fxn

This comment has been minimized.

Member

fxn commented Sep 2, 2014

Much better! 👍

@cirosantilli

This comment has been minimized.

Contributor

cirosantilli commented Sep 2, 2014

@zzak @fxn I totally agree that the current HTML remark is innacurate and that zzak's form is better.

I disagree with writting eRuby, unless we have a very precise definition of what eRuby syntax is and which is followed strictly by erubis with the options that rails uses by default. Otherwise, the saner thing to do is say:

  • we use such implementation
  • if we use non default options: we use such non default options

Otherwise, it is not very helpful for those seeking the actual syntax in details.

@zzak

This comment has been minimized.

Member

zzak commented Sep 2, 2014

@cirosantilli We can dive into the details below, but this paragraph is designed to give a very short intro to templates using AV::Base

Care to send a patch for my proposed change?

@fxn

This comment has been minimized.

Member

fxn commented Sep 2, 2014

Rails totally needs to document the erubis is the implementation used nowadays in some prominent place. As @zzak says, that particular spot just pretends to give a a very short intro, but if it wasn't covered elsewhere we should fix it. I don't recall from memory right now.

@zzak

This comment has been minimized.

Member

zzak commented Sep 2, 2014

@fxn Maybe in the AV guides

@cirosantilli

This comment has been minimized.

Contributor

cirosantilli commented Sep 2, 2014

@zzak I can do it. Just one point: if we say eRuby, I think we should link to a definition of eRuby, not the erubis, otherwise it is confusing. I am yet to see a precise definition of eRuby, and there are more prople confused about those things, e.g.: http://stackoverflow.com/questions/20910212/where-is-rubys-erb-format-officially-defined

@fxn: if Rails doesn't do any preprocessing (I don't know), we can just link to the erubis docs (as done in this patch) and say which options we use. It's DRYer.

@zzak

This comment has been minimized.

Member

zzak commented Sep 2, 2014

@cirosantilli AFAIK there is no spec for eRuby, let's link to erubis instead.

@cirosantilli

This comment has been minimized.

Contributor

cirosantilli commented Sep 2, 2014

Possible patch at: #16774

@cirosantilli cirosantilli deleted the cirosantilli:erb-erubis branch Sep 2, 2014

@fxn

This comment has been minimized.

Member

fxn commented Sep 2, 2014

@cirosantilli that patch seems a good compromise to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment