From 56f16c248821c6f18fe5d77e2672cb588120c290 Mon Sep 17 00:00:00 2001 From: Jonathan Allard Date: Thu, 30 May 2013 13:20:57 -0400 Subject: [PATCH] Fix #823-2 to allow only one extension on localized views Make Sitemap::Store#strip_away_locale actually do something --- middleman-core/features/i18n_builder.feature | 6 +++++- middleman-core/features/i18n_preview.feature | 6 +++++- middleman-core/fixtures/i18n-test-app/locales/es.yml | 1 + middleman-core/fixtures/i18n-test-app/source/one.en.md | 1 + middleman-core/fixtures/i18n-test-app/source/one.es.md | 1 + middleman-core/lib/middleman-core/sitemap/store.rb | 2 +- 6 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 middleman-core/fixtures/i18n-test-app/source/one.en.md create mode 100644 middleman-core/fixtures/i18n-test-app/source/one.es.md diff --git a/middleman-core/features/i18n_builder.feature b/middleman-core/features/i18n_builder.feature index 4905569a..1e7139be 100644 --- a/middleman-core/features/i18n_builder.feature +++ b/middleman-core/features/i18n_builder.feature @@ -13,9 +13,11 @@ Feature: i18n Builder | index.html | | hello.html | | morning.html | + | one.html | | es/index.html | | es/hola.html | | es/manana.html | + | es/una.html | | CNAME | | password.txt | Then the following files should not exist: @@ -23,9 +25,11 @@ Feature: i18n Builder And the file "index.html" should contain "Howdy" And the file "hello.html" should contain "Hello World" And the file "morning.html" should contain "Good morning" + And the file "one.html" should contain "Only one" And the file "es/index.html" should contain "Como Esta?" And the file "es/hola.html" should contain "Hola World" And the file "es/manana.html" should contain "Buenos días" + And the file "es/una.html" should contain "Solamente una" And the file "CNAME" should contain "test.github.com" And the file "password.txt" should contain "hunter2" @@ -145,4 +149,4 @@ Feature: i18n Builder And the file "index.html" should contain '"stylesheets/site.css"' And the file "hello.html" should contain '"stylesheets/site.css"' And the file "es/index.html" should contain '"../stylesheets/site.css"' - And the file "es/hola.html" should contain '"../stylesheets/site.css"' \ No newline at end of file + And the file "es/hola.html" should contain '"../stylesheets/site.css"' diff --git a/middleman-core/features/i18n_preview.feature b/middleman-core/features/i18n_preview.feature index ec77e884..ea1acf11 100644 --- a/middleman-core/features/i18n_preview.feature +++ b/middleman-core/features/i18n_preview.feature @@ -14,6 +14,8 @@ Feature: i18n Preview Then I should see "Hello World" When I go to "/morning.html" Then I should see "Good morning" + When I go to "/one.html" + Then I should see "Only one" When I go to "/en/index.html" Then I should see "File Not Found" When I go to "/en/morning.html" @@ -24,6 +26,8 @@ Feature: i18n Preview Then I should see "Hola World" When I go to "/es/manana.html" Then I should see "Buenos días" + When I go to "/es/una.html" + Then I should see "Solamente una" Scenario: A template changes i18n during preview Given a fixture app "i18n-test-app" @@ -241,4 +245,4 @@ Feature: i18n Preview Then I should see "More" When I go to "/es/" Then I should see "Como Esta?" - Then I should see "Mucho" \ No newline at end of file + Then I should see "Mucho" diff --git a/middleman-core/fixtures/i18n-test-app/locales/es.yml b/middleman-core/fixtures/i18n-test-app/locales/es.yml index 11b8a327..a3321546 100644 --- a/middleman-core/fixtures/i18n-test-app/locales/es.yml +++ b/middleman-core/fixtures/i18n-test-app/locales/es.yml @@ -3,6 +3,7 @@ es: paths: hello: "hola" morning: "manana" + one: "una" greetings: "Como Esta?" hi: "Hola" diff --git a/middleman-core/fixtures/i18n-test-app/source/one.en.md b/middleman-core/fixtures/i18n-test-app/source/one.en.md new file mode 100644 index 00000000..2c4dcf4f --- /dev/null +++ b/middleman-core/fixtures/i18n-test-app/source/one.en.md @@ -0,0 +1 @@ +Only one diff --git a/middleman-core/fixtures/i18n-test-app/source/one.es.md b/middleman-core/fixtures/i18n-test-app/source/one.es.md new file mode 100644 index 00000000..8d31bd0f --- /dev/null +++ b/middleman-core/fixtures/i18n-test-app/source/one.es.md @@ -0,0 +1 @@ +Solamente una diff --git a/middleman-core/lib/middleman-core/sitemap/store.rb b/middleman-core/lib/middleman-core/sitemap/store.rb index 8a0ce73c..37cd0e71 100644 --- a/middleman-core/lib/middleman-core/sitemap/store.rb +++ b/middleman-core/lib/middleman-core/sitemap/store.rb @@ -250,7 +250,7 @@ module Middleman path_bits = path.split('.') lang = path_bits.last if app.langs.include?(lang.to_sym) - return path_bits[0..-1].join('.') + return path_bits[0..-2].join('.') end end