Properly handle titles with trailing punctuation
This commit is contained in:
parent
93f63df172
commit
a5e51cfdbe
|
@ -53,7 +53,7 @@ module Jekyll
|
|||
# sequence of spaces and non-alphanumeric characters replaced with a
|
||||
# hyphen.
|
||||
def slug(name)
|
||||
name.downcase.gsub(/[\W\s]+/, '-')
|
||||
name.downcase.gsub(/[^\w]/, " ").strip.gsub(/\s+/, '-')
|
||||
end
|
||||
|
||||
# The extension name of the document.
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
---
|
||||
title: So what is Jekyll, exactly?
|
||||
layout: slide
|
||||
---
|
||||
|
||||
Jekyll is a simple, blog-aware, static site generator. It takes a template
|
||||
directory containing raw text files in various formats, runs it through
|
||||
[Markdown](http://daringfireball.net/projects/markdown/) (or
|
||||
[Textile](http://redcloth.org/textile)) and
|
||||
[Liquid](http://wiki.shopify.com/Liquid)
|
||||
converters, and spits out a complete, ready-to-publish static website suitable
|
||||
for serving with your favorite web server. Jekyll also happens to be the engine
|
||||
behind [GitHub Pages](http://pages.github.com), which means you can use Jekyll
|
||||
to host your project’s page, blog, or website from GitHub’s servers **for
|
||||
free**.
|
|
@ -213,18 +213,18 @@ class TestDocument < Test::Unit::TestCase
|
|||
"collections" => {
|
||||
"slides" => {
|
||||
"output" => true,
|
||||
"permalink" => "/slides/test/:title"
|
||||
"permalink" => "/slides/:title"
|
||||
}
|
||||
},
|
||||
"source" => source_dir,
|
||||
"destination" => dest_dir
|
||||
}))
|
||||
@site.process
|
||||
@document = @site.collections["slides"].docs[0]
|
||||
@document = @site.collections["slides"].docs[3]
|
||||
end
|
||||
|
||||
should "produce the right URL" do
|
||||
assert_equal "/slides/test/example-slide", @document.url
|
||||
assert_equal "/slides/so-what-is-jekyll-exactly", @document.url
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue