Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Allow setting of Kramdown smart_quotes. Fixes #482.

  • Loading branch information...
commit e29490c1c6fbcd3bac5827bda958acb9082ff3ca 1 parent 4499df8
@mojombo mojombo authored
View
1  History.txt
@@ -10,6 +10,7 @@
* URL escape category names in URL generation (#360)
* Fix error with limit_posts (#442)
* Properly select dotfile during directory scan (#363, #431, #377)
+ * Allow setting of Kramdown smart_quotes (#482)
== 0.11.2 / 2011-12-27
* Bug Fixes
View
2  jekyll.gemspec
@@ -26,7 +26,7 @@ Gem::Specification.new do |s|
s.add_runtime_dependency('classifier', "~> 1.3")
s.add_runtime_dependency('directory_watcher', "~> 1.1")
s.add_runtime_dependency('maruku', "~> 0.5")
- s.add_runtime_dependency('kramdown', "~> 0.13")
+ s.add_runtime_dependency('kramdown', "~> 0.13.4")

Please don't change the dependencies! Jekyll 0.12.0 cannot use Kramdown 0.14.x. Instead, use multiple version requirements:

s.add_runtime_dependency('kramdown', "~> 0.13", ">= 0.13.4")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
s.add_runtime_dependency('albino', "~> 1.3")
s.add_development_dependency('rake', "~> 0.9")
View
1  lib/jekyll.rb
@@ -88,6 +88,7 @@ module Jekyll
'footnote_nr' => 1,
'entity_output' => 'as_char',
'toc_levels' => '1..6',
+ 'smart_quotes' => 'lsquo,rsquo,ldquo,rdquo',
'use_coderay' => false,
'coderay' => {
View
4 lib/jekyll/converters/markdown.rb
@@ -97,6 +97,7 @@ def convert(content)
:footnote_nr => @config['kramdown']['footnote_nr'],
:entity_output => @config['kramdown']['entity_output'],
:toc_levels => @config['kramdown']['toc_levels'],
+ :smart_quotes => @config['kramdown']['smart_quotes'],
:coderay_wrap => @config['kramdown']['coderay']['coderay_wrap'],
:coderay_line_numbers => @config['kramdown']['coderay']['coderay_line_numbers'],
@@ -111,7 +112,8 @@ def convert(content)
:auto_ids => @config['kramdown']['auto_ids'],
:footnote_nr => @config['kramdown']['footnote_nr'],
:entity_output => @config['kramdown']['entity_output'],
- :toc_levels => @config['kramdown']['toc_levels']
+ :toc_levels => @config['kramdown']['toc_levels'],
+ :smart_quotes => @config['kramdown']['smart_quotes']
}).to_html
end
when 'rdiscount'
View
18 test/test_kramdown.rb
@@ -3,21 +3,31 @@
class TestKramdown < Test::Unit::TestCase
context "kramdown" do
setup do
- config = {
+ @config = {
'markdown' => 'kramdown',
'kramdown' => {
'auto_ids' => false,
'footnote_nr' => 1,
'entity_output' => 'as_char',
- 'toc_levels' => '1..6'
+ 'toc_levels' => '1..6',
+ 'smart_quotes' => 'lsquo,rsquo,ldquo,rdquo'
}
}
- @markdown = MarkdownConverter.new config
end
# http://kramdown.rubyforge.org/converter/html.html#options
should "pass kramdown options" do
- assert_equal "<h1>Some Header</h1>", @markdown.convert('# Some Header #').strip
+ markdown = MarkdownConverter.new(@config)
+ assert_equal "<h1>Some Header</h1>", markdown.convert('# Some Header #').strip
+ end
+
+ should "convert quotes to smart quotes" do
+ markdown = MarkdownConverter.new(@config)
+ assert_equal "<p>&ldquo;Pit&rsquo;hy&rdquo;</p>", markdown.convert(%{"Pit'hy"}).strip
+
+ override = { 'kramdown' => { 'smart_quotes' => 'lsaquo,rsaquo,laquo,raquo' } }
+ markdown = MarkdownConverter.new(@config.deep_merge(override))
+ assert_equal "<p>&laquo;Pit&rsaquo;hy&raquo;</p>", markdown.convert(%{"Pit'hy"}).strip
end
end
end
View
2  test/test_tags.rb
@@ -6,7 +6,7 @@ class TestTags < Test::Unit::TestCase
def create_post(content, override = {}, converter_class = Jekyll::MarkdownConverter)
stub(Jekyll).configuration do
- Jekyll::DEFAULTS.merge({'pygments' => true}).merge(override)
+ Jekyll::DEFAULTS.deep_merge({'pygments' => true}).deep_merge(override)
end
site = Site.new(Jekyll.configuration)
Please sign in to comment.
Something went wrong with that request. Please try again.