|
View:
New views
11 Messages
—
Rating Filter:
Alert me
|
|
|
Drastic proposal: rename eruby to rhtml to make way for an HTML free eruby filetypeThe subject says it all. The most common use of eruby is filling out
HTML templates, but this is by no means the only use. I think it would be a good idea to have an rhtml filetype for html templates, and an eruby filetype for everything else. There is precedent for this elsewhere: Vim has a django filetype for Django templates and apparently will be getting a separate djangohtml filetype. I am well aware that changing filetypes around is not something to be taken lightly. I would anticipate phasing this in over a couple of *Vim* releases. I have no intention of even starting such a transition until Vim 7.1 draws nearer. At this point, I'm looking for objections other than "this would be hard to do." If there were no technical or backwards compatibility restrictions, and such a change could be made with zero side-effects, would anybody disagree with such a change? An alternative to this is to have a new filetype for eruby files without HTML. Something like plaineruby or erubytext. This would work but it makes me cringe, much like the tex filetype being LaTeX and the plaintex filetype being TeX. I'd like to make my proposed change while Vim support for eruby is still young and evolving. Once again, I'm looking for idealistic objections at this point rather than practical ones. Does anyone object to the idea of two filetypes, or of my suggested naming scheme? Cheers, Tim _______________________________________________ vim-ruby-devel mailing list vim-ruby-devel@... http://rubyforge.org/mailman/listinfo/vim-ruby-devel |
|
|
|
|
|
Re: Drastic proposal: rename eruby to rhtml to make way for an HTML free eruby filetypeOn Fri, Mar 09, 2007 at 09:47:38AM -0600, Tim Pope wrote:
> The subject says it all. The most common use of eruby is filling out > HTML templates, but this is by no means the only use. I think it > would be a good idea to have an rhtml filetype for html templates, and > an eruby filetype for everything else. There is precedent for this > elsewhere: Vim has a django filetype for Django templates and > apparently will be getting a separate djangohtml filetype. What is special, other than its current predominance, of rhtml over other files containing eRuby? Why should rhtml files be given special treatment and rfoo and rbar files be lumped together in some other generic eRuby filetype? > I am well aware that changing filetypes around is not something to be > taken lightly. I would anticipate phasing this in over a couple of > *Vim* releases. I have no intention of even starting such a > transition until Vim 7.1 draws nearer. At this point, I'm looking for > objections other than "this would be hard to do." If there were > no technical or backwards compatibility restrictions, and such a > change could be made with zero side-effects, would anybody disagree > with such a change? Allowing other 'host' filetypes to work is actually something on my ever growing TODO list but I don't actually use eRuby so motivation can be hard to come by... ;-) I'm glad you're working on it - thanks. > An alternative to this is to have a new filetype for eruby files > without HTML. Something like plaineruby or erubytext. This would > work but it makes me cringe, YUCK! > much like the tex filetype being LaTeX > and the plaintex filetype being TeX. I'd like to make my proposed > change while Vim support for eruby is still young and evolving. > > Once again, I'm looking for idealistic objections at this point rather > than practical ones. Does anyone object to the idea of two filetypes, > or of my suggested naming scheme? Well, again, it seems to me that there shouldn't really be an "idealistic" need to make a special case for rhtml files. What am I missing? The implementation is, as always, a whole other matter... Regards, Doug _______________________________________________ vim-ruby-devel mailing list vim-ruby-devel@... http://rubyforge.org/mailman/listinfo/vim-ruby-devel |
|
|
Re: Drastic proposal: rename eruby to rhtml to make way for an HTML free eruby filetypeOn Fri, Mar 09, 2007 at 01:49:06PM -0600, Tim Pope wrote:
> On Fri, Mar 09, 2007 at 04:39:20PM +0000, Hugh Sasse wrote: <snip> > The extension isn't the limiting factor, the filetype is. Having erb > for plain text and eruby for HTML is confusing. However, it might be > a good idea to use erb rather than eruby for the new file type, so > that we end up with erb and rhtml. Isn't erb, along with eruby and possibly others, just an _implementation_ of eRuby? > > Drat! :-) I've answered the wrong question. Hope soemthing in here > > is of use... In principle I'm in favour of encouraging this use of > > eruby, mainly because I keep forgetting about it, and doing code generation > > the hard way. Hence all that sfuff in my vimrc. > > If you want to use ERB with C, attached is a proof of concept for you > to try. Drop it in ~/.vim/syntax/erb.vim. Edit somefile.c.erb and > and :set ft=erb. This syntax file looks at the filename to determine > what to embed. So foo.c.erb will embed in C, foo.html.erb will embed > in HTML, and foo.sql.erb will embed in SQL. In fact, this script > could be renamed to eruby.vim and it would more or less be a drop-in > replacement, rendering my original suggestion moot. This is what I had in mind but it's more difficult to get this right with the ftplugins. > But all the magic > going on in the background is probably a bad idea. If we get rid of > the magic, having a file like this would still make using ERB with > other file types a lot easier. I like magic. :-) <snip> Regards, Doug _______________________________________________ vim-ruby-devel mailing list vim-ruby-devel@... http://rubyforge.org/mailman/listinfo/vim-ruby-devel |
|
|
Re: Drastic proposal: rename eruby to rhtml to make way for an HTML free eruby filetypeOn Fri, 9 Mar 2007, Tim Pope wrote:
> On Fri, Mar 09, 2007 at 04:39:20PM +0000, Hugh Sasse wrote: > > > The subject says it all. The most common use of eruby is filling out > > > HTML templates, but this is by no means the only use. I think it > > > > No, see the book "Code Generation in Action" for example. > > > > http://www.codegeneration.net/tiki-index.php?page=GenerationBooks > > I'd say HTML templates are still the most common, due to Rails alone, > but okay, you're actually helping make my case. > > > The difficulty I see is that when you mix syntaxes you have to pull > > in the right syntax groups, and there isn't a *simple* way to do thig > > in vim. With lots of help from Doug and others I have, for example > > in my .vimrc: > > > > <snip> > > These look to be the opposite of ERB: other syntax embedded in Ruby > rather than Ruby embedded in other syntax. The principles still apply: to embed one syntax in another is not trivial, except what you've written below challenges that. > > > Is the extension .erb already taken? > > The extension isn't the limiting factor, the filetype is. Having erb > for plain text and eruby for HTML is confusing. However, it might be > a good idea to use erb rather than eruby for the new file type, so > that we end up with erb and rhtml. > > > Drat! :-) I've answered the wrong question. Hope soemthing in here > > is of use... In principle I'm in favour of encouraging this use of > > eruby, mainly because I keep forgetting about it, and doing code generation > > the hard way. Hence all that sfuff in my vimrc. > > If you want to use ERB with C, attached is a proof of concept for you > to try. Drop it in ~/.vim/syntax/erb.vim. Edit somefile.c.erb and > and :set ft=erb. This syntax file looks at the filename to determine > what to embed. So foo.c.erb will embed in C, foo.html.erb will embed > in HTML, and foo.sql.erb will embed in SQL. In fact, this script > could be renamed to eruby.vim and it would more or less be a drop-in > replacement, rendering my original suggestion moot. But all the magic > going on in the background is probably a bad idea. If we get rid of > the magic, having a file like this would still make using ERB with > other file types a lot easier. > > if exists("b:current_syntax") > finish > endif > runtime! syntax/c.vim > unlet b:current_syntax > runtime! syntax/erb.vim > let b:current_syntax = "erbc" > > That's all you would need in an erbc.vim to get ERB C highlighting. > > Anyways, this is just wild brainstorming at this point. > > Cheers, > Tim > Hugh _______________________________________________ vim-ruby-devel mailing list vim-ruby-devel@... http://rubyforge.org/mailman/listinfo/vim-ruby-devel |
|
|
Re: Drastic proposal: rename eruby to rhtml to make way for an HTML free eruby filetypeOn Sat, Mar 10, 2007 at 04:52:02PM +1100, Doug Kearns wrote:
> On Fri, Mar 09, 2007 at 09:47:38AM -0600, Tim Pope wrote: > > The subject says it all. The most common use of eruby is filling out > > HTML templates, but this is by no means the only use. I think it > > would be a good idea to have an rhtml filetype for html templates, and > > an eruby filetype for everything else. There is precedent for this > > elsewhere: Vim has a django filetype for Django templates and > > apparently will be getting a separate djangohtml filetype. > > What is special, other than its current predominance, of rhtml over > other files containing eRuby? Why should rhtml files be given special > treatment and rfoo and rbar files be lumped together in some other > generic eRuby filetype? <snip> > Well, again, it seems to me that there shouldn't really be an > "idealistic" need to make a special case for rhtml files. What am I > missing? > > The implementation is, as always, a whole other matter... I can't really name a good reason other than popularity and "they're getting special treatment now anyways". Idealistically, one filetype to rule them all does indeed sounds grand. But I was breaking my own rule and taking the practicalities into account when I suggested two. Cheers, Tim _______________________________________________ vim-ruby-devel mailing list vim-ruby-devel@... http://rubyforge.org/mailman/listinfo/vim-ruby-devel |
|
|
Re: Drastic proposal: rename eruby to rhtml to make way for an HTML free eruby filetypeOn Sat, Mar 10, 2007 at 04:58:39PM +1100, Doug Kearns wrote:
> Isn't erb, along with eruby and possibly others, just an > _implementation_ of eRuby? I haven't managed to confirm either way with google. > > If you want to use ERB with C, attached is a proof of concept for you > > to try. Drop it in ~/.vim/syntax/erb.vim. Edit somefile.c.erb and > > and :set ft=erb. This syntax file looks at the filename to determine > > what to embed. So foo.c.erb will embed in C, foo.html.erb will embed > > in HTML, and foo.sql.erb will embed in SQL. In fact, this script > > could be renamed to eruby.vim and it would more or less be a drop-in > > replacement, rendering my original suggestion moot. > > This is what I had in mind but it's more difficult to get this right > with the ftplugins. Yes, this is partially why I suggested a separate rhtml filetype. Things like indenting may prove nearly impossible to hack together. > > > But all the magic > > going on in the background is probably a bad idea. If we get rid of > > the magic, having a file like this would still make using ERB with > > other file types a lot easier. > > I like magic. :-) So long as it works properly. If the one magic filetype detects the embedded language incorrectly, it may prove difficult to override. Perhaps we should start by making a list of common filetypes combined with eruby, so we can see what the common cases are. So far I have HTML YAML - used with ERB in Rails C - as mentioned by Hugh Sasse Cheers, Tim _______________________________________________ vim-ruby-devel mailing list vim-ruby-devel@... http://rubyforge.org/mailman/listinfo/vim-ruby-devel |
|
|
Re: Drastic proposal: rename eruby to rhtml to make way for an HTML free eruby filetypeOn Mon, Mar 12, 2007 at 04:39:16PM -0500, Tim Pope wrote:
> On Sat, Mar 10, 2007 at 04:58:39PM +1100, Doug Kearns wrote: > > Isn't erb, along with eruby and possibly others, just an > > _implementation_ of eRuby? > > I haven't managed to confirm either way with google. I turned up these... http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/1731 "I wrote 'Tiny eRuby - ERb'. ERb is an implementation of eRuby (embedded ruby)." http://www.modruby.net/en/index.rbx/eruby/whatis.html http://en.wikipedia.org/wiki/Eruby http://en.wikipedia.org/wiki/Erb ...so it must be true. ;-) <snip> Regards, Doug _______________________________________________ vim-ruby-devel mailing list vim-ruby-devel@... http://rubyforge.org/mailman/listinfo/vim-ruby-devel |
|
|
Re: Drastic proposal: rename eruby to rhtml to make way for an HTML free eruby filetypeOn Mon, 12 Mar 2007, Tim Pope wrote:
> Perhaps we should start by making a list of common filetypes combined > with eruby, so we can see what the common cases are. So far I have > > HTML > YAML - used with ERB in Rails > C - as mentioned by Hugh Sasse Java -- See Code Generation In Action, mentioned before. There is a school of thought that programmers consider [0, 1, Many] as the numbers that are important. Thus I suggest C + Java implies C#, C++, ... and any language which doesn't have it's own templater available. Things like Perl and Lua may not need ERB... Which doesn't mean someone won't use it anyway. Hugh _______________________________________________ vim-ruby-devel mailing list vim-ruby-devel@... http://rubyforge.org/mailman/listinfo/vim-ruby-devel |
|
|
Re: Drastic proposal: rename eruby to rhtml to make way for an HTML free eruby filetypeOn Tue, Mar 13, 2007 at 10:08:38AM +0000, Hugh Sasse wrote:
> On Mon, 12 Mar 2007, Tim Pope wrote: > > Perhaps we should start by making a list of common filetypes combined > > with eruby, so we can see what the common cases are. So far I have > > > > HTML > > YAML - used with ERB in Rails > > C - as mentioned by Hugh Sasse > Java -- See Code Generation In Action, mentioned before. > > There is a school of thought that programmers consider > [0, 1, Many] as the numbers that are important. Thus I suggest > C + Java implies C#, C++, ... and any language which doesn't have > it's own templater available. Things like Perl and Lua may not > need ERB... Which doesn't mean someone won't use it anyway. I certainly agree, glad you're still keeping idealistic. But when it comes down to implementation supporting every possible filetype may not be possible, so I want to get an idea of what to prioritize. I will keep all these "compiled" languages in mind. As you point out, uses of eruby with Perl and Lua are corner cases at best, and not worth worrying about so much. To all, thanks for the feedback. I'm going to sit on this a while and think things over. Right now, I'm thinking something vaguely like the following: An eruby syntax file which highlights the non-Ruby parts as plain text. This file can be :source'd and combined with other filetypes in a relatively straightforward manner. An rhtml syntax file that combines the eruby syntax file and html syntax file. This would serve both as an example of how to combine filetypes and also fulfill the most common (according to me) need of using html with eruby. I still haven't decided about ftplugins and indent plugins. Ideally they could parallel the syntax files with combining but I haven't looked into how feasible that is. Cheers, Tim _______________________________________________ vim-ruby-devel mailing list vim-ruby-devel@... http://rubyforge.org/mailman/listinfo/vim-ruby-devel |
|
|
Re: Drastic proposal: rename eruby to rhtml to make way for an HTML free eruby filetypeOn Tue, 20 Mar 2007, Tim Pope wrote:
> On Tue, Mar 13, 2007 at 10:08:38AM +0000, Hugh Sasse wrote: > > On Mon, 12 Mar 2007, Tim Pope wrote: > > > Perhaps we should start by making a list of common filetypes combined > > > with eruby, so we can see what the common cases are. So far I have > > > > > > HTML > > > YAML - used with ERB in Rails > > > C - as mentioned by Hugh Sasse > > Java -- See Code Generation In Action, mentioned before. > > > > There is a school of thought that programmers consider > > [0, 1, Many] as the numbers that are important. Thus I suggest > > C + Java implies C#, C++, ... and any language which doesn't have > > it's own templater available. Things like Perl and Lua may not > > need ERB... Which doesn't mean someone won't use it anyway. > > I certainly agree, glad you're still keeping idealistic. But when it Idealistic? :-) I'm being cynical -- trying to think of ways people will break it before it exists :-) > comes down to implementation supporting every possible filetype may No, but allowing people to do their own support is another matter. Leaving things open, and the idea of plugins... > not be possible, so I want to get an idea of what to prioritize. I > will keep all these "compiled" languages in mind. As you point out, > uses of eruby with Perl and Lua are corner cases at best, and not > worth worrying about so much. > > To all, thanks for the feedback. I'm going to sit on this a while and > think things over. Right now, I'm thinking something vaguely like the > following: > > An eruby syntax file which highlights the non-Ruby parts as plain text. > This file can be :source'd and combined with other filetypes in a > relatively straightforward manner. With you so far... > > An rhtml syntax file that combines the eruby syntax file and html > syntax file. This would serve both as an example of how to combine > filetypes and also fulfill the most common (according to me) need of > using html with eruby. Yes, agree with this too... > > I still haven't decided about ftplugins and indent plugins. Ideally > they could parallel the syntax files with combining but I haven't > looked into how feasible that is. Maybe we need an enhancement request, but it would be nice if there were a way to pass "the other text" that we now treat as plain, to the 'filetype detect' system of Vim, like we'd pass stuff to a block in Ruby. No, I don't know how to do that at present. > > Cheers, > Tim Hugh _______________________________________________ vim-ruby-devel mailing list vim-ruby-devel@... http://rubyforge.org/mailman/listinfo/vim-ruby-devel |
| Free embeddable forum powered by Nabble | Forum Help |