浏览代码

Replace colons with dashes in internal URL paths

Thibaut 12 年之前
父节点
当前提交
d51a6f9042
共有 2 个文件被更改,包括 5 次插入0 次删除
  1. 1 0
      lib/docs/filters/core/normalize_paths.rb
  2. 4 0
      test/lib/docs/filters/core/normalize_paths_test.rb

+ 1 - 0
lib/docs/filters/core/normalize_paths.rb

@@ -34,6 +34,7 @@ module Docs
 
     def normalize_path(path)
       path = path.downcase
+      path.gsub! ':', '-'
 
       if path == '.'
         'index'

+ 4 - 0
test/lib/docs/filters/core/normalize_paths_test.rb

@@ -55,6 +55,10 @@ class NormalizePathsFilterTest < MiniTest::Spec
     it "returns 'test' with 'test.html'" do
       assert_equal 'test', filter.normalize_path('test.html')
     end
+
+    it "returns 'te-st' with 'te:st'" do
+      assert_equal 'te-st', filter.normalize_path('te:st')
+    end
   end
 
   before do