jekyll 2.2.0 → 2.3.0

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 (306) hide show
  1. checksums.yaml +4 -4
  2. data/README.markdown +1 -1
  3. data/lib/jekyll.rb +0 -1
  4. data/lib/jekyll/collection.rb +18 -3
  5. data/lib/jekyll/command.rb +0 -25
  6. data/lib/jekyll/commands/build.rb +7 -2
  7. data/lib/jekyll/commands/help.rb +33 -0
  8. data/lib/jekyll/configuration.rb +36 -28
  9. data/lib/jekyll/converters/markdown/kramdown_parser.rb +1 -1
  10. data/lib/jekyll/convertible.rb +43 -20
  11. data/lib/jekyll/deprecator.rb +15 -8
  12. data/lib/jekyll/document.rb +21 -4
  13. data/lib/jekyll/filters.rb +27 -1
  14. data/lib/jekyll/frontmatter_defaults.rb +46 -12
  15. data/lib/jekyll/plugin.rb +10 -1
  16. data/lib/jekyll/post.rb +6 -13
  17. data/lib/jekyll/related_posts.rb +2 -2
  18. data/lib/jekyll/renderer.rb +7 -2
  19. data/lib/jekyll/site.rb +5 -7
  20. data/lib/jekyll/static_file.rb +24 -4
  21. data/lib/jekyll/tags/include.rb +3 -1
  22. data/lib/jekyll/tags/post_url.rb +2 -2
  23. data/lib/jekyll/utils.rb +88 -69
  24. data/lib/jekyll/version.rb +1 -1
  25. data/lib/site_template/_config.yml +6 -4
  26. data/lib/site_template/_includes/footer.html +43 -49
  27. data/lib/site_template/_includes/head.html +3 -4
  28. data/lib/site_template/_includes/header.html +9 -10
  29. data/lib/site_template/_layouts/default.html +6 -5
  30. data/lib/site_template/_layouts/page.html +3 -3
  31. data/lib/site_template/_layouts/post.html +4 -4
  32. data/lib/site_template/_posts/0000-00-00-welcome-to-jekyll.markdown.erb +6 -5
  33. data/lib/site_template/_sass/_base.scss +203 -0
  34. data/lib/site_template/_sass/_layout.scss +236 -0
  35. data/lib/site_template/_sass/_syntax-highlighting.scss +67 -0
  36. data/lib/site_template/css/main.scss +49 -0
  37. data/lib/site_template/feed.xml +1 -1
  38. data/lib/site_template/index.html +7 -4
  39. metadata +24 -431
  40. data/.gitignore +0 -15
  41. data/.travis.yml +0 -27
  42. data/CONTRIBUTING.markdown +0 -91
  43. data/Gemfile +0 -2
  44. data/History.markdown +0 -1310
  45. data/Rakefile +0 -268
  46. data/cucumber.yml +0 -3
  47. data/docs/jp/CONTRIBUTING.jp.markdown +0 -93
  48. data/docs/jp/README.jp.markdown +0 -68
  49. data/features/collections.feature +0 -145
  50. data/features/create_sites.feature +0 -158
  51. data/features/data.feature +0 -105
  52. data/features/drafts.feature +0 -46
  53. data/features/embed_filters.feature +0 -107
  54. data/features/frontmatter_defaults.feature +0 -136
  55. data/features/include_tag.feature +0 -68
  56. data/features/markdown.feature +0 -67
  57. data/features/pagination.feature +0 -82
  58. data/features/permalinks.feature +0 -85
  59. data/features/post_data.feature +0 -261
  60. data/features/post_excerpts.feature +0 -50
  61. data/features/rendering.feature +0 -34
  62. data/features/site_configuration.feature +0 -283
  63. data/features/site_data.feature +0 -107
  64. data/features/step_definitions/jekyll_steps.rb +0 -201
  65. data/features/support/env.rb +0 -65
  66. data/jekyll.gemspec +0 -66
  67. data/lib/site_template/css/main.css +0 -410
  68. data/script/bootstrap +0 -4
  69. data/script/branding +0 -11
  70. data/script/cibuild +0 -7
  71. data/script/console +0 -38
  72. data/script/proof +0 -22
  73. data/script/rebund +0 -140
  74. data/script/test +0 -17
  75. data/site/.gitignore +0 -4
  76. data/site/CNAME +0 -1
  77. data/site/README +0 -1
  78. data/site/_config.yml +0 -9
  79. data/site/_data/docs.yml +0 -46
  80. data/site/_includes/analytics.html +0 -30
  81. data/site/_includes/anchor_links.html +0 -32
  82. data/site/_includes/css/font-awesome.css +0 -44
  83. data/site/_includes/css/gridism.css +0 -110
  84. data/site/_includes/css/normalize.css +0 -1
  85. data/site/_includes/css/pygments.css +0 -72
  86. data/site/_includes/css/style.css +0 -1045
  87. data/site/_includes/docs_contents.html +0 -8
  88. data/site/_includes/docs_contents_mobile.html +0 -10
  89. data/site/_includes/docs_option.html +0 -11
  90. data/site/_includes/docs_ul.html +0 -20
  91. data/site/_includes/footer.html +0 -15
  92. data/site/_includes/header.html +0 -18
  93. data/site/_includes/news_contents.html +0 -33
  94. data/site/_includes/news_contents_mobile.html +0 -11
  95. data/site/_includes/news_item.html +0 -24
  96. data/site/_includes/primary-nav-items.html +0 -17
  97. data/site/_includes/section_nav.html +0 -22
  98. data/site/_includes/top.html +0 -17
  99. data/site/_layouts/default.html +0 -13
  100. data/site/_layouts/docs.html +0 -23
  101. data/site/_layouts/news.html +0 -19
  102. data/site/_layouts/news_item.html +0 -27
  103. data/site/_posts/2013-05-06-jekyll-1-0-0-released.markdown +0 -23
  104. data/site/_posts/2013-05-08-jekyll-1-0-1-released.markdown +0 -27
  105. data/site/_posts/2013-05-12-jekyll-1-0-2-released.markdown +0 -28
  106. data/site/_posts/2013-06-07-jekyll-1-0-3-released.markdown +0 -25
  107. data/site/_posts/2013-07-14-jekyll-1-1-0-released.markdown +0 -27
  108. data/site/_posts/2013-07-24-jekyll-1-1-1-released.markdown +0 -31
  109. data/site/_posts/2013-07-25-jekyll-1-0-4-released.markdown +0 -20
  110. data/site/_posts/2013-07-25-jekyll-1-1-2-released.markdown +0 -20
  111. data/site/_posts/2013-09-06-jekyll-1-2-0-released.markdown +0 -23
  112. data/site/_posts/2013-09-14-jekyll-1-2-1-released.markdown +0 -19
  113. data/site/_posts/2013-10-28-jekyll-1-3-0-rc1-released.markdown +0 -19
  114. data/site/_posts/2013-11-04-jekyll-1-3-0-released.markdown +0 -43
  115. data/site/_posts/2013-11-26-jekyll-1-3-1-released.markdown +0 -21
  116. data/site/_posts/2013-12-07-jekyll-1-4-0-released.markdown +0 -30
  117. data/site/_posts/2013-12-09-jekyll-1-4-1-released.markdown +0 -20
  118. data/site/_posts/2013-12-16-jekyll-1-4-2-released.markdown +0 -18
  119. data/site/_posts/2014-01-13-jekyll-1-4-3-released.markdown +0 -26
  120. data/site/_posts/2014-03-24-jekyll-1-5-0-released.markdown +0 -19
  121. data/site/_posts/2014-03-27-jekyll-1-5-1-released.markdown +0 -26
  122. data/site/_posts/2014-05-06-jekyll-turns-2-0-0.markdown +0 -31
  123. data/site/_posts/2014-05-08-jekyll-2-0-3-released.markdown +0 -18
  124. data/site/_posts/2014-06-04-jekyll-stickers-1-dollar-stickermule.markdown +0 -19
  125. data/site/_posts/2014-06-28-jekyll-turns-21-i-mean-2-1-0.markdown +0 -31
  126. data/site/_posts/2014-07-01-jekyll-2-1-1-released.markdown +0 -30
  127. data/site/_posts/2014-07-29-jekyll-2-2-0-released.markdown +0 -19
  128. data/site/css/screen.css +0 -31
  129. data/site/docs/assets.md +0 -66
  130. data/site/docs/collections.md +0 -259
  131. data/site/docs/configuration.md +0 -536
  132. data/site/docs/continuous-integration.md +0 -177
  133. data/site/docs/contributing.md +0 -133
  134. data/site/docs/datafiles.md +0 -108
  135. data/site/docs/deployment-methods.md +0 -127
  136. data/site/docs/drafts.md +0 -21
  137. data/site/docs/extras.md +0 -18
  138. data/site/docs/frontmatter.md +0 -191
  139. data/site/docs/github-pages.md +0 -91
  140. data/site/docs/history.md +0 -1514
  141. data/site/docs/index.md +0 -58
  142. data/site/docs/installation.md +0 -106
  143. data/site/docs/migrations.md +0 -11
  144. data/site/docs/pages.md +0 -86
  145. data/site/docs/pagination.md +0 -212
  146. data/site/docs/permalinks.md +0 -188
  147. data/site/docs/plugins.md +0 -561
  148. data/site/docs/posts.md +0 -211
  149. data/site/docs/quickstart.md +0 -26
  150. data/site/docs/resources.md +0 -43
  151. data/site/docs/sites.md +0 -29
  152. data/site/docs/structure.md +0 -190
  153. data/site/docs/templates.md +0 -376
  154. data/site/docs/troubleshooting.md +0 -147
  155. data/site/docs/upgrading.md +0 -146
  156. data/site/docs/usage.md +0 -74
  157. data/site/docs/variables.md +0 -382
  158. data/site/docs/windows.md +0 -44
  159. data/site/favicon.ico +0 -0
  160. data/site/feed.xml +0 -48
  161. data/site/fonts/FontAwesome.otf +0 -0
  162. data/site/fonts/fontawesome-webfont.eot +0 -0
  163. data/site/fonts/fontawesome-webfont.svg +0 -504
  164. data/site/fonts/fontawesome-webfont.ttf +0 -0
  165. data/site/fonts/fontawesome-webfont.woff +0 -0
  166. data/site/freenode.txt +0 -1
  167. data/site/img/article-footer.png +0 -0
  168. data/site/img/footer-arrow.png +0 -0
  169. data/site/img/footer-logo.png +0 -0
  170. data/site/img/jekyll-sticker.jpg +0 -0
  171. data/site/img/logo-2x.png +0 -0
  172. data/site/img/logo-rss.png +0 -0
  173. data/site/img/octojekyll.png +0 -0
  174. data/site/index.html +0 -90
  175. data/site/js/html5shiv.min.js +0 -4
  176. data/site/js/respond.min.js +0 -5
  177. data/site/news/index.html +0 -10
  178. data/site/news/releases/index.html +0 -10
  179. data/test/fixtures/broken_front_matter1.erb +0 -5
  180. data/test/fixtures/broken_front_matter2.erb +0 -4
  181. data/test/fixtures/broken_front_matter3.erb +0 -7
  182. data/test/fixtures/exploit_front_matter.erb +0 -4
  183. data/test/fixtures/front_matter.erb +0 -4
  184. data/test/helper.rb +0 -80
  185. data/test/source/+/%# +.md +0 -6
  186. data/test/source/+/foo.md +0 -7
  187. data/test/source/.htaccess +0 -8
  188. data/test/source/_config.dev.toml +0 -2
  189. data/test/source/_data/categories/dairy.yaml +0 -6
  190. data/test/source/_data/languages.yml +0 -2
  191. data/test/source/_data/members.json +0 -12
  192. data/test/source/_data/members.yaml +0 -7
  193. data/test/source/_data/products.yml +0 -4
  194. data/test/source/_drafts/draft-properties.text +0 -11
  195. data/test/source/_includes/include.html +0 -1
  196. data/test/source/_includes/params.html +0 -7
  197. data/test/source/_includes/sig.markdown +0 -3
  198. data/test/source/_layouts/default.html +0 -27
  199. data/test/source/_layouts/post/simple.html +0 -1
  200. data/test/source/_layouts/simple.html +0 -1
  201. data/test/source/_methods/_do_not_read_me.md +0 -5
  202. data/test/source/_methods/configuration.md +0 -8
  203. data/test/source/_methods/sanitized_path.md +0 -5
  204. data/test/source/_methods/site/_dont_include_me_either.md +0 -5
  205. data/test/source/_methods/site/generate.md +0 -6
  206. data/test/source/_methods/site/initialize.md +0 -4
  207. data/test/source/_methods/um_hi.md +0 -6
  208. data/test/source/_plugins/dummy.rb +0 -8
  209. data/test/source/_posts/2008-02-02-not-published.textile +0 -8
  210. data/test/source/_posts/2008-02-02-published.textile +0 -8
  211. data/test/source/_posts/2008-10-18-foo-bar.textile +0 -8
  212. data/test/source/_posts/2008-11-21-complex.textile +0 -8
  213. data/test/source/_posts/2008-12-03-permalinked-post.textile +0 -9
  214. data/test/source/_posts/2008-12-13-include.markdown +0 -8
  215. data/test/source/_posts/2009-01-27-array-categories.textile +0 -10
  216. data/test/source/_posts/2009-01-27-categories.textile +0 -7
  217. data/test/source/_posts/2009-01-27-category.textile +0 -7
  218. data/test/source/_posts/2009-01-27-empty-categories.textile +0 -7
  219. data/test/source/_posts/2009-01-27-empty-category.textile +0 -7
  220. data/test/source/_posts/2009-01-27-no-category.textile +0 -6
  221. data/test/source/_posts/2009-03-12-hash-#1.markdown +0 -6
  222. data/test/source/_posts/2009-05-18-empty-tag.textile +0 -6
  223. data/test/source/_posts/2009-05-18-empty-tags.textile +0 -6
  224. data/test/source/_posts/2009-05-18-tag.textile +0 -6
  225. data/test/source/_posts/2009-05-18-tags.textile +0 -9
  226. data/test/source/_posts/2009-06-22-empty-yaml.textile +0 -3
  227. data/test/source/_posts/2009-06-22-no-yaml.textile +0 -1
  228. data/test/source/_posts/2010-01-08-triple-dash.markdown +0 -5
  229. data/test/source/_posts/2010-01-09-date-override.textile +0 -7
  230. data/test/source/_posts/2010-01-09-time-override.textile +0 -7
  231. data/test/source/_posts/2010-01-09-timezone-override.textile +0 -7
  232. data/test/source/_posts/2010-01-16-override-data.textile +0 -4
  233. data/test/source/_posts/2011-04-12-md-extension.md +0 -7
  234. data/test/source/_posts/2011-04-12-text-extension.text +0 -0
  235. data/test/source/_posts/2013-01-02-post-excerpt.markdown +0 -14
  236. data/test/source/_posts/2013-01-12-nil-layout.textile +0 -6
  237. data/test/source/_posts/2013-01-12-no-layout.textile +0 -5
  238. data/test/source/_posts/2013-03-19-not-a-post.markdown/.gitkeep +0 -0
  239. data/test/source/_posts/2013-04-11-custom-excerpt.markdown +0 -10
  240. data/test/source/_posts/2013-05-10-number-category.textile +0 -7
  241. data/test/source/_posts/2013-07-22-post-excerpt-with-layout.markdown +0 -23
  242. data/test/source/_posts/2013-08-01-mkdn-extension.mkdn +0 -0
  243. data/test/source/_posts/2013-12-17-include-variable-filters.markdown +0 -21
  244. data/test/source/_posts/2013-12-20-properties.text +0 -11
  245. data/test/source/_posts/2014-01-06-permalink-traversal.md +0 -5
  246. data/test/source/_posts/2014-03-03-yaml-with-dots.md +0 -5
  247. data/test/source/_posts/2014-03-22-escape-+ %20[].markdown +0 -6
  248. data/test/source/_posts/es/2008-11-21-nested.textile +0 -8
  249. data/test/source/_sass/_grid.scss +0 -1
  250. data/test/source/_slides/example-slide-1.html +0 -4
  251. data/test/source/_slides/example-slide-2.html +0 -7
  252. data/test/source/_slides/example-slide-3.html +0 -5
  253. data/test/source/_with.dots/all.dots/2.4.0.md +0 -5
  254. data/test/source/_with.dots/file.with.dots.md +0 -0
  255. data/test/source/about.html +0 -6
  256. data/test/source/category/_posts/2008-9-23-categories.textile +0 -6
  257. data/test/source/contacts.html +0 -5
  258. data/test/source/contacts/bar.html +0 -5
  259. data/test/source/contacts/index.html +0 -5
  260. data/test/source/css/main.scss +0 -4
  261. data/test/source/css/screen.css +0 -76
  262. data/test/source/deal.with.dots.html +0 -7
  263. data/test/source/environment.html +0 -5
  264. data/test/source/exploit.md +0 -5
  265. data/test/source/foo/_posts/bar/2008-12-12-topical-post.textile +0 -8
  266. data/test/source/index.html +0 -22
  267. data/test/source/js/coffeescript.coffee +0 -10
  268. data/test/source/pgp.key +0 -2
  269. data/test/source/products.yml +0 -4
  270. data/test/source/properties.html +0 -8
  271. data/test/source/sitemap.xml +0 -32
  272. data/test/source/static_files.html +0 -4
  273. data/test/source/symlink-test/symlinked-file +0 -22
  274. data/test/source/unpublished.html +0 -7
  275. data/test/source/win/_posts/2009-05-24-yaml-linebreak.markdown +0 -7
  276. data/test/source/z_category/_posts/2008-9-23-categories.textile +0 -6
  277. data/test/suite.rb +0 -11
  278. data/test/test_cleaner.rb +0 -77
  279. data/test/test_coffeescript.rb +0 -49
  280. data/test/test_collections.rb +0 -224
  281. data/test/test_command.rb +0 -53
  282. data/test/test_configuration.rb +0 -201
  283. data/test/test_convertible.rb +0 -49
  284. data/test/test_document.rb +0 -193
  285. data/test/test_draft.rb +0 -56
  286. data/test/test_entry_filter.rb +0 -124
  287. data/test/test_excerpt.rb +0 -131
  288. data/test/test_filters.rb +0 -207
  289. data/test/test_generated_site.rb +0 -97
  290. data/test/test_kramdown.rb +0 -62
  291. data/test/test_layout_reader.rb +0 -34
  292. data/test/test_liquid_extensions.rb +0 -31
  293. data/test/test_log_adapter.rb +0 -59
  294. data/test/test_new_command.rb +0 -104
  295. data/test/test_page.rb +0 -254
  296. data/test/test_path_sanitization.rb +0 -18
  297. data/test/test_post.rb +0 -741
  298. data/test/test_rdiscount.rb +0 -22
  299. data/test/test_redcarpet.rb +0 -77
  300. data/test/test_redcloth.rb +0 -86
  301. data/test/test_related_posts.rb +0 -47
  302. data/test/test_sass.rb +0 -26
  303. data/test/test_site.rb +0 -452
  304. data/test/test_tags.rb +0 -509
  305. data/test/test_url.rb +0 -28
  306. data/test/test_utils.rb +0 -67
@@ -1,18 +0,0 @@
1
- require 'helper'
2
-
3
- class TestPathSanitization < Test::Unit::TestCase
4
- context "on Windows with absolute source" do
5
- setup do
6
- @source = "C:/Users/xmr/Desktop/mpc-hc.org"
7
- @dest = "./_site/"
8
- stub(Dir).pwd { "C:/Users/xmr/Desktop/mpc-hc.org" }
9
- end
10
- should "strip drive name from path" do
11
- assert_equal "C:/Users/xmr/Desktop/mpc-hc.org/_site", Jekyll.sanitized_path(@source, @dest)
12
- end
13
-
14
- should "strip just the initial drive name" do
15
- assert_equal "/tmp/foobar/jail/..c:/..c:/..c:/etc/passwd", Jekyll.sanitized_path("/tmp/foobar/jail", "..c:/..c:/..c:/etc/passwd")
16
- end
17
- end
18
- end
@@ -1,741 +0,0 @@
1
- # encoding: utf-8
2
-
3
- require 'helper'
4
-
5
- class TestPost < Test::Unit::TestCase
6
- def setup_post(file)
7
- Post.new(@site, source_dir, '', file)
8
- end
9
-
10
- def do_render(post)
11
- layouts = { "default" => Layout.new(@site, source_dir('_layouts'), "simple.html")}
12
- post.render(layouts, {"site" => {"posts" => []}})
13
- end
14
-
15
- context "A Post" do
16
- setup do
17
- clear_dest
18
- stub(Jekyll).configuration { Jekyll::Configuration::DEFAULTS }
19
- @site = Site.new(Jekyll.configuration)
20
- end
21
-
22
- should "ensure valid posts are valid" do
23
- assert Post.valid?("2008-09-09-foo-bar.textile")
24
- assert Post.valid?("foo/bar/2008-09-09-foo-bar.textile")
25
-
26
- assert !Post.valid?("lol2008-09-09-foo-bar.textile")
27
- assert !Post.valid?("blah")
28
- end
29
-
30
- should "make properties accessible through #[]" do
31
- post = setup_post('2013-12-20-properties.text')
32
-
33
- attrs = {
34
- categories: %w(foo bar baz),
35
- content: "All the properties.\n\nPlus an excerpt.\n",
36
- date: Time.new(2013, 12, 20),
37
- dir: "/foo/bar/baz/2013/12/20",
38
- excerpt: "All the properties.\n\n",
39
- foo: 'bar',
40
- id: "/foo/bar/baz/2013/12/20/properties",
41
- layout: 'default',
42
- name: nil,
43
- path: "_posts/2013-12-20-properties.text",
44
- permalink: nil,
45
- published: nil,
46
- tags: %w(ay bee cee),
47
- title: 'Properties Post',
48
- url: "/foo/bar/baz/2013/12/20/properties.html"
49
- }
50
-
51
- attrs.each do |attr, val|
52
- attr_str = attr.to_s
53
- result = post[attr_str]
54
- assert_equal val, result, "For <post[\"#{attr_str}\"]>:"
55
- end
56
- end
57
-
58
- context "processing posts" do
59
- setup do
60
- @post = Post.allocate
61
- @post.site = @site
62
-
63
- @real_file = "2008-10-18-foo-bar.textile"
64
- @fake_file = "2008-09-09-foo-bar.textile"
65
- @source = source_dir('_posts')
66
- end
67
-
68
- should "keep date, title, and markup type" do
69
- @post.categories = []
70
- @post.process(@fake_file)
71
-
72
- assert_equal Time.parse("2008-09-09"), @post.date
73
- assert_equal "foo-bar", @post.slug
74
- assert_equal ".textile", @post.ext
75
- assert_equal "/2008/09/09", @post.dir
76
- assert_equal "/2008/09/09/foo-bar", @post.id
77
- end
78
-
79
- should "keep categories" do
80
- post = Post.allocate
81
- post.site = @site
82
- post.process("cat1/2008-09-09-foo-bar.textile")
83
- assert_equal 1, post.categories.size
84
- assert_equal "cat1", post.categories[0]
85
-
86
- post = Post.allocate
87
- post.site = @site
88
- post.process("cat2/CAT3/2008-09-09-foo-bar.textile")
89
- assert_equal 2, post.categories.size
90
- assert_equal "cat2", post.categories[0]
91
- assert_equal "cat3", post.categories[1]
92
- end
93
-
94
- should "create url based on date and title" do
95
- @post.categories = []
96
- @post.process(@fake_file)
97
- assert_equal "/2008/09/09/foo-bar.html", @post.url
98
- end
99
-
100
- should "raise a good error on invalid post date" do
101
- assert_raise Jekyll::Errors::FatalException do
102
- @post.process("2009-27-03-foo-bar.textile")
103
- end
104
- end
105
-
106
- should "escape urls" do
107
- @post.categories = []
108
- @post.process("2009-03-12-hash-#1.markdown")
109
- assert_equal "/2009/03/12/hash-%231.html", @post.url
110
- assert_equal "/2009/03/12/hash-#1", @post.id
111
- end
112
-
113
- should "escape urls with non-alphabetic characters" do
114
- @post.categories = []
115
- @post.process("2014-03-22-escape-+ %20[].markdown")
116
- assert_equal "/2014/03/22/escape-+%20%2520%5B%5D.html", @post.url
117
- assert_equal "/2014/03/22/escape-+ %20[]", @post.id
118
- end
119
-
120
- should "return a UTF-8 escaped string" do
121
- assert_equal Encoding::UTF_8, URL.escape_path("/rails笔记/2014/04/20/escaped/").encoding
122
- end
123
-
124
- should "return a UTF-8 unescaped string" do
125
- assert_equal Encoding::UTF_8, URL.unescape_path("/rails%E7%AC%94%E8%AE%B0/2014/04/20/escaped/".encode(Encoding::ASCII)).encoding
126
- end
127
-
128
- should "respect permalink in yaml front matter" do
129
- file = "2008-12-03-permalinked-post.textile"
130
- @post.process(file)
131
- @post.read_yaml(@source, file)
132
-
133
- assert_equal "my_category/permalinked-post", @post.permalink
134
- assert_equal "/my_category", @post.dir
135
- assert_equal "/my_category/permalinked-post", @post.url
136
- end
137
-
138
- should "not be writable outside of destination" do
139
- unexpected = File.expand_path("../../../baddie.html", dest_dir)
140
- File.delete unexpected if File.exist?(unexpected)
141
- post = setup_post("2014-01-06-permalink-traversal.md")
142
- do_render(post)
143
- post.write(dest_dir)
144
-
145
- assert !File.exist?(unexpected)
146
- assert File.exist?(File.expand_path("baddie.html", dest_dir))
147
- end
148
-
149
- context "with CRLF linebreaks" do
150
- setup do
151
- @real_file = "2009-05-24-yaml-linebreak.markdown"
152
- @source = source_dir('win/_posts')
153
- end
154
- should "read yaml front-matter" do
155
- @post.read_yaml(@source, @real_file)
156
-
157
- assert_equal({"title" => "Test title", "layout" => "post", "tag" => "Ruby"}, @post.data)
158
- assert_equal "This is the content", @post.content
159
- end
160
- end
161
-
162
- context "with three dots ending YAML header" do
163
- setup do
164
- @real_file = "2014-03-03-yaml-with-dots.md"
165
- end
166
- should "should read the YAML header" do
167
- @post.read_yaml(@source, @real_file)
168
-
169
- assert_equal({"title" => "Test Post Where YAML Ends in Dots"},
170
- @post.data)
171
- end
172
- end
173
-
174
- context "with embedded triple dash" do
175
- setup do
176
- @real_file = "2010-01-08-triple-dash.markdown"
177
- end
178
- should "consume the embedded dashes" do
179
- @post.read_yaml(@source, @real_file)
180
-
181
- assert_equal({"title" => "Foo --- Bar"}, @post.data)
182
- assert_equal "Triple the fun!", @post.content
183
- end
184
- end
185
-
186
- context "with site wide permalink" do
187
- setup do
188
- @post.categories = []
189
- end
190
-
191
- context "with unspecified (date) style" do
192
- setup do
193
- @post.process(@fake_file)
194
- end
195
-
196
- should "process the url correctly" do
197
- assert_equal "/:categories/:year/:month/:day/:title.html", @post.template
198
- assert_equal "/2008/09/09/foo-bar.html", @post.url
199
- end
200
- end
201
-
202
- context "with unspecified (date) style and a category" do
203
- setup do
204
- @post.categories << "beer"
205
- @post.process(@fake_file)
206
- end
207
-
208
- should "process the url correctly" do
209
- assert_equal "/:categories/:year/:month/:day/:title.html", @post.template
210
- assert_equal "/beer/2008/09/09/foo-bar.html", @post.url
211
- end
212
- end
213
-
214
- context "with unspecified (date) style and a numeric category" do
215
- setup do
216
- @post.categories << 2013
217
- @post.process(@fake_file)
218
- end
219
-
220
- should "process the url correctly" do
221
- assert_equal "/:categories/:year/:month/:day/:title.html", @post.template
222
- assert_equal "/2013/2008/09/09/foo-bar.html", @post.url
223
- end
224
- end
225
-
226
- context "with specified layout of nil" do
227
- setup do
228
- file = '2013-01-12-nil-layout.textile'
229
- @post = setup_post(file)
230
- @post.process(file)
231
- end
232
-
233
- should "layout of nil is respected" do
234
- assert_equal "nil", @post.data["layout"]
235
- end
236
- end
237
-
238
- context "with unspecified (date) style and categories" do
239
- setup do
240
- @post.categories << "food"
241
- @post.categories << "beer"
242
- @post.process(@fake_file)
243
- end
244
-
245
- should "process the url correctly" do
246
- assert_equal "/:categories/:year/:month/:day/:title.html", @post.template
247
- assert_equal "/food/beer/2008/09/09/foo-bar.html", @post.url
248
- end
249
- end
250
-
251
- context "with space (categories)" do
252
- setup do
253
- @post.categories << "French cuisine"
254
- @post.categories << "Belgian beer"
255
- @post.process(@fake_file)
256
- end
257
-
258
- should "process the url correctly" do
259
- assert_equal "/:categories/:year/:month/:day/:title.html", @post.template
260
- assert_equal "/French%20cuisine/Belgian%20beer/2008/09/09/foo-bar.html", @post.url
261
- end
262
- end
263
-
264
- context "with none style" do
265
- setup do
266
- @post.site.permalink_style = :none
267
- @post.process(@fake_file)
268
- end
269
-
270
- should "process the url correctly" do
271
- assert_equal "/:categories/:title.html", @post.template
272
- assert_equal "/foo-bar.html", @post.url
273
- end
274
- end
275
-
276
- context "with pretty style" do
277
- setup do
278
- @post.site.permalink_style = :pretty
279
- @post.process(@fake_file)
280
- end
281
-
282
- should "process the url correctly" do
283
- assert_equal "/:categories/:year/:month/:day/:title/", @post.template
284
- assert_equal "/2008/09/09/foo-bar/", @post.url
285
- end
286
- end
287
-
288
- context "with ordinal style" do
289
- setup do
290
- @post.site.permalink_style = :ordinal
291
- @post.process(@fake_file)
292
- end
293
-
294
- should "process the url correctly" do
295
- assert_equal "/:categories/:year/:y_day/:title.html", @post.template
296
- assert_equal "/2008/253/foo-bar.html", @post.url
297
- end
298
- end
299
-
300
- context "with custom date permalink" do
301
- setup do
302
- @post.site.permalink_style = '/:categories/:year/:i_month/:i_day/:title/'
303
- @post.process(@fake_file)
304
- end
305
-
306
- should "process the url correctly" do
307
- assert_equal "/2008/9/9/foo-bar/", @post.url
308
- end
309
- end
310
-
311
- context "with custom abbreviated month date permalink" do
312
- setup do
313
- @post.site.permalink_style = '/:categories/:year/:short_month/:day/:title/'
314
- @post.process(@fake_file)
315
- end
316
-
317
- should "process the url correctly" do
318
- assert_equal "/2008/Sep/09/foo-bar/", @post.url
319
- end
320
- end
321
-
322
- context "with prefix style and no extension" do
323
- setup do
324
- @post.site.permalink_style = "/prefix/:title"
325
- @post.process(@fake_file)
326
- end
327
-
328
- should "process the url correctly" do
329
- assert_equal "/prefix/:title", @post.template
330
- assert_equal "/prefix/foo-bar", @post.url
331
- end
332
- end
333
- end
334
-
335
- should "read yaml front-matter" do
336
- @post.read_yaml(@source, @real_file)
337
-
338
- assert_equal({"title" => "Foo Bar", "layout" => "default"}, @post.data)
339
- assert_equal "h1. {{ page.title }}\n\nBest *post* ever", @post.content
340
- end
341
-
342
- should "transform textile" do
343
- @post.process(@real_file)
344
- @post.read_yaml(@source, @real_file)
345
- @post.transform
346
-
347
- assert_equal "<h1>{{ page.title }}</h1>\n<p>Best <strong>post</strong> ever</p>", @post.content
348
- end
349
-
350
- context "#excerpt" do
351
- setup do
352
- file = "2013-01-02-post-excerpt.markdown"
353
- @post = setup_post(file)
354
- @post.process(file)
355
- @post.read_yaml(@source, file)
356
- do_render(@post)
357
- end
358
-
359
- should "return first paragraph by default" do
360
- assert @post.excerpt.include?("First paragraph"), "contains first paragraph"
361
- assert !@post.excerpt.include?("Second paragraph"), "does not contains second paragraph"
362
- assert !@post.excerpt.include?("Third paragraph"), "does not contains third paragraph"
363
- end
364
-
365
- should "correctly resolve link references" do
366
- assert @post.excerpt.include?("www.jekyllrb.com"), "contains referenced link URL"
367
- end
368
-
369
- should "return rendered HTML" do
370
- assert_equal "<p>First paragraph with <a href=\"http://www.jekyllrb.com/\">link ref</a>.</p>\n\n",
371
- @post.excerpt
372
- end
373
-
374
- context "with excerpt_separator setting" do
375
- setup do
376
- file = "2013-01-02-post-excerpt.markdown"
377
-
378
- @post.site.config['excerpt_separator'] = "\n---\n"
379
-
380
- @post.process(file)
381
- @post.read_yaml(@source, file)
382
- @post.transform
383
- end
384
-
385
- should "respect given separator" do
386
- assert @post.excerpt.include?("First paragraph"), "contains first paragraph"
387
- assert @post.excerpt.include?("Second paragraph"), "contains second paragraph"
388
- assert !@post.excerpt.include?("Third paragraph"), "does not contains third paragraph"
389
- end
390
-
391
- should "replace separator with new-lines" do
392
- assert !@post.excerpt.include?("---"), "does not contains separator"
393
- end
394
- end
395
-
396
- context "with custom excerpt" do
397
- setup do
398
- file = "2013-04-11-custom-excerpt.markdown"
399
- @post = setup_post(file)
400
- do_render(@post)
401
- end
402
-
403
- should "use custom excerpt" do
404
- assert_equal("I can set a custom excerpt", @post.excerpt)
405
- end
406
-
407
- should "expose custom excerpt to liquid" do
408
- assert @post.content.include?("I can use the excerpt: <quote>I can set a custom excerpt</quote>"), "Exposes incorrect excerpt to liquid."
409
- end
410
-
411
- end
412
-
413
- end
414
- end
415
-
416
- context "when in a site" do
417
- setup do
418
- clear_dest
419
- stub(Jekyll).configuration { Jekyll::Configuration::DEFAULTS }
420
- @site = Site.new(Jekyll.configuration)
421
- @site.posts = [setup_post('2008-02-02-published.textile'),
422
- setup_post('2009-01-27-categories.textile')]
423
- end
424
-
425
- should "have next post" do
426
- assert_equal(@site.posts.last, @site.posts.first.next)
427
- end
428
-
429
- should "have previous post" do
430
- assert_equal(@site.posts.first, @site.posts.last.previous)
431
- end
432
-
433
- should "not have previous post if first" do
434
- assert_equal(nil, @site.posts.first.previous)
435
- end
436
-
437
- should "not have next post if last" do
438
- assert_equal(nil, @site.posts.last.next)
439
- end
440
- end
441
-
442
- context "initializing posts" do
443
- should "recognize date in yaml" do
444
- post = setup_post("2010-01-09-date-override.textile")
445
- do_render(post)
446
- assert_equal Time, post.date.class
447
- assert_equal Time, post.to_liquid["date"].class
448
- assert_equal "/2010/01/10/date-override.html", post.url
449
- assert_equal "<p>Post with a front matter date</p>\n<p>10 Jan 2010</p>", post.output
450
- end
451
-
452
- should "recognize time in yaml" do
453
- post = setup_post("2010-01-09-time-override.textile")
454
- do_render(post)
455
- assert_equal Time, post.date.class
456
- assert_equal Time, post.to_liquid["date"].class
457
- assert_equal "/2010/01/10/time-override.html", post.url
458
- assert_equal "<p>Post with a front matter time</p>\n<p>10 Jan 2010</p>", post.output
459
- end
460
-
461
- should "recognize time with timezone in yaml" do
462
- post = setup_post("2010-01-09-timezone-override.textile")
463
- do_render(post)
464
- assert_equal Time, post.date.class
465
- assert_equal Time, post.to_liquid["date"].class
466
- assert_equal "/2010/01/10/timezone-override.html", post.url
467
- assert_equal "<p>Post with a front matter time with timezone</p>\n<p>10 Jan 2010</p>", post.output
468
- end
469
-
470
- should "to_liquid prioritizes post attributes over data" do
471
- post = setup_post("2010-01-16-override-data.textile")
472
- assert_equal Array, post.tags.class
473
- assert_equal Array, post.to_liquid["tags"].class
474
- assert_equal Time, post.date.class
475
- assert_equal Time, post.to_liquid["date"].class
476
- end
477
-
478
- should "to_liquid should consider inheritance" do
479
- klass = Class.new(Jekyll::Post)
480
- assert_gets_called = false
481
- klass.send(:define_method, :assert_gets_called) { assert_gets_called = true }
482
- klass.const_set(:EXCERPT_ATTRIBUTES_FOR_LIQUID, Jekyll::Post::EXCERPT_ATTRIBUTES_FOR_LIQUID + ['assert_gets_called'])
483
- post = klass.new(@site, source_dir, '', "2008-02-02-published.textile")
484
- do_render(post)
485
-
486
- assert assert_gets_called, 'assert_gets_called did not get called on post.'
487
- end
488
-
489
- should "recognize category in yaml" do
490
- post = setup_post("2009-01-27-category.textile")
491
- assert post.categories.include?('foo')
492
- end
493
-
494
- should "recognize several categories in yaml" do
495
- post = setup_post("2009-01-27-categories.textile")
496
- assert post.categories.include?('foo')
497
- assert post.categories.include?('bar')
498
- assert post.categories.include?('baz')
499
- end
500
-
501
- should "recognize empty category in yaml" do
502
- post = setup_post("2009-01-27-empty-category.textile")
503
- assert_equal [], post.categories
504
- end
505
-
506
- should "recognize empty categories in yaml" do
507
- post = setup_post("2009-01-27-empty-categories.textile")
508
- assert_equal [], post.categories
509
- end
510
-
511
- should "recognize number category in yaml" do
512
- post = setup_post("2013-05-10-number-category.textile")
513
- assert post.categories.include?('2013')
514
- assert !post.categories.include?(2013)
515
- end
516
-
517
- should "recognize tag in yaml" do
518
- post = setup_post("2009-05-18-tag.textile")
519
- assert post.tags.include?('code')
520
- end
521
-
522
- should "recognize tags in yaml" do
523
- post = setup_post("2009-05-18-tags.textile")
524
- assert post.tags.include?('food')
525
- assert post.tags.include?('cooking')
526
- assert post.tags.include?('pizza')
527
- end
528
-
529
- should "recognize empty tag in yaml" do
530
- post = setup_post("2009-05-18-empty-tag.textile")
531
- assert_equal [], post.tags
532
- end
533
-
534
- should "recognize empty tags in yaml" do
535
- post = setup_post("2009-05-18-empty-tags.textile")
536
- assert_equal [], post.tags
537
- end
538
-
539
- should "allow no yaml" do
540
- post = setup_post("2009-06-22-no-yaml.textile")
541
- assert_equal "No YAML.", post.content
542
- end
543
-
544
- should "allow empty yaml" do
545
- post = setup_post("2009-06-22-empty-yaml.textile")
546
- assert_equal "Empty YAML.", post.content
547
- end
548
-
549
- context "rendering" do
550
- setup do
551
- clear_dest
552
- end
553
-
554
- should "render properly" do
555
- post = setup_post("2008-10-18-foo-bar.textile")
556
- do_render(post)
557
- assert_equal "<<< <h1>Foo Bar</h1>\n<p>Best <strong>post</strong> ever</p> >>>", post.output
558
- end
559
-
560
- should "write properly" do
561
- post = setup_post("2008-10-18-foo-bar.textile")
562
- do_render(post)
563
- post.write(dest_dir)
564
-
565
- assert File.directory?(dest_dir)
566
- assert File.exist?(File.join(dest_dir, '2008', '10', '18', 'foo-bar.html'))
567
- end
568
-
569
- should "write properly when url has hash" do
570
- post = setup_post("2009-03-12-hash-#1.markdown")
571
- do_render(post)
572
- post.write(dest_dir)
573
-
574
- assert File.directory?(dest_dir)
575
- assert File.exist?(File.join(dest_dir, '2009', '03', '12',
576
- 'hash-#1.html'))
577
- end
578
-
579
- should "write properly when url has space" do
580
- post = setup_post("2014-03-22-escape-+ %20[].markdown")
581
- do_render(post)
582
- post.write(dest_dir)
583
-
584
- assert File.directory?(dest_dir)
585
- assert File.exist?(File.join(dest_dir, '2014', '03', '22',
586
- 'escape-+ %20[].html'))
587
- end
588
-
589
- should "write properly without html extension" do
590
- post = setup_post("2008-10-18-foo-bar.textile")
591
- post.site.permalink_style = ":title"
592
- do_render(post)
593
- post.write(dest_dir)
594
-
595
- assert File.directory?(dest_dir)
596
- assert File.exist?(File.join(dest_dir, 'foo-bar', 'index.html'))
597
- end
598
-
599
- should "insert data" do
600
- post = setup_post("2008-11-21-complex.textile")
601
- do_render(post)
602
-
603
- assert_equal "<<< <p>url: /2008/11/21/complex.html<br />\ndate: #{Time.parse("2008-11-21")}<br />\nid: /2008/11/21/complex</p> >>>", post.output
604
- end
605
-
606
- should "include templates" do
607
- post = setup_post("2008-12-13-include.markdown")
608
- post.site.source = File.join(File.dirname(__FILE__), 'source')
609
- do_render(post)
610
-
611
- assert_equal "<<< <hr />\n<p>Tom Preston-Werner\ngithub.com/mojombo</p>\n\n<p>This <em>is</em> cool</p>\n >>>", post.output
612
- end
613
-
614
- should "render date specified in front matter properly" do
615
- post = setup_post("2010-01-09-date-override.textile")
616
- do_render(post)
617
-
618
- assert_equal "<p>Post with a front matter date</p>\n<p>10 Jan 2010</p>", post.output
619
- end
620
-
621
- should "render time specified in front matter properly" do
622
- post = setup_post("2010-01-09-time-override.textile")
623
- do_render(post)
624
-
625
- assert_equal "<p>Post with a front matter time</p>\n<p>10 Jan 2010</p>", post.output
626
- end
627
-
628
- end
629
- end
630
-
631
- should "generate categories and topics" do
632
- post = Post.new(@site, File.join(File.dirname(__FILE__), *%w[source]), 'foo', 'bar/2008-12-12-topical-post.textile')
633
- assert_equal ['foo', 'bar'], post.categories
634
- end
635
- end
636
-
637
- context "converter file extension settings" do
638
- setup do
639
- stub(Jekyll).configuration { Jekyll::Configuration::DEFAULTS }
640
- @site = Site.new(Jekyll.configuration)
641
- end
642
-
643
- should "process .md as markdown under default configuration" do
644
- post = setup_post '2011-04-12-md-extension.md'
645
- conv = post.converter
646
- assert conv.kind_of? Jekyll::Converters::Markdown
647
- end
648
-
649
- should "process .text as identity under default configuration" do
650
- post = setup_post '2011-04-12-text-extension.text'
651
- conv = post.converter
652
- assert conv.kind_of? Jekyll::Converters::Identity
653
- end
654
-
655
- should "process .text as markdown under alternate configuration" do
656
- @site.config['markdown_ext'] = 'markdown,mdw,mdwn,md,text'
657
- post = setup_post '2011-04-12-text-extension.text'
658
- conv = post.converter
659
- assert conv.kind_of? Jekyll::Converters::Markdown
660
- end
661
-
662
- should "process .md as markdown under alternate configuration" do
663
- @site.config['markdown_ext'] = 'markdown,mkd,mkdn,md,text'
664
- post = setup_post '2011-04-12-text-extension.text'
665
- conv = post.converter
666
- assert conv.kind_of? Jekyll::Converters::Markdown
667
- end
668
-
669
- should "process .mkdn under text if it is not in the markdown config" do
670
- @site.config['markdown_ext'] = 'markdown,mkd,md,text'
671
- post = setup_post '2013-08-01-mkdn-extension.mkdn'
672
- conv = post.converter
673
- assert conv.kind_of? Jekyll::Converters::Identity
674
- end
675
-
676
- should "process .text as textile under alternate configuration" do
677
- @site.config['textile_ext'] = 'textile,text'
678
- post = setup_post '2011-04-12-text-extension.text'
679
- conv = post.converter
680
- assert conv.kind_of? Jekyll::Converters::Textile
681
- end
682
-
683
- end
684
-
685
- context "site config with category" do
686
- setup do
687
- config = Jekyll::Configuration::DEFAULTS.merge({
688
- 'defaults' => [
689
- 'scope' => {
690
- 'path' => ''
691
- },
692
- 'values' => {
693
- 'category' => 'article'
694
- }
695
- ]
696
- })
697
- @site = Site.new(config)
698
- end
699
-
700
- should "return category if post does not specify category" do
701
- post = setup_post("2009-01-27-no-category.textile")
702
- assert post.categories.include?('article'), "Expected post.categories to include 'article' but did not."
703
- end
704
-
705
- should "override site category if set on post" do
706
- post = setup_post("2009-01-27-category.textile")
707
- assert post.categories.include?('foo'), "Expected post.categories to include 'foo' but did not."
708
- assert !post.categories.include?('article'), "Did not expect post.categories to include 'article' but it did."
709
- end
710
- end
711
-
712
- context "site config with categories" do
713
- setup do
714
- config = Jekyll::Configuration::DEFAULTS.merge({
715
- 'defaults' => [
716
- 'scope' => {
717
- 'path' => ''
718
- },
719
- 'values' => {
720
- 'categories' => ['article']
721
- }
722
- ]
723
- })
724
- @site = Site.new(config)
725
- end
726
-
727
- should "return categories if post does not specify categories" do
728
- post = setup_post("2009-01-27-no-category.textile")
729
- assert post.categories.include?('article'), "Expected post.categories to include 'article' but did not."
730
- end
731
-
732
- should "override site categories if set on post" do
733
- post = setup_post("2009-01-27-categories.textile")
734
- ['foo', 'bar', 'baz'].each do |category|
735
- assert post.categories.include?(category), "Expected post.categories to include '#{category}' but did not."
736
- end
737
- assert !post.categories.include?('article'), "Did not expect post.categories to include 'article' but it did."
738
- end
739
- end
740
-
741
- end