benschwarz / bonsai

A tiny static web site generator
http://tinytree.info/
MIT License
297 stars 39 forks source link

Unicode foldernames for navigation #32

Closed rhardih closed 7 years ago

rhardih commented 11 years ago

If a folder in content contains unicode characters, it fails to match in Page.find on this line of code:

disk_path = Dir["#{path}/*#{search_path}/*.yml"]

I'm not sure how to fix it, but it seems Dir is a bit allergic to this sort of thing.

Example (using bonsai's support content with added folder):

1.9.2-p318 :127 > pp Dir["spec/support/content/*"]
["spec/support/content/1.about-us",
 "spec/support/content/10.many-pages",
 "spec/support/content/2.products",
 "spec/support/content/3.unicode-æøå",
 "spec/support/content/index",
 "spec/support/content/legals",
 "spec/support/content/render"]
1.9.2-p318 :128 > Dir["spec/support/content/*unicode-æøå"]
 => [] 
1.9.2-p318 :129 > Dir["spec/support/content/*about-us"]
 => ["spec/support/content/1.about-us"] 

Since Navigation relies on the the converted foldernames, it means there is no way to have a page with a unicode title.

It seems Ruby has these notorious unicode issues, so perhaps a solution would be, to add a manual override of the default behaviour for extracting navigation items. E.g. in the case of the presence of a specially named .yml file, read the name and title from from that file, instead of inferring it from the parent foldername?

rhardih commented 7 years ago

No reply from maintainer.