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.
- checksums.yaml +4 -4
- data/README.markdown +1 -1
- data/lib/jekyll.rb +0 -1
- data/lib/jekyll/collection.rb +18 -3
- data/lib/jekyll/command.rb +0 -25
- data/lib/jekyll/commands/build.rb +7 -2
- data/lib/jekyll/commands/help.rb +33 -0
- data/lib/jekyll/configuration.rb +36 -28
- data/lib/jekyll/converters/markdown/kramdown_parser.rb +1 -1
- data/lib/jekyll/convertible.rb +43 -20
- data/lib/jekyll/deprecator.rb +15 -8
- data/lib/jekyll/document.rb +21 -4
- data/lib/jekyll/filters.rb +27 -1
- data/lib/jekyll/frontmatter_defaults.rb +46 -12
- data/lib/jekyll/plugin.rb +10 -1
- data/lib/jekyll/post.rb +6 -13
- data/lib/jekyll/related_posts.rb +2 -2
- data/lib/jekyll/renderer.rb +7 -2
- data/lib/jekyll/site.rb +5 -7
- data/lib/jekyll/static_file.rb +24 -4
- data/lib/jekyll/tags/include.rb +3 -1
- data/lib/jekyll/tags/post_url.rb +2 -2
- data/lib/jekyll/utils.rb +88 -69
- data/lib/jekyll/version.rb +1 -1
- data/lib/site_template/_config.yml +6 -4
- data/lib/site_template/_includes/footer.html +43 -49
- data/lib/site_template/_includes/head.html +3 -4
- data/lib/site_template/_includes/header.html +9 -10
- data/lib/site_template/_layouts/default.html +6 -5
- data/lib/site_template/_layouts/page.html +3 -3
- data/lib/site_template/_layouts/post.html +4 -4
- data/lib/site_template/_posts/0000-00-00-welcome-to-jekyll.markdown.erb +6 -5
- data/lib/site_template/_sass/_base.scss +203 -0
- data/lib/site_template/_sass/_layout.scss +236 -0
- data/lib/site_template/_sass/_syntax-highlighting.scss +67 -0
- data/lib/site_template/css/main.scss +49 -0
- data/lib/site_template/feed.xml +1 -1
- data/lib/site_template/index.html +7 -4
- metadata +24 -431
- data/.gitignore +0 -15
- data/.travis.yml +0 -27
- data/CONTRIBUTING.markdown +0 -91
- data/Gemfile +0 -2
- data/History.markdown +0 -1310
- data/Rakefile +0 -268
- data/cucumber.yml +0 -3
- data/docs/jp/CONTRIBUTING.jp.markdown +0 -93
- data/docs/jp/README.jp.markdown +0 -68
- data/features/collections.feature +0 -145
- data/features/create_sites.feature +0 -158
- data/features/data.feature +0 -105
- data/features/drafts.feature +0 -46
- data/features/embed_filters.feature +0 -107
- data/features/frontmatter_defaults.feature +0 -136
- data/features/include_tag.feature +0 -68
- data/features/markdown.feature +0 -67
- data/features/pagination.feature +0 -82
- data/features/permalinks.feature +0 -85
- data/features/post_data.feature +0 -261
- data/features/post_excerpts.feature +0 -50
- data/features/rendering.feature +0 -34
- data/features/site_configuration.feature +0 -283
- data/features/site_data.feature +0 -107
- data/features/step_definitions/jekyll_steps.rb +0 -201
- data/features/support/env.rb +0 -65
- data/jekyll.gemspec +0 -66
- data/lib/site_template/css/main.css +0 -410
- data/script/bootstrap +0 -4
- data/script/branding +0 -11
- data/script/cibuild +0 -7
- data/script/console +0 -38
- data/script/proof +0 -22
- data/script/rebund +0 -140
- data/script/test +0 -17
- data/site/.gitignore +0 -4
- data/site/CNAME +0 -1
- data/site/README +0 -1
- data/site/_config.yml +0 -9
- data/site/_data/docs.yml +0 -46
- data/site/_includes/analytics.html +0 -30
- data/site/_includes/anchor_links.html +0 -32
- data/site/_includes/css/font-awesome.css +0 -44
- data/site/_includes/css/gridism.css +0 -110
- data/site/_includes/css/normalize.css +0 -1
- data/site/_includes/css/pygments.css +0 -72
- data/site/_includes/css/style.css +0 -1045
- data/site/_includes/docs_contents.html +0 -8
- data/site/_includes/docs_contents_mobile.html +0 -10
- data/site/_includes/docs_option.html +0 -11
- data/site/_includes/docs_ul.html +0 -20
- data/site/_includes/footer.html +0 -15
- data/site/_includes/header.html +0 -18
- data/site/_includes/news_contents.html +0 -33
- data/site/_includes/news_contents_mobile.html +0 -11
- data/site/_includes/news_item.html +0 -24
- data/site/_includes/primary-nav-items.html +0 -17
- data/site/_includes/section_nav.html +0 -22
- data/site/_includes/top.html +0 -17
- data/site/_layouts/default.html +0 -13
- data/site/_layouts/docs.html +0 -23
- data/site/_layouts/news.html +0 -19
- data/site/_layouts/news_item.html +0 -27
- data/site/_posts/2013-05-06-jekyll-1-0-0-released.markdown +0 -23
- data/site/_posts/2013-05-08-jekyll-1-0-1-released.markdown +0 -27
- data/site/_posts/2013-05-12-jekyll-1-0-2-released.markdown +0 -28
- data/site/_posts/2013-06-07-jekyll-1-0-3-released.markdown +0 -25
- data/site/_posts/2013-07-14-jekyll-1-1-0-released.markdown +0 -27
- data/site/_posts/2013-07-24-jekyll-1-1-1-released.markdown +0 -31
- data/site/_posts/2013-07-25-jekyll-1-0-4-released.markdown +0 -20
- data/site/_posts/2013-07-25-jekyll-1-1-2-released.markdown +0 -20
- data/site/_posts/2013-09-06-jekyll-1-2-0-released.markdown +0 -23
- data/site/_posts/2013-09-14-jekyll-1-2-1-released.markdown +0 -19
- data/site/_posts/2013-10-28-jekyll-1-3-0-rc1-released.markdown +0 -19
- data/site/_posts/2013-11-04-jekyll-1-3-0-released.markdown +0 -43
- data/site/_posts/2013-11-26-jekyll-1-3-1-released.markdown +0 -21
- data/site/_posts/2013-12-07-jekyll-1-4-0-released.markdown +0 -30
- data/site/_posts/2013-12-09-jekyll-1-4-1-released.markdown +0 -20
- data/site/_posts/2013-12-16-jekyll-1-4-2-released.markdown +0 -18
- data/site/_posts/2014-01-13-jekyll-1-4-3-released.markdown +0 -26
- data/site/_posts/2014-03-24-jekyll-1-5-0-released.markdown +0 -19
- data/site/_posts/2014-03-27-jekyll-1-5-1-released.markdown +0 -26
- data/site/_posts/2014-05-06-jekyll-turns-2-0-0.markdown +0 -31
- data/site/_posts/2014-05-08-jekyll-2-0-3-released.markdown +0 -18
- data/site/_posts/2014-06-04-jekyll-stickers-1-dollar-stickermule.markdown +0 -19
- data/site/_posts/2014-06-28-jekyll-turns-21-i-mean-2-1-0.markdown +0 -31
- data/site/_posts/2014-07-01-jekyll-2-1-1-released.markdown +0 -30
- data/site/_posts/2014-07-29-jekyll-2-2-0-released.markdown +0 -19
- data/site/css/screen.css +0 -31
- data/site/docs/assets.md +0 -66
- data/site/docs/collections.md +0 -259
- data/site/docs/configuration.md +0 -536
- data/site/docs/continuous-integration.md +0 -177
- data/site/docs/contributing.md +0 -133
- data/site/docs/datafiles.md +0 -108
- data/site/docs/deployment-methods.md +0 -127
- data/site/docs/drafts.md +0 -21
- data/site/docs/extras.md +0 -18
- data/site/docs/frontmatter.md +0 -191
- data/site/docs/github-pages.md +0 -91
- data/site/docs/history.md +0 -1514
- data/site/docs/index.md +0 -58
- data/site/docs/installation.md +0 -106
- data/site/docs/migrations.md +0 -11
- data/site/docs/pages.md +0 -86
- data/site/docs/pagination.md +0 -212
- data/site/docs/permalinks.md +0 -188
- data/site/docs/plugins.md +0 -561
- data/site/docs/posts.md +0 -211
- data/site/docs/quickstart.md +0 -26
- data/site/docs/resources.md +0 -43
- data/site/docs/sites.md +0 -29
- data/site/docs/structure.md +0 -190
- data/site/docs/templates.md +0 -376
- data/site/docs/troubleshooting.md +0 -147
- data/site/docs/upgrading.md +0 -146
- data/site/docs/usage.md +0 -74
- data/site/docs/variables.md +0 -382
- data/site/docs/windows.md +0 -44
- data/site/favicon.ico +0 -0
- data/site/feed.xml +0 -48
- data/site/fonts/FontAwesome.otf +0 -0
- data/site/fonts/fontawesome-webfont.eot +0 -0
- data/site/fonts/fontawesome-webfont.svg +0 -504
- data/site/fonts/fontawesome-webfont.ttf +0 -0
- data/site/fonts/fontawesome-webfont.woff +0 -0
- data/site/freenode.txt +0 -1
- data/site/img/article-footer.png +0 -0
- data/site/img/footer-arrow.png +0 -0
- data/site/img/footer-logo.png +0 -0
- data/site/img/jekyll-sticker.jpg +0 -0
- data/site/img/logo-2x.png +0 -0
- data/site/img/logo-rss.png +0 -0
- data/site/img/octojekyll.png +0 -0
- data/site/index.html +0 -90
- data/site/js/html5shiv.min.js +0 -4
- data/site/js/respond.min.js +0 -5
- data/site/news/index.html +0 -10
- data/site/news/releases/index.html +0 -10
- data/test/fixtures/broken_front_matter1.erb +0 -5
- data/test/fixtures/broken_front_matter2.erb +0 -4
- data/test/fixtures/broken_front_matter3.erb +0 -7
- data/test/fixtures/exploit_front_matter.erb +0 -4
- data/test/fixtures/front_matter.erb +0 -4
- data/test/helper.rb +0 -80
- data/test/source/+/%# +.md +0 -6
- data/test/source/+/foo.md +0 -7
- data/test/source/.htaccess +0 -8
- data/test/source/_config.dev.toml +0 -2
- data/test/source/_data/categories/dairy.yaml +0 -6
- data/test/source/_data/languages.yml +0 -2
- data/test/source/_data/members.json +0 -12
- data/test/source/_data/members.yaml +0 -7
- data/test/source/_data/products.yml +0 -4
- data/test/source/_drafts/draft-properties.text +0 -11
- data/test/source/_includes/include.html +0 -1
- data/test/source/_includes/params.html +0 -7
- data/test/source/_includes/sig.markdown +0 -3
- data/test/source/_layouts/default.html +0 -27
- data/test/source/_layouts/post/simple.html +0 -1
- data/test/source/_layouts/simple.html +0 -1
- data/test/source/_methods/_do_not_read_me.md +0 -5
- data/test/source/_methods/configuration.md +0 -8
- data/test/source/_methods/sanitized_path.md +0 -5
- data/test/source/_methods/site/_dont_include_me_either.md +0 -5
- data/test/source/_methods/site/generate.md +0 -6
- data/test/source/_methods/site/initialize.md +0 -4
- data/test/source/_methods/um_hi.md +0 -6
- data/test/source/_plugins/dummy.rb +0 -8
- data/test/source/_posts/2008-02-02-not-published.textile +0 -8
- data/test/source/_posts/2008-02-02-published.textile +0 -8
- data/test/source/_posts/2008-10-18-foo-bar.textile +0 -8
- data/test/source/_posts/2008-11-21-complex.textile +0 -8
- data/test/source/_posts/2008-12-03-permalinked-post.textile +0 -9
- data/test/source/_posts/2008-12-13-include.markdown +0 -8
- data/test/source/_posts/2009-01-27-array-categories.textile +0 -10
- data/test/source/_posts/2009-01-27-categories.textile +0 -7
- data/test/source/_posts/2009-01-27-category.textile +0 -7
- data/test/source/_posts/2009-01-27-empty-categories.textile +0 -7
- data/test/source/_posts/2009-01-27-empty-category.textile +0 -7
- data/test/source/_posts/2009-01-27-no-category.textile +0 -6
- data/test/source/_posts/2009-03-12-hash-#1.markdown +0 -6
- data/test/source/_posts/2009-05-18-empty-tag.textile +0 -6
- data/test/source/_posts/2009-05-18-empty-tags.textile +0 -6
- data/test/source/_posts/2009-05-18-tag.textile +0 -6
- data/test/source/_posts/2009-05-18-tags.textile +0 -9
- data/test/source/_posts/2009-06-22-empty-yaml.textile +0 -3
- data/test/source/_posts/2009-06-22-no-yaml.textile +0 -1
- data/test/source/_posts/2010-01-08-triple-dash.markdown +0 -5
- data/test/source/_posts/2010-01-09-date-override.textile +0 -7
- data/test/source/_posts/2010-01-09-time-override.textile +0 -7
- data/test/source/_posts/2010-01-09-timezone-override.textile +0 -7
- data/test/source/_posts/2010-01-16-override-data.textile +0 -4
- data/test/source/_posts/2011-04-12-md-extension.md +0 -7
- data/test/source/_posts/2011-04-12-text-extension.text +0 -0
- data/test/source/_posts/2013-01-02-post-excerpt.markdown +0 -14
- data/test/source/_posts/2013-01-12-nil-layout.textile +0 -6
- data/test/source/_posts/2013-01-12-no-layout.textile +0 -5
- data/test/source/_posts/2013-03-19-not-a-post.markdown/.gitkeep +0 -0
- data/test/source/_posts/2013-04-11-custom-excerpt.markdown +0 -10
- data/test/source/_posts/2013-05-10-number-category.textile +0 -7
- data/test/source/_posts/2013-07-22-post-excerpt-with-layout.markdown +0 -23
- data/test/source/_posts/2013-08-01-mkdn-extension.mkdn +0 -0
- data/test/source/_posts/2013-12-17-include-variable-filters.markdown +0 -21
- data/test/source/_posts/2013-12-20-properties.text +0 -11
- data/test/source/_posts/2014-01-06-permalink-traversal.md +0 -5
- data/test/source/_posts/2014-03-03-yaml-with-dots.md +0 -5
- data/test/source/_posts/2014-03-22-escape-+ %20[].markdown +0 -6
- data/test/source/_posts/es/2008-11-21-nested.textile +0 -8
- data/test/source/_sass/_grid.scss +0 -1
- data/test/source/_slides/example-slide-1.html +0 -4
- data/test/source/_slides/example-slide-2.html +0 -7
- data/test/source/_slides/example-slide-3.html +0 -5
- data/test/source/_with.dots/all.dots/2.4.0.md +0 -5
- data/test/source/_with.dots/file.with.dots.md +0 -0
- data/test/source/about.html +0 -6
- data/test/source/category/_posts/2008-9-23-categories.textile +0 -6
- data/test/source/contacts.html +0 -5
- data/test/source/contacts/bar.html +0 -5
- data/test/source/contacts/index.html +0 -5
- data/test/source/css/main.scss +0 -4
- data/test/source/css/screen.css +0 -76
- data/test/source/deal.with.dots.html +0 -7
- data/test/source/environment.html +0 -5
- data/test/source/exploit.md +0 -5
- data/test/source/foo/_posts/bar/2008-12-12-topical-post.textile +0 -8
- data/test/source/index.html +0 -22
- data/test/source/js/coffeescript.coffee +0 -10
- data/test/source/pgp.key +0 -2
- data/test/source/products.yml +0 -4
- data/test/source/properties.html +0 -8
- data/test/source/sitemap.xml +0 -32
- data/test/source/static_files.html +0 -4
- data/test/source/symlink-test/symlinked-file +0 -22
- data/test/source/unpublished.html +0 -7
- data/test/source/win/_posts/2009-05-24-yaml-linebreak.markdown +0 -7
- data/test/source/z_category/_posts/2008-9-23-categories.textile +0 -6
- data/test/suite.rb +0 -11
- data/test/test_cleaner.rb +0 -77
- data/test/test_coffeescript.rb +0 -49
- data/test/test_collections.rb +0 -224
- data/test/test_command.rb +0 -53
- data/test/test_configuration.rb +0 -201
- data/test/test_convertible.rb +0 -49
- data/test/test_document.rb +0 -193
- data/test/test_draft.rb +0 -56
- data/test/test_entry_filter.rb +0 -124
- data/test/test_excerpt.rb +0 -131
- data/test/test_filters.rb +0 -207
- data/test/test_generated_site.rb +0 -97
- data/test/test_kramdown.rb +0 -62
- data/test/test_layout_reader.rb +0 -34
- data/test/test_liquid_extensions.rb +0 -31
- data/test/test_log_adapter.rb +0 -59
- data/test/test_new_command.rb +0 -104
- data/test/test_page.rb +0 -254
- data/test/test_path_sanitization.rb +0 -18
- data/test/test_post.rb +0 -741
- data/test/test_rdiscount.rb +0 -22
- data/test/test_redcarpet.rb +0 -77
- data/test/test_redcloth.rb +0 -86
- data/test/test_related_posts.rb +0 -47
- data/test/test_sass.rb +0 -26
- data/test/test_site.rb +0 -452
- data/test/test_tags.rb +0 -509
- data/test/test_url.rb +0 -28
- data/test/test_utils.rb +0 -67
data/test/test_tags.rb
DELETED
@@ -1,509 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
|
3
|
-
require 'helper'
|
4
|
-
|
5
|
-
class TestTags < Test::Unit::TestCase
|
6
|
-
|
7
|
-
def create_post(content, override = {}, converter_class = Jekyll::Converters::Markdown)
|
8
|
-
stub(Jekyll).configuration do
|
9
|
-
site_configuration({
|
10
|
-
"highlighter" => "pygments"
|
11
|
-
}.merge(override))
|
12
|
-
end
|
13
|
-
site = Site.new(Jekyll.configuration)
|
14
|
-
|
15
|
-
if override['read_posts']
|
16
|
-
site.read_posts('')
|
17
|
-
end
|
18
|
-
|
19
|
-
info = { :filters => [Jekyll::Filters], :registers => { :site => site } }
|
20
|
-
@converter = site.converters.find { |c| c.class == converter_class }
|
21
|
-
payload = { "highlighter_prefix" => @converter.highlighter_prefix,
|
22
|
-
"highlighter_suffix" => @converter.highlighter_suffix }
|
23
|
-
|
24
|
-
@result = Liquid::Template.parse(content).render!(payload, info)
|
25
|
-
@result = @converter.convert(@result)
|
26
|
-
end
|
27
|
-
|
28
|
-
def fill_post(code, override = {})
|
29
|
-
content = <<CONTENT
|
30
|
-
---
|
31
|
-
title: This is a test
|
32
|
-
---
|
33
|
-
|
34
|
-
This document results in a markdown error with maruku
|
35
|
-
|
36
|
-
{% highlight text %}
|
37
|
-
#{code}
|
38
|
-
{% endhighlight %}
|
39
|
-
{% highlight text linenos %}
|
40
|
-
#{code}
|
41
|
-
{% endhighlight %}
|
42
|
-
CONTENT
|
43
|
-
create_post(content, override)
|
44
|
-
end
|
45
|
-
|
46
|
-
context "language name" do
|
47
|
-
should "match only the required set of chars" do
|
48
|
-
r = Jekyll::Tags::HighlightBlock::SYNTAX
|
49
|
-
assert_match r, "ruby"
|
50
|
-
assert_match r, "c#"
|
51
|
-
assert_match r, "xml+cheetah"
|
52
|
-
assert_match r, "x.y"
|
53
|
-
assert_match r, "coffee-script"
|
54
|
-
|
55
|
-
assert_no_match r, "blah^"
|
56
|
-
|
57
|
-
assert_match r, "ruby key=val"
|
58
|
-
assert_match r, "ruby a=b c=d"
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
context "initialized tag" do
|
63
|
-
should "set the correct options" do
|
64
|
-
tag = Jekyll::Tags::HighlightBlock.new('highlight', 'ruby ', ["test", "{% endhighlight %}", "\n"])
|
65
|
-
assert_equal({}, tag.instance_variable_get(:@options))
|
66
|
-
|
67
|
-
tag = Jekyll::Tags::HighlightBlock.new('highlight', 'ruby linenos ', ["test", "{% endhighlight %}", "\n"])
|
68
|
-
assert_equal({ :linenos => 'inline' }, tag.instance_variable_get(:@options))
|
69
|
-
|
70
|
-
tag = Jekyll::Tags::HighlightBlock.new('highlight', 'ruby linenos=table ', ["test", "{% endhighlight %}", "\n"])
|
71
|
-
assert_equal({ :linenos => 'table' }, tag.instance_variable_get(:@options))
|
72
|
-
|
73
|
-
tag = Jekyll::Tags::HighlightBlock.new('highlight', 'ruby linenos=table nowrap', ["test", "{% endhighlight %}", "\n"])
|
74
|
-
assert_equal({ :linenos => 'table', :nowrap => true }, tag.instance_variable_get(:@options))
|
75
|
-
|
76
|
-
tag = Jekyll::Tags::HighlightBlock.new('highlight', 'ruby linenos=table cssclass=hl', ["test", "{% endhighlight %}", "\n"])
|
77
|
-
assert_equal({ :cssclass => 'hl', :linenos => 'table' }, tag.instance_variable_get(:@options))
|
78
|
-
|
79
|
-
tag = Jekyll::Tags::HighlightBlock.new('highlight', 'ruby linenos=table cssclass=hl hl_linenos=3', ["test", "{% endhighlight %}", "\n"])
|
80
|
-
assert_equal({ :cssclass => 'hl', :linenos => 'table', :hl_linenos => '3' }, tag.instance_variable_get(:@options))
|
81
|
-
|
82
|
-
tag = Jekyll::Tags::HighlightBlock.new('highlight', 'ruby linenos=table cssclass=hl hl_linenos="3 5 6"', ["test", "{% endhighlight %}", "\n"])
|
83
|
-
assert_equal({ :cssclass => 'hl', :linenos => 'table', :hl_linenos => ['3', '5', '6'] }, tag.instance_variable_get(:@options))
|
84
|
-
|
85
|
-
tag = Jekyll::Tags::HighlightBlock.new('highlight', 'Ruby ', ["test", "{% endhighlight %}", "\n"])
|
86
|
-
assert_equal "ruby", tag.instance_variable_get(:@lang), "lexers should be case insensitive"
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
context "in safe mode" do
|
91
|
-
setup do
|
92
|
-
@tag = Jekyll::Tags::HighlightBlock.new('highlight', 'text ', ["test", "{% endhighlight %}", "\n"])
|
93
|
-
end
|
94
|
-
|
95
|
-
should "allow linenos" do
|
96
|
-
sanitized = @tag.sanitized_opts({:linenos => true}, true)
|
97
|
-
assert_equal true, sanitized[:linenos]
|
98
|
-
end
|
99
|
-
|
100
|
-
should "allow hl_linenos" do
|
101
|
-
sanitized = @tag.sanitized_opts({:hl_linenos => %w[1 2 3 4]}, true)
|
102
|
-
assert_equal %w[1 2 3 4], sanitized[:hl_linenos]
|
103
|
-
end
|
104
|
-
|
105
|
-
should "allow cssclass" do
|
106
|
-
sanitized = @tag.sanitized_opts({:cssclass => "ahoy"}, true)
|
107
|
-
assert_equal "ahoy", sanitized[:cssclass]
|
108
|
-
end
|
109
|
-
|
110
|
-
should "allow startinline" do
|
111
|
-
sanitized = @tag.sanitized_opts({:startinline => true}, true)
|
112
|
-
assert_equal true, sanitized[:startinline]
|
113
|
-
end
|
114
|
-
|
115
|
-
should "strip unknown options" do
|
116
|
-
sanitized = @tag.sanitized_opts({:light => true}, true)
|
117
|
-
assert_nil sanitized[:light]
|
118
|
-
end
|
119
|
-
end
|
120
|
-
|
121
|
-
context "post content has highlight tag" do
|
122
|
-
setup do
|
123
|
-
fill_post("test")
|
124
|
-
end
|
125
|
-
|
126
|
-
should "not cause a markdown error" do
|
127
|
-
assert_no_match /markdown\-html\-error/, @result
|
128
|
-
end
|
129
|
-
|
130
|
-
should "render markdown with pygments" do
|
131
|
-
assert_match %{<pre><code class="language-text" data-lang="text">test</code></pre>}, @result
|
132
|
-
end
|
133
|
-
|
134
|
-
should "render markdown with pygments with line numbers" do
|
135
|
-
assert_match %{<pre><code class="language-text" data-lang="text"><span class="lineno">1</span> test</code></pre>}, @result
|
136
|
-
end
|
137
|
-
end
|
138
|
-
|
139
|
-
context "post content has highlight with file reference" do
|
140
|
-
setup do
|
141
|
-
fill_post("./jekyll.gemspec")
|
142
|
-
end
|
143
|
-
|
144
|
-
should "not embed the file" do
|
145
|
-
assert_match %{<pre><code class="language-text" data-lang="text">./jekyll.gemspec</code></pre>}, @result
|
146
|
-
end
|
147
|
-
end
|
148
|
-
|
149
|
-
context "post content has highlight tag with UTF character" do
|
150
|
-
setup do
|
151
|
-
fill_post("Æ")
|
152
|
-
end
|
153
|
-
|
154
|
-
should "render markdown with pygments line handling" do
|
155
|
-
assert_match %{<pre><code class="language-text" data-lang="text">Æ</code></pre>}, @result
|
156
|
-
end
|
157
|
-
end
|
158
|
-
|
159
|
-
context "simple post with markdown and pre tags" do
|
160
|
-
setup do
|
161
|
-
@content = <<CONTENT
|
162
|
-
---
|
163
|
-
title: Maruku vs. RDiscount
|
164
|
-
---
|
165
|
-
|
166
|
-
_FIGHT!_
|
167
|
-
|
168
|
-
{% highlight ruby %}
|
169
|
-
puts "3..2..1.."
|
170
|
-
{% endhighlight %}
|
171
|
-
|
172
|
-
*FINISH HIM*
|
173
|
-
CONTENT
|
174
|
-
end
|
175
|
-
|
176
|
-
context "using Textile" do
|
177
|
-
setup do
|
178
|
-
create_post(@content, {}, Jekyll::Converters::Textile)
|
179
|
-
end
|
180
|
-
|
181
|
-
# Broken in RedCloth 4.1.9
|
182
|
-
should "not textilize highlight block" do
|
183
|
-
assert_no_match %r{3\.\.2\.\.1\.\."</span><br />}, @result
|
184
|
-
end
|
185
|
-
end
|
186
|
-
|
187
|
-
context "using Maruku" do
|
188
|
-
setup do
|
189
|
-
create_post(@content)
|
190
|
-
end
|
191
|
-
|
192
|
-
should "parse correctly" do
|
193
|
-
assert_match %r{<em>FIGHT!</em>}, @result
|
194
|
-
assert_match %r{<em>FINISH HIM</em>}, @result
|
195
|
-
end
|
196
|
-
end
|
197
|
-
|
198
|
-
context "using RDiscount" do
|
199
|
-
setup do
|
200
|
-
create_post(@content, 'markdown' => 'rdiscount')
|
201
|
-
end
|
202
|
-
|
203
|
-
should "parse correctly" do
|
204
|
-
assert_match %r{<em>FIGHT!</em>}, @result
|
205
|
-
assert_match %r{<em>FINISH HIM</em>}, @result
|
206
|
-
end
|
207
|
-
end
|
208
|
-
|
209
|
-
context "using Kramdown" do
|
210
|
-
setup do
|
211
|
-
create_post(@content, 'markdown' => 'kramdown')
|
212
|
-
end
|
213
|
-
|
214
|
-
should "parse correctly" do
|
215
|
-
assert_match %r{<em>FIGHT!</em>}, @result
|
216
|
-
assert_match %r{<em>FINISH HIM</em>}, @result
|
217
|
-
end
|
218
|
-
end
|
219
|
-
|
220
|
-
context "using Redcarpet" do
|
221
|
-
setup do
|
222
|
-
create_post(@content, 'markdown' => 'redcarpet')
|
223
|
-
end
|
224
|
-
|
225
|
-
should "parse correctly" do
|
226
|
-
assert_match %r{<em>FIGHT!</em>}, @result
|
227
|
-
assert_match %r{<em>FINISH HIM</em>}, @result
|
228
|
-
end
|
229
|
-
end
|
230
|
-
end
|
231
|
-
|
232
|
-
context "simple page with post linking" do
|
233
|
-
setup do
|
234
|
-
content = <<CONTENT
|
235
|
-
---
|
236
|
-
title: Post linking
|
237
|
-
---
|
238
|
-
|
239
|
-
{% post_url 2008-11-21-complex %}
|
240
|
-
CONTENT
|
241
|
-
create_post(content, {'permalink' => 'pretty', 'source' => source_dir, 'destination' => dest_dir, 'read_posts' => true})
|
242
|
-
end
|
243
|
-
|
244
|
-
should "not cause an error" do
|
245
|
-
assert_no_match /markdown\-html\-error/, @result
|
246
|
-
end
|
247
|
-
|
248
|
-
should "have the url to the \"complex\" post from 2008-11-21" do
|
249
|
-
assert_match %r{/2008/11/21/complex/}, @result
|
250
|
-
end
|
251
|
-
end
|
252
|
-
|
253
|
-
context "simple page with nested post linking" do
|
254
|
-
setup do
|
255
|
-
content = <<CONTENT
|
256
|
-
---
|
257
|
-
title: Post linking
|
258
|
-
---
|
259
|
-
|
260
|
-
- 1 {% post_url 2008-11-21-complex %}
|
261
|
-
- 2 {% post_url /2008-11-21-complex %}
|
262
|
-
- 3 {% post_url es/2008-11-21-nested %}
|
263
|
-
- 4 {% post_url /es/2008-11-21-nested %}
|
264
|
-
CONTENT
|
265
|
-
create_post(content, {'permalink' => 'pretty', 'source' => source_dir, 'destination' => dest_dir, 'read_posts' => true})
|
266
|
-
end
|
267
|
-
|
268
|
-
should "not cause an error" do
|
269
|
-
assert_no_match /markdown\-html\-error/, @result
|
270
|
-
end
|
271
|
-
|
272
|
-
should "have the url to the \"complex\" post from 2008-11-21" do
|
273
|
-
assert_match %r{1\s/2008/11/21/complex/}, @result
|
274
|
-
assert_match %r{2\s/2008/11/21/complex/}, @result
|
275
|
-
end
|
276
|
-
|
277
|
-
should "have the url to the \"nested\" post from 2008-11-21" do
|
278
|
-
assert_match %r{3\s/es/2008/11/21/nested/}, @result
|
279
|
-
assert_match %r{4\s/es/2008/11/21/nested/}, @result
|
280
|
-
end
|
281
|
-
end
|
282
|
-
|
283
|
-
context "simple page with invalid post name linking" do
|
284
|
-
should "cause an error" do
|
285
|
-
content = <<CONTENT
|
286
|
-
---
|
287
|
-
title: Invalid post name linking
|
288
|
-
---
|
289
|
-
|
290
|
-
{% post_url abc2008-11-21-complex %}
|
291
|
-
CONTENT
|
292
|
-
|
293
|
-
assert_raise ArgumentError do
|
294
|
-
create_post(content, {'permalink' => 'pretty', 'source' => source_dir, 'destination' => dest_dir, 'read_posts' => true})
|
295
|
-
end
|
296
|
-
end
|
297
|
-
end
|
298
|
-
|
299
|
-
context "include tag with parameters" do
|
300
|
-
|
301
|
-
context "with symlink'd include" do
|
302
|
-
|
303
|
-
should "not allow symlink includes" do
|
304
|
-
File.open("/tmp/pages-test", 'w') { |file| file.write("SYMLINK TEST") }
|
305
|
-
assert_raise IOError do
|
306
|
-
content = <<CONTENT
|
307
|
-
---
|
308
|
-
title: Include symlink
|
309
|
-
---
|
310
|
-
|
311
|
-
{% include tmp/pages-test %}
|
312
|
-
|
313
|
-
CONTENT
|
314
|
-
create_post(content, {'permalink' => 'pretty', 'source' => source_dir, 'destination' => dest_dir, 'read_posts' => true, 'safe' => true })
|
315
|
-
end
|
316
|
-
assert_no_match /SYMLINK TEST/, @result
|
317
|
-
end
|
318
|
-
|
319
|
-
should "not expose the existence of symlinked files" do
|
320
|
-
ex = assert_raise IOError do
|
321
|
-
content = <<CONTENT
|
322
|
-
---
|
323
|
-
title: Include symlink
|
324
|
-
---
|
325
|
-
|
326
|
-
{% include tmp/pages-test-does-not-exist %}
|
327
|
-
|
328
|
-
CONTENT
|
329
|
-
create_post(content, {'permalink' => 'pretty', 'source' => source_dir, 'destination' => dest_dir, 'read_posts' => true, 'safe' => true })
|
330
|
-
end
|
331
|
-
assert_match /should exist and should not be a symlink/, ex.message
|
332
|
-
end
|
333
|
-
end
|
334
|
-
|
335
|
-
context "with one parameter" do
|
336
|
-
setup do
|
337
|
-
content = <<CONTENT
|
338
|
-
---
|
339
|
-
title: Include tag parameters
|
340
|
-
---
|
341
|
-
|
342
|
-
{% include sig.markdown myparam="test" %}
|
343
|
-
|
344
|
-
{% include params.html param="value" %}
|
345
|
-
CONTENT
|
346
|
-
create_post(content, {'permalink' => 'pretty', 'source' => source_dir, 'destination' => dest_dir, 'read_posts' => true})
|
347
|
-
end
|
348
|
-
|
349
|
-
should "correctly output include variable" do
|
350
|
-
assert_match "<span id=\"include-param\">value</span>", @result.strip
|
351
|
-
end
|
352
|
-
|
353
|
-
should "ignore parameters if unused" do
|
354
|
-
assert_match "<hr />\n<p>Tom Preston-Werner\ngithub.com/mojombo</p>\n", @result
|
355
|
-
end
|
356
|
-
end
|
357
|
-
|
358
|
-
context "with invalid parameter syntax" do
|
359
|
-
should "throw a ArgumentError" do
|
360
|
-
content = <<CONTENT
|
361
|
-
---
|
362
|
-
title: Invalid parameter syntax
|
363
|
-
---
|
364
|
-
|
365
|
-
{% include params.html param s="value" %}
|
366
|
-
CONTENT
|
367
|
-
assert_raise ArgumentError, 'Did not raise exception on invalid "include" syntax' do
|
368
|
-
create_post(content, {'permalink' => 'pretty', 'source' => source_dir, 'destination' => dest_dir, 'read_posts' => true})
|
369
|
-
end
|
370
|
-
|
371
|
-
content = <<CONTENT
|
372
|
-
---
|
373
|
-
title: Invalid parameter syntax
|
374
|
-
---
|
375
|
-
|
376
|
-
{% include params.html params="value %}
|
377
|
-
CONTENT
|
378
|
-
assert_raise ArgumentError, 'Did not raise exception on invalid "include" syntax' do
|
379
|
-
create_post(content, {'permalink' => 'pretty', 'source' => source_dir, 'destination' => dest_dir, 'read_posts' => true})
|
380
|
-
end
|
381
|
-
end
|
382
|
-
end
|
383
|
-
|
384
|
-
context "with several parameters" do
|
385
|
-
setup do
|
386
|
-
content = <<CONTENT
|
387
|
-
---
|
388
|
-
title: multiple include parameters
|
389
|
-
---
|
390
|
-
|
391
|
-
{% include params.html param1="new_value" param2="another" %}
|
392
|
-
CONTENT
|
393
|
-
create_post(content, {'permalink' => 'pretty', 'source' => source_dir, 'destination' => dest_dir, 'read_posts' => true})
|
394
|
-
end
|
395
|
-
|
396
|
-
should "list all parameters" do
|
397
|
-
assert_match '<li>param1 = new_value</li>', @result
|
398
|
-
assert_match '<li>param2 = another</li>', @result
|
399
|
-
end
|
400
|
-
|
401
|
-
should "not include previously used parameters" do
|
402
|
-
assert_match "<span id=\"include-param\"></span>", @result
|
403
|
-
end
|
404
|
-
end
|
405
|
-
|
406
|
-
context "without parameters" do
|
407
|
-
setup do
|
408
|
-
content = <<CONTENT
|
409
|
-
---
|
410
|
-
title: without parameters
|
411
|
-
---
|
412
|
-
|
413
|
-
{% include params.html %}
|
414
|
-
CONTENT
|
415
|
-
create_post(content, {'permalink' => 'pretty', 'source' => source_dir, 'destination' => dest_dir, 'read_posts' => true})
|
416
|
-
end
|
417
|
-
|
418
|
-
should "include file with empty parameters" do
|
419
|
-
assert_match "<span id=\"include-param\"></span>", @result
|
420
|
-
end
|
421
|
-
end
|
422
|
-
|
423
|
-
context "without parameters within if statement" do
|
424
|
-
setup do
|
425
|
-
content = <<CONTENT
|
426
|
-
---
|
427
|
-
title: without parameters within if statement
|
428
|
-
---
|
429
|
-
|
430
|
-
{% if true %}{% include params.html %}{% endif %}
|
431
|
-
CONTENT
|
432
|
-
create_post(content, {'permalink' => 'pretty', 'source' => source_dir, 'destination' => dest_dir, 'read_posts' => true})
|
433
|
-
end
|
434
|
-
|
435
|
-
should "include file with empty parameters within if statement" do
|
436
|
-
assert_match "<span id=\"include-param\"></span>", @result
|
437
|
-
end
|
438
|
-
end
|
439
|
-
|
440
|
-
context "with fenced code blocks with backticks" do
|
441
|
-
|
442
|
-
setup do
|
443
|
-
content = <<CONTENT
|
444
|
-
```ruby
|
445
|
-
puts "Hello world"
|
446
|
-
```
|
447
|
-
CONTENT
|
448
|
-
create_post(content, {
|
449
|
-
'markdown' => 'maruku',
|
450
|
-
'maruku' => {'fenced_code_blocks' => true}}
|
451
|
-
)
|
452
|
-
end
|
453
|
-
|
454
|
-
should "render fenced code blocks" do
|
455
|
-
assert_match %r{<pre class=\"ruby\"><code class=\"ruby\">puts "Hello world"</code></pre>}, @result.strip
|
456
|
-
end
|
457
|
-
end
|
458
|
-
|
459
|
-
context "include missing file" do
|
460
|
-
setup do
|
461
|
-
@content = <<CONTENT
|
462
|
-
---
|
463
|
-
title: missing file
|
464
|
-
---
|
465
|
-
|
466
|
-
{% include missing.html %}
|
467
|
-
CONTENT
|
468
|
-
end
|
469
|
-
|
470
|
-
should "raise error relative to source directory" do
|
471
|
-
exception = assert_raise IOError do
|
472
|
-
create_post(@content, {'permalink' => 'pretty', 'source' => source_dir, 'destination' => dest_dir, 'read_posts' => true})
|
473
|
-
end
|
474
|
-
assert_equal 'Included file \'_includes/missing.html\' not found', exception.message
|
475
|
-
end
|
476
|
-
end
|
477
|
-
|
478
|
-
context "include tag with variable and liquid filters" do
|
479
|
-
setup do
|
480
|
-
stub(Jekyll).configuration do
|
481
|
-
site_configuration({'pygments' => true})
|
482
|
-
end
|
483
|
-
|
484
|
-
site = Site.new(Jekyll.configuration)
|
485
|
-
post = Post.new(site, source_dir, '', "2013-12-17-include-variable-filters.markdown")
|
486
|
-
layouts = { "default" => Layout.new(site, source_dir('_layouts'), "simple.html")}
|
487
|
-
post.render(layouts, {"site" => {"posts" => []}})
|
488
|
-
@content = post.content
|
489
|
-
end
|
490
|
-
|
491
|
-
should "include file as variable with liquid filters" do
|
492
|
-
assert_match %r{1 included}, @content
|
493
|
-
assert_match %r{2 included}, @content
|
494
|
-
assert_match %r{3 included}, @content
|
495
|
-
end
|
496
|
-
|
497
|
-
should "include file as variable and liquid filters with arbitrary whitespace" do
|
498
|
-
assert_match %r{4 included}, @content
|
499
|
-
assert_match %r{5 included}, @content
|
500
|
-
assert_match %r{6 included}, @content
|
501
|
-
end
|
502
|
-
|
503
|
-
should "include file as variable and filters with additional parameters" do
|
504
|
-
assert_match '<li>var1 = foo</li>', @content
|
505
|
-
assert_match '<li>var2 = bar</li>', @content
|
506
|
-
end
|
507
|
-
end
|
508
|
-
end
|
509
|
-
end
|