I know there are various plugins (i have my own as well) for creating permalinks for clean URLs. I''m curious to know what the core team thinks about including such a feature into rails core or if this is something the core believes should remain a plugin? We have dasherizer, camelize, etc. and thought it would be nice to have a "permalizer" as well. What are your thoughts? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
I would welcome such feature if it would be translating non-english chars to english: "čćž-šđ".permalize #-> "ccz-sd" Rick Olson's permalink_fu uses Iconv for this, which doesn't work good with Ruby 1.8.4 (in my experience). On Dec 2, 2007 11:11 PM, Robert Evans <ruby-forum-incoming@andreas-s.net> wrote:> > I know there are various plugins (i have my own as well) for creating > permalinks for clean URLs. I'm curious to know what the core team thinks > about including such a feature into rails core or if this is something > the core believes should remain a plugin? > > We have dasherizer, camelize, etc. and thought it would be nice to have > a "permalizer" as well. What are your thoughts? > -- > Posted via http://www.ruby-forum.com/. > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
On 2 Dec 2007, at 22:26, Mislav Marohnić wrote:> I would welcome such feature if it would be translating non-english > chars to english: > > "čćž-šđ".permalize #-> "ccz-sd" > > Rick Olson''s permalink_fu uses Iconv for this, which doesn''t work > good with Ruby 1.8.4 (in my experience).I''m no expert in this sort of area, but I usually do something like string.chars.normalize :d Then examine the result and discard anything in the range c >= 0x300 && c < 0x370, which is the range for combining marks Fred --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
I ask because I have my own that I''ve been using and was thinking about
submitting it as a patch, but wanted to get some feedback before
pursuing it. Here''s the basics of it to help generate some further
discussion:
require ''iconv''
module Permalizer
def permalize!
permalink!(self)
end
def permalize
string = self.dup
permalink!(string)
end
def permalink!(word)
(Iconv.new(''US-ASCII//TRANSLIT'',
''utf-8'').iconv
word).gsub(/[^\w\s\-\—]/,'''').gsub(/[^\w]|[\_]/,''
'').split.join(''-'').downcase
end
end
Mislav Marohni�? wrote:> I would welcome such feature if it would be translating non-english
> chars to
> english:
>
> "čćž-šđ".permalize #-> "ccz-sd"
>
> Rick Olson''s permalink_fu uses Iconv for this, which
doesn''t work good
> with
> Ruby 1.8.4 (in my experience).
>
> On Dec 2, 2007 11:11 PM, Robert Evans
> <ruby-forum-incoming@andreas-s.net>
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Core" group.
To post to this group, send email to rubyonrails-core@googlegroups.com
To unsubscribe from this group, send email to
rubyonrails-core-unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---
> We have dasherizer, camelize, etc. and thought it would be nice to have > a "permalizer" as well. What are your thoughts?I don''t think it''s something that belongs in core. There are so many different requirements as to how people want word-based URLs to look like that it doesn''t feel like we stand to gain much by standardizing. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
On Dec 2, 2007 2:46 PM, Robert Evans <ruby-forum-incoming@andreas-s.net> wrote:> > I ask because I have my own that I''ve been using and was thinking about > submitting it as a patch, but wanted to get some feedback before > pursuing it. Here''s the basics of it to help generate some further > discussion: >Why don''t you submit a patch to permalink_fu ? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
Since it doesn''t seem like this something that will be added to core, I think I''ll probably look at doing that. Courtenay wrote:> On Dec 2, 2007 2:46 PM, Robert Evans <ruby-forum-incoming@andreas-s.net> > wrote: > >> >> I ask because I have my own that I''ve been using and was thinking about >> submitting it as a patch, but wanted to get some feedback before >> pursuing it. Here''s the basics of it to help generate some further >> discussion: >> > > > Why don''t you submit a patch to permalink_fu ?-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---