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,56 +0,0 @@
1
- require 'helper'
2
-
3
- class TestDraft < Test::Unit::TestCase
4
- def setup_draft(file)
5
- Draft.new(@site, source_dir, '', file)
6
- end
7
-
8
- context "A Draft" do
9
- setup do
10
- clear_dest
11
- stub(Jekyll).configuration { Jekyll::Configuration::DEFAULTS }
12
- @site = Site.new(Jekyll.configuration)
13
- end
14
-
15
- should "ensure valid drafts are valid" do
16
- assert Draft.valid?("2008-09-09-foo-bar.textile")
17
- assert Draft.valid?("foo/bar/2008-09-09-foo-bar.textile")
18
- assert Draft.valid?("lol2008-09-09-foo-bar.textile")
19
-
20
- assert !Draft.valid?("blah")
21
- end
22
-
23
- should "make properties accessible through #[]" do
24
- draft = setup_draft('draft-properties.text')
25
- # ! need to touch the file! Or get its timestamp
26
- date = File.mtime(File.join(source_dir, '_drafts', 'draft-properties.text'))
27
- ymd = date.strftime("%Y/%m/%d")
28
-
29
- attrs = {
30
- categories: %w(foo bar baz),
31
- content: "All the properties.\n\nPlus an excerpt.\n",
32
- date: date,
33
- dir: "/foo/bar/baz/#{ymd}",
34
- excerpt: "All the properties.\n\n",
35
- foo: 'bar',
36
- id: "/foo/bar/baz/#{ymd}/draft-properties",
37
- layout: 'default',
38
- name: nil,
39
- path: "_drafts/draft-properties.text",
40
- permalink: nil,
41
- published: nil,
42
- tags: %w(ay bee cee),
43
- title: 'Properties Draft',
44
- url: "/foo/bar/baz/#{ymd}/draft-properties.html"
45
- }
46
-
47
- attrs.each do |attr, val|
48
- attr_str = attr.to_s
49
- result = draft[attr_str]
50
- assert_equal val, result, "For <draft[\"#{attr_str}\"]>:"
51
- end
52
- end
53
-
54
- end
55
-
56
- end
@@ -1,124 +0,0 @@
1
- require 'helper'
2
-
3
- class TestEntryFilter < Test::Unit::TestCase
4
- context "Filtering entries" do
5
- setup do
6
- stub(Jekyll).configuration do
7
- Jekyll::Configuration::DEFAULTS.merge({'source' => source_dir, 'destination' => dest_dir})
8
- end
9
- @site = Site.new(Jekyll.configuration)
10
- end
11
-
12
- should "filter entries" do
13
- ent1 = %w[foo.markdown bar.markdown baz.markdown #baz.markdown#
14
- .baz.markdow foo.markdown~ .htaccess _posts _pages]
15
-
16
- entries = EntryFilter.new(@site).filter(ent1)
17
- assert_equal %w[foo.markdown bar.markdown baz.markdown .htaccess], entries
18
- end
19
-
20
- should "filter entries with exclude" do
21
- excludes = %w[README TODO vendor/bundle]
22
- files = %w[index.html site.css .htaccess vendor]
23
-
24
- @site.exclude = excludes + ["exclude*"]
25
- assert_equal files, @site.filter_entries(excludes + files + ["excludeA"])
26
- end
27
-
28
- should "filter entries with exclude relative to site source" do
29
- excludes = %w[README TODO css]
30
- files = %w[index.html vendor/css .htaccess]
31
-
32
- @site.exclude = excludes
33
- assert_equal files, @site.filter_entries(excludes + files + ["css"])
34
- end
35
-
36
- should "filter excluded directory and contained files" do
37
- excludes = %w[README TODO css]
38
- files = %w[index.html .htaccess]
39
-
40
- @site.exclude = excludes
41
- assert_equal files, @site.filter_entries(excludes + files + ["css", "css/main.css", "css/vendor.css"])
42
- end
43
-
44
- should "not filter entries within include" do
45
- includes = %w[_index.html .htaccess include*]
46
- files = %w[index.html _index.html .htaccess includeA]
47
-
48
- @site.include = includes
49
- assert_equal files, @site.filter_entries(files)
50
- end
51
-
52
- should "filter symlink entries when safe mode enabled" do
53
- stub(Jekyll).configuration do
54
- Jekyll::Configuration::DEFAULTS.merge({'source' => source_dir, 'destination' => dest_dir, 'safe' => true})
55
- end
56
- site = Site.new(Jekyll.configuration)
57
- stub(File).symlink?('symlink.js') {true}
58
- files = %w[symlink.js]
59
- assert_equal [], site.filter_entries(files)
60
- end
61
-
62
- should "not filter symlink entries when safe mode disabled" do
63
- stub(File).symlink?('symlink.js') {true}
64
- files = %w[symlink.js]
65
- assert_equal files, @site.filter_entries(files)
66
- end
67
-
68
- should "not include symlinks in safe mode" do
69
- stub(Jekyll).configuration do
70
- Jekyll::Configuration::DEFAULTS.merge({'source' => source_dir, 'destination' => dest_dir, 'safe' => true})
71
- end
72
- site = Site.new(Jekyll.configuration)
73
-
74
- site.read_directories("symlink-test")
75
- assert_equal [], site.pages
76
- assert_equal [], site.static_files
77
- end
78
-
79
- should "include symlinks in unsafe mode" do
80
- stub(Jekyll).configuration do
81
- Jekyll::Configuration::DEFAULTS.merge({'source' => source_dir, 'destination' => dest_dir, 'safe' => false})
82
- end
83
- site = Site.new(Jekyll.configuration)
84
-
85
- site.read_directories("symlink-test")
86
- assert_not_equal [], site.pages
87
- assert_not_equal [], site.static_files
88
- end
89
- end
90
-
91
- context "#glob_include?" do
92
- setup do
93
- stub(Jekyll).configuration do
94
- Jekyll::Configuration::DEFAULTS.merge({'source' => source_dir, 'destination' => dest_dir})
95
- end
96
- @site = Site.new(Jekyll.configuration)
97
- @filter = EntryFilter.new(@site)
98
- end
99
-
100
- should "return false with no glob patterns" do
101
- assert !@filter.glob_include?([], "a.txt")
102
- end
103
-
104
- should "return false with all not match path" do
105
- data = ["a*", "b?"]
106
- assert !@filter.glob_include?(data, "ca.txt")
107
- assert !@filter.glob_include?(data, "ba.txt")
108
- end
109
-
110
- should "return true with match path" do
111
- data = ["a*", "b?", "**/a*"]
112
- assert @filter.glob_include?(data, "a.txt")
113
- assert @filter.glob_include?(data, "ba")
114
- assert @filter.glob_include?(data, "c/a/a.txt")
115
- assert @filter.glob_include?(data, "c/a/b/a.txt")
116
- end
117
-
118
- should "match even if there is no leading slash" do
119
- data = ['vendor/bundle']
120
- assert @filter.glob_include?(data, '/vendor/bundle')
121
- assert @filter.glob_include?(data, 'vendor/bundle')
122
- end
123
- end
124
- end
@@ -1,131 +0,0 @@
1
- require 'helper'
2
-
3
- class TestExcerpt < Test::Unit::TestCase
4
- def setup_post(file)
5
- Post.new(@site, source_dir, '', file)
6
- end
7
-
8
- def do_render(post)
9
- layouts = { "default" => Layout.new(@site, source_dir('_layouts'), "simple.html")}
10
- post.render(layouts, {"site" => {"posts" => []}})
11
- end
12
-
13
- context "With extraction disabled" do
14
- setup do
15
- clear_dest
16
- stub(Jekyll).configuration do
17
- Jekyll::Configuration::DEFAULTS.merge({'excerpt_separator' => ''})
18
- end
19
- @site = Site.new(Jekyll.configuration)
20
- @post = setup_post("2013-07-22-post-excerpt-with-layout.markdown")
21
- end
22
-
23
- should "not be generated" do
24
- excerpt = @post.send(:extract_excerpt)
25
- assert_equal true, excerpt.empty?
26
- end
27
- end
28
-
29
- context "An extracted excerpt" do
30
- setup do
31
- clear_dest
32
- stub(Jekyll).configuration { Jekyll::Configuration::DEFAULTS }
33
- @site = Site.new(Jekyll.configuration)
34
- @post = setup_post("2013-07-22-post-excerpt-with-layout.markdown")
35
- @excerpt = @post.send :extract_excerpt
36
- end
37
-
38
- context "#include(string)" do
39
-
40
- setup do
41
- @excerpt.output = "Here is a fake output stub"
42
- end
43
-
44
- should "return true only if an excerpt output contains a specified string" do
45
- assert @excerpt.include?("fake output")
46
- refute @excerpt.include?("real output")
47
- end
48
- end
49
-
50
- context "#id" do
51
- should "contain the UID for the post" do
52
- assert_equal @excerpt.id, "#{@post.id}/#excerpt"
53
- end
54
- should "return a string" do
55
- assert_same @post.id.class, String
56
- end
57
- end
58
-
59
- context "#to_s" do
60
- should "return its content if no output present" do
61
- assert_equal @excerpt.content, @excerpt.to_s
62
- end
63
-
64
- should "return its output if output present" do
65
- @excerpt.output = "Fake Output"
66
- assert_equal @excerpt.output, @excerpt.to_s
67
- end
68
- end
69
-
70
- context "#inspect" do
71
- should "contain the excerpt id as a shorthand string identifier" do
72
- assert_equal @excerpt.inspect, "<Excerpt: #{@excerpt.id}>"
73
- end
74
-
75
- should "return a string" do
76
- assert_same @post.id.class, String
77
- end
78
- end
79
-
80
- context "#to_liquid" do
81
- should "contain the proper page data to mimick the post liquid" do
82
- assert_equal "Post Excerpt with Layout", @excerpt.to_liquid["title"]
83
- assert_equal "/bar/baz/z_category/2013/07/22/post-excerpt-with-layout.html", @excerpt.to_liquid["url"]
84
- assert_equal Time.parse("2013-07-22"), @excerpt.to_liquid["date"]
85
- assert_equal %w[bar baz z_category], @excerpt.to_liquid["categories"]
86
- assert_equal %w[first second third jekyllrb.com], @excerpt.to_liquid["tags"]
87
- assert_equal "_posts/2013-07-22-post-excerpt-with-layout.markdown", @excerpt.to_liquid["path"]
88
- end
89
-
90
- should "consider inheritance" do
91
- klass = Class.new(Jekyll::Post)
92
- assert_gets_called = false
93
- klass.send(:define_method, :assert_gets_called) { assert_gets_called = true }
94
- klass.const_set(:EXCERPT_ATTRIBUTES_FOR_LIQUID, Jekyll::Post::EXCERPT_ATTRIBUTES_FOR_LIQUID + ['assert_gets_called'])
95
- post = klass.new(@site, source_dir, '', "2008-02-02-published.textile")
96
- Jekyll::Excerpt.new(post).to_liquid
97
-
98
- assert assert_gets_called, 'assert_gets_called did not get called on post.'
99
- end
100
- end
101
-
102
- context "#content" do
103
-
104
- context "before render" do
105
- should "be the first paragraph of the page" do
106
- assert_equal "First paragraph with [link ref][link].\n\n[link]: http://www.jekyllrb.com/", @excerpt.content
107
- end
108
-
109
- should "contain any refs at the bottom of the page" do
110
- assert @excerpt.content.include?("[link]: http://www.jekyllrb.com/")
111
- end
112
- end
113
-
114
- context "after render" do
115
- setup do
116
- @rendered_post = @post.dup
117
- do_render(@rendered_post)
118
- @extracted_excerpt = @rendered_post.send :extracted_excerpt
119
- end
120
-
121
- should "be the first paragraph of the page" do
122
- assert_equal "<p>First paragraph with <a href=\"http://www.jekyllrb.com/\">link ref</a>.</p>\n\n", @extracted_excerpt.content
123
- end
124
-
125
- should "link properly" do
126
- assert @extracted_excerpt.content.include?("http://www.jekyllrb.com/")
127
- end
128
- end
129
- end
130
- end
131
- end
@@ -1,207 +0,0 @@
1
- # coding: utf-8
2
-
3
- require 'helper'
4
-
5
- class TestFilters < Test::Unit::TestCase
6
- class JekyllFilter
7
- include Jekyll::Filters
8
- attr_accessor :site, :context
9
-
10
- def initialize(opts = {})
11
- @site = Jekyll::Site.new(Jekyll.configuration(opts))
12
- @context = Liquid::Context.new({}, {}, { :site => @site })
13
- end
14
- end
15
-
16
- context "filters" do
17
- setup do
18
- @filter = JekyllFilter.new({"source" => source_dir, "destination" => dest_dir, "timezone" => "UTC"})
19
- @sample_time = Time.utc(2013, 03, 27, 11, 22, 33)
20
- @time_as_string = "September 11, 2001 12:46:30 -0000"
21
- @time_as_numeric = 1399680607
22
- @array_of_objects = [
23
- { "color" => "red", "size" => "large" },
24
- { "color" => "red", "size" => "medium" },
25
- { "color" => "blue", "size" => "medium" }
26
- ]
27
- end
28
-
29
- should "textilize with simple string" do
30
- assert_equal "<p>something <strong>really</strong> simple</p>", @filter.textilize("something *really* simple")
31
- end
32
-
33
- should "markdownify with simple string" do
34
- assert_equal "<p>something <strong>really</strong> simple</p>\n", @filter.markdownify("something **really** simple")
35
- end
36
-
37
- should "convert array to sentence string with no args" do
38
- assert_equal "", @filter.array_to_sentence_string([])
39
- end
40
-
41
- should "convert array to sentence string with one arg" do
42
- assert_equal "1", @filter.array_to_sentence_string([1])
43
- assert_equal "chunky", @filter.array_to_sentence_string(["chunky"])
44
- end
45
-
46
- should "convert array to sentence string with two args" do
47
- assert_equal "1 and 2", @filter.array_to_sentence_string([1, 2])
48
- assert_equal "chunky and bacon", @filter.array_to_sentence_string(["chunky", "bacon"])
49
- end
50
-
51
- should "convert array to sentence string with multiple args" do
52
- assert_equal "1, 2, 3, and 4", @filter.array_to_sentence_string([1, 2, 3, 4])
53
- assert_equal "chunky, bacon, bits, and pieces", @filter.array_to_sentence_string(["chunky", "bacon", "bits", "pieces"])
54
- end
55
-
56
- context "date filters" do
57
- context "with Time object" do
58
- should "format a date with short format" do
59
- assert_equal "27 Mar 2013", @filter.date_to_string(@sample_time)
60
- end
61
-
62
- should "format a date with long format" do
63
- assert_equal "27 March 2013", @filter.date_to_long_string(@sample_time)
64
- end
65
-
66
- should "format a time with xmlschema" do
67
- assert_equal "2013-03-27T11:22:33Z", @filter.date_to_xmlschema(@sample_time)
68
- end
69
-
70
- should "format a time according to RFC-822" do
71
- assert_equal "Wed, 27 Mar 2013 11:22:33 -0000", @filter.date_to_rfc822(@sample_time)
72
- end
73
- end
74
-
75
- context "with String object" do
76
- should "format a date with short format" do
77
- assert_equal "11 Sep 2001", @filter.date_to_string(@time_as_string)
78
- end
79
-
80
- should "format a date with long format" do
81
- assert_equal "11 September 2001", @filter.date_to_long_string(@time_as_string)
82
- end
83
-
84
- should "format a time with xmlschema" do
85
- assert_equal "2001-09-11T12:46:30Z", @filter.date_to_xmlschema(@time_as_string)
86
- end
87
-
88
- should "format a time according to RFC-822" do
89
- assert_equal "Tue, 11 Sep 2001 12:46:30 -0000", @filter.date_to_rfc822(@time_as_string)
90
- end
91
- end
92
-
93
- context "with a Numeric object" do
94
- should "format a date with short format" do
95
- assert_equal "10 May 2014", @filter.date_to_string(@time_as_numeric)
96
- end
97
-
98
- should "format a date with long format" do
99
- assert_equal "10 May 2014", @filter.date_to_long_string(@time_as_numeric)
100
- end
101
-
102
- should "format a time with xmlschema" do
103
- assert_match /2014-05-10T00:10:07/, @filter.date_to_xmlschema(@time_as_numeric)
104
- end
105
-
106
- should "format a time according to RFC-822" do
107
- assert_equal "Sat, 10 May 2014 00:10:07 +0000", @filter.date_to_rfc822(@time_as_numeric)
108
- end
109
- end
110
- end
111
-
112
- should "escape xml with ampersands" do
113
- assert_equal "AT&amp;T", @filter.xml_escape("AT&T")
114
- assert_equal "&lt;code&gt;command &amp;lt;filename&amp;gt;&lt;/code&gt;", @filter.xml_escape("<code>command &lt;filename&gt;</code>")
115
- end
116
-
117
- should "not error when xml escaping nil" do
118
- assert_equal "", @filter.xml_escape(nil)
119
- end
120
-
121
- should "escape space as plus" do
122
- assert_equal "my+things", @filter.cgi_escape("my things")
123
- end
124
-
125
- should "escape special characters" do
126
- assert_equal "hey%21", @filter.cgi_escape("hey!")
127
- end
128
-
129
- should "escape space as %20" do
130
- assert_equal "my%20things", @filter.uri_escape("my things")
131
- end
132
-
133
- context "jsonify filter" do
134
- should "convert hash to json" do
135
- assert_equal "{\"age\":18}", @filter.jsonify({:age => 18})
136
- end
137
-
138
- should "convert array to json" do
139
- assert_equal "[1,2]", @filter.jsonify([1, 2])
140
- assert_equal "[{\"name\":\"Jack\"},{\"name\":\"Smith\"}]", @filter.jsonify([{:name => 'Jack'}, {:name => 'Smith'}])
141
- end
142
- end
143
-
144
- context "group_by filter" do
145
- should "successfully group array of Jekyll::Page's" do
146
- @filter.site.process
147
- grouping = @filter.group_by(@filter.site.pages, "layout")
148
- grouping.each do |g|
149
- assert ["default", "nil", ""].include?(g["name"]), "#{g['name']} isn't a valid grouping."
150
- case g["name"]
151
- when "default"
152
- assert g["items"].is_a?(Array), "The list of grouped items for 'default' is not an Array."
153
- assert_equal 5, g["items"].size
154
- when "nil"
155
- assert g["items"].is_a?(Array), "The list of grouped items for 'nil' is not an Array."
156
- assert_equal 2, g["items"].size
157
- when ""
158
- assert g["items"].is_a?(Array), "The list of grouped items for '' is not an Array."
159
- assert_equal 11, g["items"].size
160
- end
161
- end
162
- end
163
- end
164
-
165
- context "where filter" do
166
- should "return any input that is not an array" do
167
- assert_equal Hash.new, @filter.where(Hash.new, nil, nil)
168
- assert_equal "some string", @filter.where("some string", "la", "le")
169
- end
170
-
171
- should "filter objects appropriately" do
172
- assert_equal 2, @filter.where(@array_of_objects, "color", "red").length
173
- end
174
- end
175
-
176
- context "sort filter" do
177
- should "return sorted numbers" do
178
- assert_equal [1, 2, 2.2, 3], @filter.sort([3, 2.2, 2, 1])
179
- end
180
- should "return sorted strings" do
181
- assert_equal ["10", "2"], @filter.sort(["10", "2"])
182
- assert_equal [{"a" => "10"}, {"a" => "2"}], @filter.sort([{"a" => "10"}, {"a" => "2"}], "a")
183
- assert_equal ["FOO", "Foo", "foo"], @filter.sort(["foo", "Foo", "FOO"])
184
- assert_equal ["_foo", "foo", "foo_"], @filter.sort(["foo_", "_foo", "foo"])
185
- # Cyrillic
186
- assert_equal ["ВУЗ", "Вуз", "вуз"], @filter.sort(["Вуз", "вуз", "ВУЗ"])
187
- assert_equal ["_вуз", "вуз", "вуз_"], @filter.sort(["вуз_", "_вуз", "вуз"])
188
- # Hebrew
189
- assert_equal ["אלף", "בית"], @filter.sort(["בית", "אלף"])
190
- end
191
- should "return sorted by property array" do
192
- assert_equal [{"a" => 1}, {"a" => 2}, {"a" => 3}, {"a" => 4}],
193
- @filter.sort([{"a" => 4}, {"a" => 3}, {"a" => 1}, {"a" => 2}], "a")
194
- end
195
- should "return sorted by property array with nils first" do
196
- ary = [{"a" => 2}, {"b" => 1}, {"a" => 1}]
197
- assert_equal [{"b" => 1}, {"a" => 1}, {"a" => 2}], @filter.sort(ary, "a")
198
- assert_equal @filter.sort(ary, "a"), @filter.sort(ary, "a", "first")
199
- end
200
- should "return sorted by property array with nils last" do
201
- assert_equal [{"a" => 1}, {"a" => 2}, {"b" => 1}],
202
- @filter.sort([{"a" => 2}, {"b" => 1}, {"a" => 1}], "a", "last")
203
- end
204
- end
205
-
206
- end
207
- end