Skip to content

Commit e29490c

Browse files
committed
Allow setting of Kramdown smart_quotes. Fixes jekyll#482.
1 parent 4499df8 commit e29490c

File tree

6 files changed

+21
-7
lines changed

6 files changed

+21
-7
lines changed

History.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
* URL escape category names in URL generation (#360)
1111
* Fix error with limit_posts (#442)
1212
* Properly select dotfile during directory scan (#363, #431, #377)
13+
* Allow setting of Kramdown smart_quotes (#482)
1314

1415
== 0.11.2 / 2011-12-27
1516
* Bug Fixes

jekyll.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Gem::Specification.new do |s|
2626
s.add_runtime_dependency('classifier', "~> 1.3")
2727
s.add_runtime_dependency('directory_watcher', "~> 1.1")
2828
s.add_runtime_dependency('maruku', "~> 0.5")
29-
s.add_runtime_dependency('kramdown', "~> 0.13")
29+
s.add_runtime_dependency('kramdown', "~> 0.13.4")
3030
s.add_runtime_dependency('albino', "~> 1.3")
3131

3232
s.add_development_dependency('rake', "~> 0.9")

lib/jekyll.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ module Jekyll
8888
'footnote_nr' => 1,
8989
'entity_output' => 'as_char',
9090
'toc_levels' => '1..6',
91+
'smart_quotes' => 'lsquo,rsquo,ldquo,rdquo',
9192
'use_coderay' => false,
9293

9394
'coderay' => {

lib/jekyll/converters/markdown.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ def convert(content)
9797
:footnote_nr => @config['kramdown']['footnote_nr'],
9898
:entity_output => @config['kramdown']['entity_output'],
9999
:toc_levels => @config['kramdown']['toc_levels'],
100+
:smart_quotes => @config['kramdown']['smart_quotes'],
100101

101102
:coderay_wrap => @config['kramdown']['coderay']['coderay_wrap'],
102103
:coderay_line_numbers => @config['kramdown']['coderay']['coderay_line_numbers'],
@@ -111,7 +112,8 @@ def convert(content)
111112
:auto_ids => @config['kramdown']['auto_ids'],
112113
:footnote_nr => @config['kramdown']['footnote_nr'],
113114
:entity_output => @config['kramdown']['entity_output'],
114-
:toc_levels => @config['kramdown']['toc_levels']
115+
:toc_levels => @config['kramdown']['toc_levels'],
116+
:smart_quotes => @config['kramdown']['smart_quotes']
115117
}).to_html
116118
end
117119
when 'rdiscount'

test/test_kramdown.rb

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,31 @@
33
class TestKramdown < Test::Unit::TestCase
44
context "kramdown" do
55
setup do
6-
config = {
6+
@config = {
77
'markdown' => 'kramdown',
88
'kramdown' => {
99
'auto_ids' => false,
1010
'footnote_nr' => 1,
1111
'entity_output' => 'as_char',
12-
'toc_levels' => '1..6'
12+
'toc_levels' => '1..6',
13+
'smart_quotes' => 'lsquo,rsquo,ldquo,rdquo'
1314
}
1415
}
15-
@markdown = MarkdownConverter.new config
1616
end
1717

1818
# http://kramdown.rubyforge.org/converter/html.html#options
1919
should "pass kramdown options" do
20-
assert_equal "<h1>Some Header</h1>", @markdown.convert('# Some Header #').strip
20+
markdown = MarkdownConverter.new(@config)
21+
assert_equal "<h1>Some Header</h1>", markdown.convert('# Some Header #').strip
22+
end
23+
24+
should "convert quotes to smart quotes" do
25+
markdown = MarkdownConverter.new(@config)
26+
assert_equal "<p>&ldquo;Pit&rsquo;hy&rdquo;</p>", markdown.convert(%{"Pit'hy"}).strip
27+
28+
override = { 'kramdown' => { 'smart_quotes' => 'lsaquo,rsaquo,laquo,raquo' } }
29+
markdown = MarkdownConverter.new(@config.deep_merge(override))
30+
assert_equal "<p>&laquo;Pit&rsaquo;hy&raquo;</p>", markdown.convert(%{"Pit'hy"}).strip
2131
end
2232
end
2333
end

test/test_tags.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class TestTags < Test::Unit::TestCase
66

77
def create_post(content, override = {}, converter_class = Jekyll::MarkdownConverter)
88
stub(Jekyll).configuration do
9-
Jekyll::DEFAULTS.merge({'pygments' => true}).merge(override)
9+
Jekyll::DEFAULTS.deep_merge({'pygments' => true}).deep_merge(override)
1010
end
1111
site = Site.new(Jekyll.configuration)
1212

0 commit comments

Comments
 (0)