jekyll 0.12.1 → 1.0.0.beta1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of jekyll might be problematic. Click here for more details.

Files changed (124) hide show
  1. data/CONTRIBUTING.md +67 -0
  2. data/Gemfile +1 -1
  3. data/History.txt +50 -6
  4. data/README.textile +10 -6
  5. data/Rakefile +74 -36
  6. data/bin/jekyll +78 -276
  7. data/cucumber.yml +3 -1
  8. data/features/create_sites.feature +1 -1
  9. data/features/drafts.feature +25 -0
  10. data/features/site_configuration.feature +1 -1
  11. data/features/step_definitions/jekyll_steps.rb +13 -3
  12. data/features/support/env.rb +3 -1
  13. data/jekyll.gemspec +73 -17
  14. data/lib/jekyll.rb +31 -21
  15. data/lib/jekyll/command.rb +12 -0
  16. data/lib/jekyll/commands/build.rb +81 -0
  17. data/lib/jekyll/commands/serve.rb +28 -0
  18. data/lib/jekyll/converter.rb +1 -3
  19. data/lib/jekyll/converters/identity.rb +13 -14
  20. data/lib/jekyll/converters/markdown.rb +128 -128
  21. data/lib/jekyll/converters/textile.rb +37 -37
  22. data/lib/jekyll/convertible.rb +6 -4
  23. data/lib/jekyll/core_ext.rb +9 -1
  24. data/lib/jekyll/draft.rb +35 -0
  25. data/lib/jekyll/errors.rb +1 -3
  26. data/lib/jekyll/filters.rb +13 -4
  27. data/lib/jekyll/generator.rb +1 -4
  28. data/lib/jekyll/generators/pagination.rb +46 -46
  29. data/lib/jekyll/layout.rb +0 -2
  30. data/lib/jekyll/mime.types +1588 -0
  31. data/lib/jekyll/page.rb +24 -8
  32. data/lib/jekyll/plugin.rb +0 -2
  33. data/lib/jekyll/post.rb +66 -40
  34. data/lib/jekyll/site.rb +96 -20
  35. data/lib/jekyll/static_file.rb +0 -2
  36. data/lib/jekyll/tags/gist.rb +19 -0
  37. data/lib/jekyll/tags/highlight.rb +63 -62
  38. data/lib/jekyll/tags/include.rb +25 -25
  39. data/lib/jekyll/tags/post_url.rb +30 -25
  40. data/script/bootstrap +2 -0
  41. data/site/.gitignore +4 -0
  42. data/site/CNAME +1 -0
  43. data/site/README +1 -0
  44. data/site/_config.yml +5 -0
  45. data/site/_includes/analytics.html +32 -0
  46. data/site/_includes/docs_contents.html +82 -0
  47. data/site/_includes/footer.html +15 -0
  48. data/site/_includes/header.html +26 -0
  49. data/site/_includes/section_nav.html +22 -0
  50. data/site/_includes/top.html +14 -0
  51. data/site/_layouts/default.html +12 -0
  52. data/site/_layouts/docs.html +21 -0
  53. data/site/_posts/2012-07-01-configuration.md +277 -0
  54. data/site/_posts/2012-07-01-contributing.md +66 -0
  55. data/site/_posts/2012-07-01-deployment-methods.md +108 -0
  56. data/site/_posts/2012-07-01-extras.md +103 -0
  57. data/site/_posts/2012-07-01-frontmatter.md +120 -0
  58. data/site/_posts/2012-07-01-github-pages.md +34 -0
  59. data/site/_posts/2012-07-01-heroku.md +8 -0
  60. data/site/_posts/2012-07-01-home.md +47 -0
  61. data/site/_posts/2012-07-01-installation.md +43 -0
  62. data/site/_posts/2012-07-01-migrations.md +180 -0
  63. data/site/_posts/2012-07-01-pages.md +62 -0
  64. data/site/_posts/2012-07-01-pagination.md +116 -0
  65. data/site/_posts/2012-07-01-permalinks.md +163 -0
  66. data/site/_posts/2012-07-01-plugins.md +384 -0
  67. data/site/_posts/2012-07-01-posts.md +106 -0
  68. data/site/_posts/2012-07-01-resources.md +49 -0
  69. data/site/_posts/2012-07-01-sites.md +28 -0
  70. data/site/_posts/2012-07-01-structure.md +95 -0
  71. data/site/_posts/2012-07-01-templates.md +217 -0
  72. data/site/_posts/2012-07-01-troubleshooting.md +108 -0
  73. data/site/_posts/2012-07-01-usage.md +38 -0
  74. data/site/_posts/2012-07-01-variables.md +166 -0
  75. data/site/css/grid.css +62 -0
  76. data/site/css/normalize.css +504 -0
  77. data/site/css/pygments.css +70 -0
  78. data/site/css/style.css +697 -0
  79. data/site/docs/index.html +11 -0
  80. data/site/favicon.png +0 -0
  81. data/site/img/article-footer.png +0 -0
  82. data/site/img/footer-arrow.png +0 -0
  83. data/site/img/footer-logo.png +0 -0
  84. data/site/img/logo-2x.png +0 -0
  85. data/site/img/octojekyll.png +0 -0
  86. data/site/img/tube.png +0 -0
  87. data/site/img/tube1x.png +0 -0
  88. data/site/index.html +77 -0
  89. data/site/js/modernizr-2.5.3.min.js +4 -0
  90. data/test/fixtures/broken_front_matter2.erb +4 -0
  91. data/test/fixtures/broken_front_matter3.erb +7 -0
  92. data/test/fixtures/exploit_front_matter.erb +4 -0
  93. data/test/helper.rb +16 -0
  94. data/test/source/_posts/2013-01-12-nil-layout.textile +6 -0
  95. data/test/source/_posts/2013-01-12-no-layout.textile +5 -0
  96. data/test/source/contacts/bar.html +5 -0
  97. data/test/source/contacts/index.html +5 -0
  98. data/test/test_configuration.rb +7 -8
  99. data/test/test_convertible.rb +29 -0
  100. data/test/test_core_ext.rb +22 -0
  101. data/test/test_generated_site.rb +1 -1
  102. data/test/test_kramdown.rb +3 -3
  103. data/test/test_page.rb +88 -2
  104. data/test/test_post.rb +42 -6
  105. data/test/test_rdiscount.rb +1 -1
  106. data/test/test_redcarpet.rb +1 -1
  107. data/test/test_redcloth.rb +6 -6
  108. data/test/test_site.rb +73 -8
  109. data/test/test_tags.rb +36 -13
  110. metadata +150 -19
  111. data/lib/jekyll/migrators/csv.rb +0 -26
  112. data/lib/jekyll/migrators/drupal.rb +0 -103
  113. data/lib/jekyll/migrators/enki.rb +0 -49
  114. data/lib/jekyll/migrators/joomla.rb +0 -53
  115. data/lib/jekyll/migrators/marley.rb +0 -52
  116. data/lib/jekyll/migrators/mephisto.rb +0 -84
  117. data/lib/jekyll/migrators/mt.rb +0 -86
  118. data/lib/jekyll/migrators/posterous.rb +0 -67
  119. data/lib/jekyll/migrators/rss.rb +0 -47
  120. data/lib/jekyll/migrators/textpattern.rb +0 -58
  121. data/lib/jekyll/migrators/tumblr.rb +0 -195
  122. data/lib/jekyll/migrators/typo.rb +0 -51
  123. data/lib/jekyll/migrators/wordpress.rb +0 -294
  124. data/lib/jekyll/migrators/wordpressdotcom.rb +0 -70
@@ -0,0 +1,28 @@
1
+ module Jekyll
2
+ module Commands
3
+ class Serve < Command
4
+ def self.process(options)
5
+ require 'webrick'
6
+ include WEBrick
7
+
8
+ destination = options['destination']
9
+
10
+ FileUtils.mkdir_p(destination)
11
+
12
+ mime_types_file = File.expand_path('../mime.types', File.dirname(__FILE__))
13
+ mime_types = WEBrick::HTTPUtils::load_mime_types(mime_types_file)
14
+
15
+ s = HTTPServer.new(
16
+ :Port => options['port'],
17
+ :BindAddress => options['host'],
18
+ :MimeTypes => mime_types
19
+ )
20
+
21
+ s.mount(options['baseurl'], HTTPServlet::FileHandler, destination)
22
+ t = Thread.new { s.start }
23
+ trap("INT") { s.shutdown }
24
+ t.join()
25
+ end
26
+ end
27
+ end
28
+ end
@@ -1,5 +1,4 @@
1
1
  module Jekyll
2
-
3
2
  class Converter < Plugin
4
3
  # Public: Get or set the pygments prefix. When an argument is specified,
5
4
  # the prefix will be set. If no argument is specified, the current prefix
@@ -46,5 +45,4 @@ module Jekyll
46
45
  self.class.pygments_suffix
47
46
  end
48
47
  end
49
-
50
- end
48
+ end
@@ -1,22 +1,21 @@
1
1
  module Jekyll
2
+ module Converters
3
+ class Identity < Converter
4
+ safe true
2
5
 
3
- class IdentityConverter < Converter
4
- safe true
6
+ priority :lowest
5
7
 
6
- priority :lowest
8
+ def matches(ext)
9
+ true
10
+ end
7
11
 
8
- def matches(ext)
9
- true
10
- end
11
-
12
- def output_ext(ext)
13
- ext
14
- end
12
+ def output_ext(ext)
13
+ ext
14
+ end
15
15
 
16
- def convert(content)
17
- content
16
+ def convert(content)
17
+ content
18
+ end
18
19
  end
19
-
20
20
  end
21
-
22
21
  end
@@ -1,149 +1,149 @@
1
1
  module Jekyll
2
+ module Converters
3
+ class Markdown < Converter
4
+ safe true
2
5
 
3
- class MarkdownConverter < Converter
4
- safe true
6
+ pygments_prefix "\n"
7
+ pygments_suffix "\n"
5
8
 
6
- pygments_prefix "\n"
7
- pygments_suffix "\n"
9
+ def setup
10
+ return if @setup
11
+ case @config['markdown']
12
+ when 'redcarpet'
13
+ begin
14
+ require 'redcarpet'
8
15
 
9
- def setup
10
- return if @setup
11
- case @config['markdown']
12
- when 'redcarpet'
13
- begin
14
- require 'redcarpet'
16
+ @renderer ||= Class.new(Redcarpet::Render::HTML) do
17
+ def block_code(code, lang)
18
+ lang = lang && lang.split.first || "text"
19
+ output = add_code_tags(
20
+ Pygments.highlight(code, :lexer => lang, :options => { :encoding => 'utf-8' }),
21
+ lang
22
+ )
23
+ end
15
24
 
16
- @renderer ||= Class.new(Redcarpet::Render::HTML) do
17
- def block_code(code, lang)
18
- lang = lang && lang.split.first || "text"
19
- output = add_code_tags(
20
- Pygments.highlight(code, :lexer => lang, :options => { :encoding => 'utf-8' }),
21
- lang
22
- )
25
+ def add_code_tags(code, lang)
26
+ code = code.sub(/<pre>/,'<pre><code class="' + lang + '">')
27
+ code = code.sub(/<\/pre>/,"</code></pre>")
28
+ end
23
29
  end
24
30
 
25
- def add_code_tags(code, lang)
26
- code = code.sub(/<pre>/,'<pre><code class="' + lang + '">')
27
- code = code.sub(/<\/pre>/,"</code></pre>")
28
- end
31
+ @redcarpet_extensions = {}
32
+ @config['redcarpet']['extensions'].each { |e| @redcarpet_extensions[e.to_sym] = true }
33
+ rescue LoadError
34
+ STDERR.puts 'You are missing a library required for Markdown. Please run:'
35
+ STDERR.puts ' $ [sudo] gem install redcarpet'
36
+ raise FatalException.new("Missing dependency: redcarpet")
29
37
  end
30
-
31
- @redcarpet_extensions = {}
32
- @config['redcarpet']['extensions'].each { |e| @redcarpet_extensions[e.to_sym] = true }
33
- rescue LoadError
34
- STDERR.puts 'You are missing a library required for Markdown. Please run:'
35
- STDERR.puts ' $ [sudo] gem install redcarpet'
36
- raise FatalException.new("Missing dependency: redcarpet")
37
- end
38
- when 'kramdown'
39
- begin
40
- require 'kramdown'
41
- rescue LoadError
42
- STDERR.puts 'You are missing a library required for Markdown. Please run:'
43
- STDERR.puts ' $ [sudo] gem install kramdown'
44
- raise FatalException.new("Missing dependency: kramdown")
45
- end
46
- when 'rdiscount'
47
- begin
48
- require 'rdiscount'
49
- @rdiscount_extensions = @config['rdiscount']['extensions'].map { |e| e.to_sym }
50
- rescue LoadError
51
- STDERR.puts 'You are missing a library required for Markdown. Please run:'
52
- STDERR.puts ' $ [sudo] gem install rdiscount'
53
- raise FatalException.new("Missing dependency: rdiscount")
54
- end
55
- when 'maruku'
56
- begin
57
- require 'maruku'
58
-
59
- if @config['maruku']['use_divs']
60
- require 'maruku/ext/div'
61
- STDERR.puts 'Maruku: Using extended syntax for div elements.'
38
+ when 'kramdown'
39
+ begin
40
+ require 'kramdown'
41
+ rescue LoadError
42
+ STDERR.puts 'You are missing a library required for Markdown. Please run:'
43
+ STDERR.puts ' $ [sudo] gem install kramdown'
44
+ raise FatalException.new("Missing dependency: kramdown")
62
45
  end
46
+ when 'rdiscount'
47
+ begin
48
+ require 'rdiscount'
49
+ @rdiscount_extensions = @config['rdiscount']['extensions'].map { |e| e.to_sym }
50
+ rescue LoadError
51
+ STDERR.puts 'You are missing a library required for Markdown. Please run:'
52
+ STDERR.puts ' $ [sudo] gem install rdiscount'
53
+ raise FatalException.new("Missing dependency: rdiscount")
54
+ end
55
+ when 'maruku'
56
+ begin
57
+ require 'maruku'
63
58
 
64
- if @config['maruku']['use_tex']
65
- require 'maruku/ext/math'
66
- STDERR.puts "Maruku: Using LaTeX extension. Images in `#{@config['maruku']['png_dir']}`."
59
+ if @config['maruku']['use_divs']
60
+ require 'maruku/ext/div'
61
+ STDERR.puts 'Maruku: Using extended syntax for div elements.'
62
+ end
67
63
 
68
- # Switch off MathML output
69
- MaRuKu::Globals[:html_math_output_mathml] = false
70
- MaRuKu::Globals[:html_math_engine] = 'none'
64
+ if @config['maruku']['use_tex']
65
+ require 'maruku/ext/math'
66
+ STDERR.puts "Maruku: Using LaTeX extension. Images in `#{@config['maruku']['png_dir']}`."
71
67
 
72
- # Turn on math to PNG support with blahtex
73
- # Resulting PNGs stored in `images/latex`
74
- MaRuKu::Globals[:html_math_output_png] = true
75
- MaRuKu::Globals[:html_png_engine] = @config['maruku']['png_engine']
76
- MaRuKu::Globals[:html_png_dir] = @config['maruku']['png_dir']
77
- MaRuKu::Globals[:html_png_url] = @config['maruku']['png_url']
68
+ # Switch off MathML output
69
+ MaRuKu::Globals[:html_math_output_mathml] = false
70
+ MaRuKu::Globals[:html_math_engine] = 'none'
71
+
72
+ # Turn on math to PNG support with blahtex
73
+ # Resulting PNGs stored in `images/latex`
74
+ MaRuKu::Globals[:html_math_output_png] = true
75
+ MaRuKu::Globals[:html_png_engine] = @config['maruku']['png_engine']
76
+ MaRuKu::Globals[:html_png_dir] = @config['maruku']['png_dir']
77
+ MaRuKu::Globals[:html_png_url] = @config['maruku']['png_url']
78
+ end
79
+ rescue LoadError
80
+ STDERR.puts 'You are missing a library required for Markdown. Please run:'
81
+ STDERR.puts ' $ [sudo] gem install maruku'
82
+ raise FatalException.new("Missing dependency: maruku")
78
83
  end
79
- rescue LoadError
80
- STDERR.puts 'You are missing a library required for Markdown. Please run:'
81
- STDERR.puts ' $ [sudo] gem install maruku'
82
- raise FatalException.new("Missing dependency: maruku")
83
- end
84
- else
85
- STDERR.puts "Invalid Markdown processor: #{@config['markdown']}"
86
- STDERR.puts " Valid options are [ maruku | rdiscount | kramdown ]"
87
- raise FatalException.new("Invalid Markdown process: #{@config['markdown']}")
84
+ else
85
+ STDERR.puts "Invalid Markdown processor: #{@config['markdown']}"
86
+ STDERR.puts " Valid options are [ maruku | rdiscount | kramdown ]"
87
+ raise FatalException.new("Invalid Markdown process: #{@config['markdown']}")
88
+ end
89
+ @setup = true
90
+ end
91
+
92
+ def matches(ext)
93
+ rgx = '(' + @config['markdown_ext'].gsub(',','|') +')'
94
+ ext =~ Regexp.new(rgx, Regexp::IGNORECASE)
88
95
  end
89
- @setup = true
90
- end
91
-
92
- def matches(ext)
93
- rgx = '(' + @config['markdown_ext'].gsub(',','|') +')'
94
- ext =~ Regexp.new(rgx, Regexp::IGNORECASE)
95
- end
96
96
 
97
- def output_ext(ext)
98
- ".html"
99
- end
97
+ def output_ext(ext)
98
+ ".html"
99
+ end
100
100
 
101
- def convert(content)
102
- setup
103
- case @config['markdown']
104
- when 'redcarpet'
105
- @redcarpet_extensions[:fenced_code_blocks] = !@redcarpet_extensions[:no_fenced_code_blocks]
106
- @renderer.send :include, Redcarpet::Render::SmartyPants if @redcarpet_extensions[:smart]
107
- markdown = Redcarpet::Markdown.new(@renderer.new(@redcarpet_extensions), @redcarpet_extensions)
108
- markdown.render(content)
109
- when 'kramdown'
110
- # Check for use of coderay
111
- if @config['kramdown']['use_coderay']
112
- Kramdown::Document.new(content, {
113
- :auto_ids => @config['kramdown']['auto_ids'],
114
- :footnote_nr => @config['kramdown']['footnote_nr'],
115
- :entity_output => @config['kramdown']['entity_output'],
116
- :toc_levels => @config['kramdown']['toc_levels'],
117
- :smart_quotes => @config['kramdown']['smart_quotes'],
101
+ def convert(content)
102
+ setup
103
+ case @config['markdown']
104
+ when 'redcarpet'
105
+ @redcarpet_extensions[:fenced_code_blocks] = !@redcarpet_extensions[:no_fenced_code_blocks]
106
+ @renderer.send :include, Redcarpet::Render::SmartyPants if @redcarpet_extensions[:smart]
107
+ markdown = Redcarpet::Markdown.new(@renderer.new(@redcarpet_extensions), @redcarpet_extensions)
108
+ markdown.render(content)
109
+ when 'kramdown'
110
+ # Check for use of coderay
111
+ if @config['kramdown']['use_coderay']
112
+ Kramdown::Document.new(content, {
113
+ :auto_ids => @config['kramdown']['auto_ids'],
114
+ :footnote_nr => @config['kramdown']['footnote_nr'],
115
+ :entity_output => @config['kramdown']['entity_output'],
116
+ :toc_levels => @config['kramdown']['toc_levels'],
117
+ :smart_quotes => @config['kramdown']['smart_quotes'],
118
118
 
119
- :coderay_wrap => @config['kramdown']['coderay']['coderay_wrap'],
120
- :coderay_line_numbers => @config['kramdown']['coderay']['coderay_line_numbers'],
121
- :coderay_line_number_start => @config['kramdown']['coderay']['coderay_line_number_start'],
122
- :coderay_tab_width => @config['kramdown']['coderay']['coderay_tab_width'],
123
- :coderay_bold_every => @config['kramdown']['coderay']['coderay_bold_every'],
124
- :coderay_css => @config['kramdown']['coderay']['coderay_css']
125
- }).to_html
126
- else
127
- # not using coderay
128
- Kramdown::Document.new(content, {
129
- :auto_ids => @config['kramdown']['auto_ids'],
130
- :footnote_nr => @config['kramdown']['footnote_nr'],
131
- :entity_output => @config['kramdown']['entity_output'],
132
- :toc_levels => @config['kramdown']['toc_levels'],
133
- :smart_quotes => @config['kramdown']['smart_quotes']
134
- }).to_html
135
- end
136
- when 'rdiscount'
137
- rd = RDiscount.new(content, *@rdiscount_extensions)
138
- html = rd.to_html
139
- if rd.generate_toc and html.include?(@config['rdiscount']['toc_token'])
140
- html.gsub!(@config['rdiscount']['toc_token'], rd.toc_content)
141
- end
142
- html
143
- when 'maruku'
144
- Maruku.new(content).to_html
119
+ :coderay_wrap => @config['kramdown']['coderay']['coderay_wrap'],
120
+ :coderay_line_numbers => @config['kramdown']['coderay']['coderay_line_numbers'],
121
+ :coderay_line_number_start => @config['kramdown']['coderay']['coderay_line_number_start'],
122
+ :coderay_tab_width => @config['kramdown']['coderay']['coderay_tab_width'],
123
+ :coderay_bold_every => @config['kramdown']['coderay']['coderay_bold_every'],
124
+ :coderay_css => @config['kramdown']['coderay']['coderay_css']
125
+ }).to_html
126
+ else
127
+ # not using coderay
128
+ Kramdown::Document.new(content, {
129
+ :auto_ids => @config['kramdown']['auto_ids'],
130
+ :footnote_nr => @config['kramdown']['footnote_nr'],
131
+ :entity_output => @config['kramdown']['entity_output'],
132
+ :toc_levels => @config['kramdown']['toc_levels'],
133
+ :smart_quotes => @config['kramdown']['smart_quotes']
134
+ }).to_html
135
+ end
136
+ when 'rdiscount'
137
+ rd = RDiscount.new(content, *@rdiscount_extensions)
138
+ html = rd.to_html
139
+ if rd.generate_toc and html.include?(@config['rdiscount']['toc_token'])
140
+ html.gsub!(@config['rdiscount']['toc_token'], rd.toc_content)
141
+ end
142
+ html
143
+ when 'maruku'
144
+ Maruku.new(content).to_html
145
+ end
145
146
  end
146
147
  end
147
148
  end
148
-
149
149
  end
@@ -1,50 +1,50 @@
1
1
  module Jekyll
2
+ module Converters
3
+ class Textile < Converter
4
+ safe true
5
+
6
+ pygments_prefix '<notextile>'
7
+ pygments_suffix '</notextile>'
8
+
9
+ def setup
10
+ return if @setup
11
+ require 'redcloth'
12
+ @setup = true
13
+ rescue LoadError
14
+ STDERR.puts 'You are missing a library required for Textile. Please run:'
15
+ STDERR.puts ' $ [sudo] gem install RedCloth'
16
+ raise FatalException.new("Missing dependency: RedCloth")
17
+ end
2
18
 
3
- class TextileConverter < Converter
4
- safe true
5
-
6
- pygments_prefix '<notextile>'
7
- pygments_suffix '</notextile>'
8
-
9
- def setup
10
- return if @setup
11
- require 'redcloth'
12
- @setup = true
13
- rescue LoadError
14
- STDERR.puts 'You are missing a library required for Textile. Please run:'
15
- STDERR.puts ' $ [sudo] gem install RedCloth'
16
- raise FatalException.new("Missing dependency: RedCloth")
17
- end
19
+ def matches(ext)
20
+ rgx = '(' + @config['textile_ext'].gsub(',','|') +')'
21
+ ext =~ Regexp.new(rgx, Regexp::IGNORECASE)
22
+ end
18
23
 
19
- def matches(ext)
20
- rgx = '(' + @config['textile_ext'].gsub(',','|') +')'
21
- ext =~ Regexp.new(rgx, Regexp::IGNORECASE)
22
- end
24
+ def output_ext(ext)
25
+ ".html"
26
+ end
23
27
 
24
- def output_ext(ext)
25
- ".html"
26
- end
28
+ def convert(content)
29
+ setup
27
30
 
28
- def convert(content)
29
- setup
31
+ # Shortcut if config doesn't contain RedCloth section
32
+ return RedCloth.new(content).to_html if @config['redcloth'].nil?
30
33
 
31
- # Shortcut if config doesn't contain RedCloth section
32
- return RedCloth.new(content).to_html if @config['redcloth'].nil?
34
+ # List of attributes defined on RedCloth
35
+ # (from http://redcloth.rubyforge.org/classes/RedCloth/TextileDoc.html)
36
+ attrs = ['filter_classes', 'filter_html', 'filter_ids', 'filter_styles',
37
+ 'hard_breaks', 'lite_mode', 'no_span_caps', 'sanitize_html']
33
38
 
34
- # List of attributes defined on RedCloth
35
- # (from http://redcloth.rubyforge.org/classes/RedCloth/TextileDoc.html)
36
- attrs = ['filter_classes', 'filter_html', 'filter_ids', 'filter_styles',
37
- 'hard_breaks', 'lite_mode', 'no_span_caps', 'sanitize_html']
39
+ r = RedCloth.new(content)
38
40
 
39
- r = RedCloth.new(content)
41
+ # Set attributes in r if they are NOT nil in the config
42
+ attrs.each do |attr|
43
+ r.instance_variable_set("@#{attr}".to_sym, @config['redcloth'][attr]) unless @config['redcloth'][attr].nil?
44
+ end
40
45
 
41
- # Set attributes in r if they are NOT nil in the config
42
- attrs.each do |attr|
43
- r.instance_variable_set("@#{attr}".to_sym, @config['redcloth'][attr]) unless @config['redcloth'][attr].nil?
46
+ r.to_html
44
47
  end
45
-
46
- r.to_html
47
48
  end
48
49
  end
49
-
50
50
  end
@@ -25,15 +25,17 @@ module Jekyll
25
25
  #
26
26
  # Returns nothing.
27
27
  def read_yaml(base, name)
28
- self.content = File.read(File.join(base, name))
29
-
30
28
  begin
29
+ self.content = File.read(File.join(base, name))
30
+
31
31
  if self.content =~ /\A(---\s*\n.*?\n?)^(---\s*$\n?)/m
32
32
  self.content = $POSTMATCH
33
- self.data = YAML.load($1)
33
+ self.data = YAML.safe_load($1)
34
34
  end
35
35
  rescue => e
36
- puts "YAML Exception reading #{name}: #{e.message}"
36
+ puts "Error reading file #{File.join(base, name)}: #{e.message}"
37
+ rescue SyntaxError => e
38
+ puts "YAML Exception reading #{File.join(base, name)}: #{e.message}"
37
39
  end
38
40
 
39
41
  self.data ||= {}