mirror of
https://github.com/jekyll/jekyll.git
synced 2026-04-28 03:01:03 -04:00
Compare commits
181 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
03bca72af6 | ||
|
|
2d3d65a930 | ||
|
|
5767346e9d | ||
|
|
dc894e41af | ||
|
|
5f828c6c2e | ||
|
|
2045984cee | ||
|
|
4df274f96d | ||
|
|
ee5828b2f7 | ||
|
|
3cb2e74b5c | ||
|
|
a4c9925e99 | ||
|
|
502f7991ad | ||
|
|
592afc270e | ||
|
|
2785d702e2 | ||
|
|
0fbdc69440 | ||
|
|
c99af68967 | ||
|
|
56a82b1e8a | ||
|
|
e9ae079fc3 | ||
|
|
fab2b1d3a0 | ||
|
|
18c033dc5c | ||
|
|
592630d48c | ||
|
|
d2aa8dcc43 | ||
|
|
9b107a129a | ||
|
|
10d6dcc4a9 | ||
|
|
16dbe54560 | ||
|
|
812c0e9281 | ||
|
|
7c021657e1 | ||
|
|
5dff30d90c | ||
|
|
3cc1b56810 | ||
|
|
fea4af0e63 | ||
|
|
a776fdabb9 | ||
|
|
2eb57279fe | ||
|
|
863ae5652f | ||
|
|
d0faba12a3 | ||
|
|
63991822e7 | ||
|
|
1404e041e8 | ||
|
|
55d78f3c9f | ||
|
|
e9f427c75b | ||
|
|
a661cd8295 | ||
|
|
1be83e4e33 | ||
|
|
9109495894 | ||
|
|
7586538432 | ||
|
|
4bd5614f4c | ||
|
|
c8e0fcfcdf | ||
|
|
7fa30c0dec | ||
|
|
a0d679439f | ||
|
|
072ddb799f | ||
|
|
ac744a6313 | ||
|
|
c8b22a19ad | ||
|
|
a262ea02d9 | ||
|
|
de9c591ffc | ||
|
|
70e535bee3 | ||
|
|
749def2ef5 | ||
|
|
c0750c1a3f | ||
|
|
475e08bba3 | ||
|
|
2a1e7cb5c9 | ||
|
|
c4ae4aee2b | ||
|
|
8e3ad082e2 | ||
|
|
b48123c1e1 | ||
|
|
aa3b001a04 | ||
|
|
c0707844e6 | ||
|
|
bf465cd904 | ||
|
|
d8140f4142 | ||
|
|
e6698fc65a | ||
|
|
ab66326f97 | ||
|
|
9d07a97945 | ||
|
|
86cbffbae0 | ||
|
|
10d4e023c8 | ||
|
|
51c7757543 | ||
|
|
27f307b428 | ||
|
|
a92fe17ae0 | ||
|
|
275a2e79ee | ||
|
|
7f48331ed4 | ||
|
|
e511550c91 | ||
|
|
7f68b471aa | ||
|
|
73893a921c | ||
|
|
70ca41dd44 | ||
|
|
22af1f07bf | ||
|
|
cfecc151d9 | ||
|
|
fde3a02b71 | ||
|
|
56b0582272 | ||
|
|
b67dae1f65 | ||
|
|
d1057e821a | ||
|
|
5314bbf952 | ||
|
|
c7cc36abdb | ||
|
|
a97ae67552 | ||
|
|
4cc6a0f263 | ||
|
|
04d744fda3 | ||
|
|
4b67c31277 | ||
|
|
84e0b1c904 | ||
|
|
61a8512805 | ||
|
|
08a4c02d38 | ||
|
|
1cbff6b771 | ||
|
|
9df9edc4c7 | ||
|
|
685cdbe124 | ||
|
|
2716f65010 | ||
|
|
8006024715 | ||
|
|
2616a4cf5e | ||
|
|
57a9deb98d | ||
|
|
ece22497dd | ||
|
|
fb170007c8 | ||
|
|
36c5017300 | ||
|
|
e8e245e20f | ||
|
|
2141ea6564 | ||
|
|
d3959d5899 | ||
|
|
cbb4b10ce6 | ||
|
|
861c81b590 | ||
|
|
28131624b8 | ||
|
|
ce1f01c494 | ||
|
|
a13a4ca532 | ||
|
|
f830120044 | ||
|
|
7645a72b2f | ||
|
|
ff8a8b8302 | ||
|
|
a7cc026e2c | ||
|
|
c78bf2775f | ||
|
|
0082bb22fb | ||
|
|
febf80cccd | ||
|
|
4d8dab6e33 | ||
|
|
f385fd9efd | ||
|
|
a66d96ce0a | ||
|
|
05f1fac2a7 | ||
|
|
03ae38a41e | ||
|
|
fbb8c056d4 | ||
|
|
0e68d34e1b | ||
|
|
a62027d5f3 | ||
|
|
db38498d06 | ||
|
|
af11f66646 | ||
|
|
2a422e1d83 | ||
|
|
f463aea399 | ||
|
|
f93da3cfb1 | ||
|
|
253b10818c | ||
|
|
2c0e086761 | ||
|
|
8882f4dd14 | ||
|
|
2cf76cb701 | ||
|
|
bb9517b73f | ||
|
|
f681b35b65 | ||
|
|
8c5d36f0ee | ||
|
|
08d0ff0922 | ||
|
|
e5683b1da5 | ||
|
|
3dffa8284f | ||
|
|
e332197660 | ||
|
|
8b36b71833 | ||
|
|
7eb5e07e9d | ||
|
|
0b9eb3c111 | ||
|
|
5f7a3f2b69 | ||
|
|
02676572dd | ||
|
|
404661fc72 | ||
|
|
5c3f013325 | ||
|
|
ea4aa4f149 | ||
|
|
0c8fc63b33 | ||
|
|
c239746363 | ||
|
|
12b47cc037 | ||
|
|
2c636086bd | ||
|
|
6a7386e6ba | ||
|
|
21ab9f8b9e | ||
|
|
eab113e4f5 | ||
|
|
bd4a8c1ce2 | ||
|
|
e2de7ab0c7 | ||
|
|
a6e80b2bc1 | ||
|
|
3f5a55e240 | ||
|
|
b79be6d320 | ||
|
|
60bb78e25b | ||
|
|
281fb549f8 | ||
|
|
d16f62cb38 | ||
|
|
912bd84629 | ||
|
|
d77078518d | ||
|
|
e310af00b4 | ||
|
|
cedbdf43ca | ||
|
|
911559fe05 | ||
|
|
c958eae551 | ||
|
|
053ba9a9ca | ||
|
|
c5aa74f823 | ||
|
|
20180923cf | ||
|
|
6e104c3ed0 | ||
|
|
880a503094 | ||
|
|
edbc273829 | ||
|
|
5f807e7421 | ||
|
|
b202b508f2 | ||
|
|
a7d20df95a | ||
|
|
674b540c6f | ||
|
|
8b860d3f0e | ||
|
|
a79279b1cc |
@@ -2,6 +2,64 @@
|
||||
|
||||
### Major Enhancements
|
||||
|
||||
### Minor Enhancements
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
### Development Fixes
|
||||
|
||||
### Site Enhancements
|
||||
|
||||
## 2.2.0 / 2014-07-29
|
||||
|
||||
### Minor Enhancements
|
||||
|
||||
* Throw a warning if the specified layout does not exist (#2620)
|
||||
* Whitelist Pygments options in safe mode (#2642)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Remove unnecessary `Jekyll::Tags::IncludeTag#blank?` method (#2625)
|
||||
* Categories in the path are ignored (#2633)
|
||||
|
||||
### Development Fixes
|
||||
|
||||
* Refactoring Errors & Requires of Third-Party stuff (#2591)
|
||||
* Add further tests for categories (#2584)
|
||||
* Proof site with html-proofer on change (#2605)
|
||||
* Fix up bug in #2605 which caused proofing the site not to function (#2608)
|
||||
* Use `bundle exec` in `script/proof` (#2610)
|
||||
|
||||
### Site Enhancements
|
||||
|
||||
* Update Kramdown urls (#2588)
|
||||
* Add `Jekyll::AutolinkEmail` and `Jekyll::GitMetadata` to the list of
|
||||
third-party plugins (#2596)
|
||||
* Fix a bunch of broken links in the site (#2601)
|
||||
* Replace dead links with working links (#2611)
|
||||
* Add jekyll-hook to deployment methods (#2617)
|
||||
* Added kramdown-with-pygments plugin to the list of third-party plugins (#2623)
|
||||
* Update outdated "Extras" page and remove duplicate documentation (#2622)
|
||||
* Add co2 plugin to list of third-party plugins (#2639)
|
||||
* Attempt to clarify the way Sass imports happen (#2642)
|
||||
|
||||
## 2.1.1 / 2014-07-01
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Patch read vulnerabilities for data & confirm none for layouts (#2563)
|
||||
* Update Maruku dependency to allow use of the latest version (#2576)
|
||||
* Remove conditional assignment from document URL to prevent stale urls (#2575)
|
||||
|
||||
### Site Enhancements
|
||||
|
||||
* Add vertical margin to `highlight` to separate code blocks (#2558)
|
||||
* Add `html_pages` to Variables docs (#2567)
|
||||
* Fixed broken link to Permalinks page (#2572)
|
||||
* Update link to Windows installation guide (#2578)
|
||||
|
||||
## 2.1.0 / 2014-06-28
|
||||
|
||||
### Minor Enhancements
|
||||
|
||||
* Bump to the latest Liquid version, 2.6.1 (#2495)
|
||||
@@ -27,6 +85,8 @@
|
||||
* Make `highlight` tag use `language-` prefix in CSS class (#2511)
|
||||
* Lookup item property via `item#to_liquid` before `#data` or `#[]` in filters (#2493)
|
||||
* Skip initial build of site on serve with flag (#2477)
|
||||
* Add support for `hl_lines` in `highlight` tag (#2532)
|
||||
* Spike out `--watch` flag into a separate gem (#2550)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
@@ -46,6 +106,11 @@
|
||||
* Ignore *all* directories and files that merit it on auto-generation (#2459)
|
||||
* Before copying file, explicitly remove the old one (#2535)
|
||||
* Merge file system categories with categories from YAML. (#2531)
|
||||
* Deep merge front matter defaults (#2490)
|
||||
* Ensure exclude and include arrays are arrays of strings (#2542)
|
||||
* Allow collections to have dots in their filenames (#2552)
|
||||
* Collections shouldn't try to read in directories as files (#2552)
|
||||
* Be quiet very quickly. (#2520)
|
||||
|
||||
### Development Fixes
|
||||
|
||||
@@ -53,6 +118,7 @@
|
||||
* Add test for sorting UTF-8 characters (#2384)
|
||||
* Use `https` for GitHub links in documentation (#2470)
|
||||
* Remove coverage reporting with Coveralls (#2494)
|
||||
* Fix a bit of missing TomDoc to `Jekyll::Commands::Build#build` (#2554)
|
||||
|
||||
### Site Enhancements
|
||||
|
||||
@@ -74,6 +140,9 @@
|
||||
* Add link to jekyll-compress-html to list of third-party plugins (#2514)
|
||||
* Add Piwigo Gallery to list of third-party plugins (#2526)
|
||||
* Set `show_drafts` to `false` in default configuration listing (#2536)
|
||||
* Provide an updated link for Windows installation instructions (#2544)
|
||||
* Remove `url` from configuration docs (#2547)
|
||||
* Documentation for Continuous Integration for your Jekyll Site (#2432)
|
||||
|
||||
## 2.0.3 / 2014-05-08
|
||||
|
||||
@@ -1082,9 +1151,9 @@
|
||||
* Configuration options set in config.yml are now available through the
|
||||
site payload (@vilcans)
|
||||
* Posts can now have an empty YAML front matter or none at all
|
||||
(@bahuvrihi)
|
||||
(@ bahuvrihi)
|
||||
* Bug Fixes
|
||||
* Fixing Ruby 1.9 issue that requires to_s on the err object
|
||||
* Fixing Ruby 1.9 issue that requires `#to_s` on the err object
|
||||
(@Chrononaut)
|
||||
* Fixes for pagination and ordering posts on the same day (@ujh)
|
||||
* Made pages respect permalinks style and permalinks in yml front matter
|
||||
@@ -1094,7 +1163,7 @@
|
||||
* Added trailing slash to pretty permalink style so Apache is happy
|
||||
(@eugenebolshakov)
|
||||
* Bad markdown processor in config fails sooner and with better message
|
||||
(@gcnovus)
|
||||
(@ gcnovus)
|
||||
* Allow CRLFs in yaml frontmatter (@juretta)
|
||||
* Added Date#xmlschema for Ruby versions < 1.9
|
||||
|
||||
|
||||
25
Rakefile
25
Rakefile
@@ -14,7 +14,7 @@ require 'jekyll/version'
|
||||
#############################################################################
|
||||
|
||||
def name
|
||||
@name ||= Dir['*.gemspec'].first.split('.').first
|
||||
@name ||= File.basename(Dir['*.gemspec'].first, ".*")
|
||||
end
|
||||
|
||||
def version
|
||||
@@ -53,13 +53,32 @@ def liquid_escape(markdown)
|
||||
markdown.gsub(/(`{[{%].+[}%]}`)/, "{% raw %}\\1{% endraw %}")
|
||||
end
|
||||
|
||||
def custom_release_header_anchors(markdown)
|
||||
header_regexp = /^(\d{1,2})\.(\d{1,2})\.(\d{1,2}) \/ \d{4}-\d{2}-\d{2}/
|
||||
section_regexp = /^### \w+ \w+$/
|
||||
markdown.split(/^##\s/).map do |release_notes|
|
||||
_, major, minor, patch = *release_notes.match(header_regexp)
|
||||
release_notes
|
||||
.gsub(header_regexp, "\\0\n{: #v\\1-\\2-\\3}")
|
||||
.gsub(section_regexp) { |section| "#{section}\n{: ##{sluffigy(section)}-v#{major}-#{minor}-#{patch}}" }
|
||||
end.join("\n## ")
|
||||
end
|
||||
|
||||
def sluffigy(header)
|
||||
header.gsub(/#/, '').strip.downcase.gsub(/\s+/, '-')
|
||||
end
|
||||
|
||||
def remove_head_from_history(markdown)
|
||||
index = markdown =~ /^##\s+\d+\.\d+\.\d+/
|
||||
markdown[index..-1]
|
||||
end
|
||||
|
||||
def converted_history(markdown)
|
||||
remove_head_from_history(liquid_escape(linkify(normalize_bullets(markdown))))
|
||||
remove_head_from_history(
|
||||
custom_release_header_anchors(
|
||||
liquid_escape(
|
||||
linkify(
|
||||
normalize_bullets(markdown)))))
|
||||
end
|
||||
|
||||
#############################################################################
|
||||
@@ -228,6 +247,7 @@ end
|
||||
#
|
||||
#############################################################################
|
||||
|
||||
desc "Release #{name} v#{version}"
|
||||
task :release => :build do
|
||||
unless `git branch` =~ /^\* master$/
|
||||
puts "You must be on the master branch to release!"
|
||||
@@ -240,6 +260,7 @@ task :release => :build do
|
||||
sh "gem push pkg/#{name}-#{version}.gem"
|
||||
end
|
||||
|
||||
desc "Build #{name} v#{version} into pkg/"
|
||||
task :build do
|
||||
mkdir_p "pkg"
|
||||
sh "gem build #{gemspec_file}"
|
||||
|
||||
@@ -128,3 +128,9 @@ Feature: frontmatter defaults
|
||||
When I run jekyll build
|
||||
Then the _site directory should exist
|
||||
And I should see "Value: Override" in "_site/slides/slide2.html"
|
||||
|
||||
Scenario: Deep merge frontmatter defaults
|
||||
Given I have an "index.html" page with fruit "{orange: 1}" that contains "Fruits: {{ page.fruit.orange | plus: page.fruit.apple }}"
|
||||
And I have a configuration file with "defaults" set to "[{scope: {path: ""}, values: {fruit: {apple: 2}}}]"
|
||||
When I run jekyll build
|
||||
Then I should see "Fruits: 3" in "_site/index.html"
|
||||
|
||||
@@ -45,7 +45,7 @@ Feature: Markdown
|
||||
When I run jekyll build
|
||||
Then the _site directory should exist
|
||||
And I should see "My awesome code" in "_site/index.html"
|
||||
And I should see "<pre><code>\nMy awesome code\n</code></pre>" in "_site/index.html"
|
||||
And I should see "<pre><code>My awesome code</code></pre>" in "_site/index.html"
|
||||
|
||||
Scenario: Maruku fenced codeblocks
|
||||
Given I have a configuration file with "markdown" set to "maruku"
|
||||
@@ -64,4 +64,4 @@ Feature: Markdown
|
||||
When I run jekyll build
|
||||
Then the _site directory should exist
|
||||
And I should see "My awesome string" in "_site/index.html"
|
||||
And I should see "<pre class="ruby"><code class="ruby">\nputs "My awesome string"\n</code></pre>" in "_site/index.html"
|
||||
And I should see "<pre class="ruby"><code class="ruby">puts "My awesome string"</code></pre>" in "_site/index.html"
|
||||
|
||||
@@ -70,17 +70,41 @@ Feature: Post data
|
||||
Then the _site directory should exist
|
||||
And I should see "Post category: movies" in "_site/movies/2009/03/27/star-wars.html"
|
||||
|
||||
Scenario: Use post.categories variable when category is in a folder and has category in YAML
|
||||
Given I have a movies directory
|
||||
And I have a movies/_posts directory
|
||||
And I have a _layouts directory
|
||||
And I have the following post in "movies":
|
||||
| title | date | layout | category | content |
|
||||
| Star Wars | 2009-03-27 | simple | film | Luke, I am your father. |
|
||||
And I have a simple layout that contains "Post category: {{ page.categories }}"
|
||||
When I run jekyll build
|
||||
Then the _site directory should exist
|
||||
And I should see "Post category: movies" in "_site/movies/film/2009/03/27/star-wars.html"
|
||||
|
||||
Scenario: Use post.categories variable when category is in a folder and has categories in YAML
|
||||
Given I have a movies directory
|
||||
And I have a movies/_posts directory
|
||||
And I have a _layouts directory
|
||||
And I have the following post in "movies":
|
||||
| title | date | layout | categories | content |
|
||||
| Star Wars | 2009-03-27 | simple | [film] | Luke, I am your father. |
|
||||
| title | date | layout | categories | content |
|
||||
| Star Wars | 2009-03-27 | simple | [film, scifi] | Luke, I am your father. |
|
||||
And I have a simple layout that contains "Post category: {{ page.categories }}"
|
||||
When I run jekyll build
|
||||
Then the _site directory should exist
|
||||
And I should see "Post category: movies" in "_site/movies/film/2009/03/27/star-wars.html"
|
||||
And I should see "Post category: movies" in "_site/movies/film/scifi/2009/03/27/star-wars.html"
|
||||
|
||||
Scenario: Use post.categories variable when category is in a folder and duplicated category is in YAML
|
||||
Given I have a movies directory
|
||||
And I have a movies/_posts directory
|
||||
And I have a _layouts directory
|
||||
And I have the following post in "movies":
|
||||
| title | date | layout | category | content |
|
||||
| Star Wars | 2009-03-27 | simple | movies | Luke, I am your father. |
|
||||
And I have a simple layout that contains "Post category: {{ page.categories }}"
|
||||
When I run jekyll build
|
||||
Then the _site directory should exist
|
||||
And I should see "Post category: movies" in "_site/movies/2009/03/27/star-wars.html"
|
||||
|
||||
Scenario: Use post.tags variable
|
||||
Given I have a _posts directory
|
||||
@@ -141,12 +165,23 @@ Feature: Post data
|
||||
Then the _site directory should exist
|
||||
And I should see "Post category: movies" in "_site/movies/2009/03/27/star-wars.html"
|
||||
|
||||
Scenario: Use post.categories variable when category is in YAML
|
||||
Scenario: Use post.categories variable when categories are in YAML
|
||||
Given I have a _posts directory
|
||||
And I have a _layouts directory
|
||||
And I have the following post:
|
||||
| title | date | layout | category | content |
|
||||
| Star Wars | 2009-03-27 | simple | movies | Luke, I am your father. |
|
||||
| title | date | layout | categories | content |
|
||||
| Star Wars | 2009-03-27 | simple | ['scifi', 'movies'] | Luke, I am your father. |
|
||||
And I have a simple layout that contains "Post categories: {{ page.categories | array_to_sentence_string }}"
|
||||
When I run jekyll build
|
||||
Then the _site directory should exist
|
||||
And I should see "Post categories: scifi and movies" in "_site/scifi/movies/2009/03/27/star-wars.html"
|
||||
|
||||
Scenario: Use post.categories variable when categories are in YAML and are duplicated
|
||||
Given I have a _posts directory
|
||||
And I have a _layouts directory
|
||||
And I have the following post:
|
||||
| title | date | layout | categories | content |
|
||||
| Star Wars | 2009-03-27 | simple | ['movies', 'movies'] | Luke, I am your father. |
|
||||
And I have a simple layout that contains "Post category: {{ page.categories }}"
|
||||
When I run jekyll build
|
||||
Then the _site directory should exist
|
||||
|
||||
@@ -273,3 +273,11 @@ Feature: Site configuration
|
||||
And I should see "Whatever" in "_site/index.html"
|
||||
And the "_site/test.txt" file should exist
|
||||
And I should see "this is a test" in "_site/test.txt"
|
||||
|
||||
Scenario: arbitrary file reads via layouts
|
||||
Given I have an "index.html" page with layout "page" that contains "FOO"
|
||||
And I have a "_config.yml" file that contains "layouts: '../../../../../../../../../../../../../../usr/include'"
|
||||
When I run jekyll build
|
||||
Then the _site directory should exist
|
||||
And I should see "FOO" in "_site/index.html"
|
||||
And I should not see " " in "_site/index.html"
|
||||
|
||||
@@ -28,20 +28,23 @@ Gem::Specification.new do |s|
|
||||
s.rdoc_options = ["--charset=UTF-8"]
|
||||
s.extra_rdoc_files = %w[README.markdown LICENSE]
|
||||
|
||||
s.add_runtime_dependency('liquid', "~> 2.6.1")
|
||||
s.add_runtime_dependency('classifier', "~> 1.3")
|
||||
s.add_runtime_dependency('listen', [">= 2.7.6", "< 3.0.0"])
|
||||
s.add_runtime_dependency('kramdown', "~> 1.3")
|
||||
s.add_runtime_dependency('pygments.rb', "~> 0.6.0")
|
||||
s.add_runtime_dependency('liquid', "~> 2.6.1")
|
||||
s.add_runtime_dependency('kramdown', "~> 1.3")
|
||||
s.add_runtime_dependency('mercenary', "~> 0.3.3")
|
||||
s.add_runtime_dependency('safe_yaml', "~> 1.0")
|
||||
s.add_runtime_dependency('colorator', "~> 0.1")
|
||||
|
||||
# Before 3.0 drops, phase the following gems out as dev dependencies
|
||||
# and gracefully handle their absence.
|
||||
s.add_runtime_dependency('classifier', "~> 1.3")
|
||||
s.add_runtime_dependency('pygments.rb', "~> 0.6.0")
|
||||
s.add_runtime_dependency('redcarpet', "~> 3.1")
|
||||
s.add_runtime_dependency('toml', '~> 0.1.0')
|
||||
s.add_runtime_dependency('jekyll-paginate', '~> 1.0')
|
||||
s.add_runtime_dependency('jekyll-gist', '~> 1.0')
|
||||
s.add_runtime_dependency('jekyll-coffeescript', '~> 1.0')
|
||||
s.add_runtime_dependency('jekyll-sass-converter', '~> 1.0')
|
||||
s.add_runtime_dependency('jekyll-watch', '~> 1.0')
|
||||
|
||||
s.add_development_dependency('rake', "~> 10.1")
|
||||
s.add_development_dependency('rdoc', "~> 3.11")
|
||||
@@ -50,7 +53,7 @@ Gem::Specification.new do |s|
|
||||
s.add_development_dependency('rr', "~> 1.1")
|
||||
s.add_development_dependency('cucumber', "1.3.11")
|
||||
s.add_development_dependency('RedCloth', "~> 4.2")
|
||||
s.add_development_dependency('maruku', "0.7.0")
|
||||
s.add_development_dependency('maruku', "~> 0.7.0")
|
||||
s.add_development_dependency('rdiscount', "~> 1.6")
|
||||
s.add_development_dependency('launchy', "~> 2.3")
|
||||
s.add_development_dependency('simplecov', "~> 0.7")
|
||||
|
||||
103
lib/jekyll.rb
103
lib/jekyll.rb
@@ -18,69 +18,56 @@ require 'rubygems'
|
||||
# stdlib
|
||||
require 'fileutils'
|
||||
require 'time'
|
||||
require 'safe_yaml/load'
|
||||
require 'English'
|
||||
require 'pathname'
|
||||
require 'logger'
|
||||
|
||||
# 3rd party
|
||||
require 'safe_yaml/load'
|
||||
require 'liquid'
|
||||
require 'kramdown'
|
||||
require 'colorator'
|
||||
require 'toml'
|
||||
|
||||
# internal requires
|
||||
require 'jekyll/version'
|
||||
require 'jekyll/utils'
|
||||
require 'jekyll/log_adapter'
|
||||
require 'jekyll/stevenson'
|
||||
require 'jekyll/deprecator'
|
||||
require 'jekyll/configuration'
|
||||
require 'jekyll/document'
|
||||
require 'jekyll/collection'
|
||||
require 'jekyll/plugin_manager'
|
||||
require 'jekyll/frontmatter_defaults'
|
||||
require 'jekyll/site'
|
||||
require 'jekyll/convertible'
|
||||
require 'jekyll/url'
|
||||
require 'jekyll/layout'
|
||||
require 'jekyll/page'
|
||||
require 'jekyll/post'
|
||||
require 'jekyll/excerpt'
|
||||
require 'jekyll/draft'
|
||||
require 'jekyll/filters'
|
||||
require 'jekyll/static_file'
|
||||
require 'jekyll/errors'
|
||||
require 'jekyll/related_posts'
|
||||
require 'jekyll/cleaner'
|
||||
require 'jekyll/entry_filter'
|
||||
require 'jekyll/layout_reader'
|
||||
require 'jekyll/publisher'
|
||||
require 'jekyll/renderer'
|
||||
|
||||
# extensions
|
||||
require 'jekyll/plugin'
|
||||
require 'jekyll/converter'
|
||||
require 'jekyll/generator'
|
||||
require 'jekyll/command'
|
||||
require 'jekyll/liquid_extensions'
|
||||
|
||||
require_all 'jekyll/commands'
|
||||
require_all 'jekyll/converters'
|
||||
require_all 'jekyll/converters/markdown'
|
||||
require_all 'jekyll/generators'
|
||||
require_all 'jekyll/tags'
|
||||
|
||||
# plugins
|
||||
require 'jekyll-coffeescript'
|
||||
require 'jekyll-sass-converter'
|
||||
require 'jekyll-paginate'
|
||||
require 'jekyll-gist'
|
||||
|
||||
SafeYAML::OPTIONS[:suppress_warnings] = true
|
||||
|
||||
module Jekyll
|
||||
|
||||
# internal requires
|
||||
autoload :Cleaner, 'jekyll/cleaner'
|
||||
autoload :Collection, 'jekyll/collection'
|
||||
autoload :Configuration, 'jekyll/configuration'
|
||||
autoload :Convertible, 'jekyll/convertible'
|
||||
autoload :Deprecator, 'jekyll/deprecator'
|
||||
autoload :Document, 'jekyll/document'
|
||||
autoload :Draft, 'jekyll/draft'
|
||||
autoload :EntryFilter, 'jekyll/entry_filter'
|
||||
autoload :Errors, 'jekyll/errors'
|
||||
autoload :Excerpt, 'jekyll/excerpt'
|
||||
autoload :Filters, 'jekyll/filters'
|
||||
autoload :FrontmatterDefaults, 'jekyll/frontmatter_defaults'
|
||||
autoload :Layout, 'jekyll/layout'
|
||||
autoload :LayoutReader, 'jekyll/layout_reader'
|
||||
autoload :LogAdapter, 'jekyll/log_adapter'
|
||||
autoload :Page, 'jekyll/page'
|
||||
autoload :PluginManager, 'jekyll/plugin_manager'
|
||||
autoload :Post, 'jekyll/post'
|
||||
autoload :Publisher, 'jekyll/publisher'
|
||||
autoload :RelatedPosts, 'jekyll/related_posts'
|
||||
autoload :Renderer, 'jekyll/renderer'
|
||||
autoload :Site, 'jekyll/site'
|
||||
autoload :StaticFile, 'jekyll/static_file'
|
||||
autoload :Stevenson, 'jekyll/stevenson'
|
||||
autoload :URL, 'jekyll/url'
|
||||
autoload :Utils, 'jekyll/utils'
|
||||
autoload :VERSION, 'jekyll/version'
|
||||
|
||||
# extensions
|
||||
require 'jekyll/plugin'
|
||||
require 'jekyll/converter'
|
||||
require 'jekyll/generator'
|
||||
require 'jekyll/command'
|
||||
require 'jekyll/liquid_extensions'
|
||||
|
||||
# Public: Tells you which Jekyll environment you are building in so you can skip tasks
|
||||
# if you need to. This is useful when doing expensive compression tasks on css and
|
||||
# images and allows you to skip that when working in development.
|
||||
@@ -143,3 +130,19 @@ module Jekyll
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
require_all 'jekyll/commands'
|
||||
require_all 'jekyll/converters'
|
||||
require_all 'jekyll/converters/markdown'
|
||||
require_all 'jekyll/generators'
|
||||
require_all 'jekyll/tags'
|
||||
|
||||
# Eventually remove these for 3.0 as non-core
|
||||
Jekyll::Deprecator.gracefully_require(%w[
|
||||
classifier
|
||||
toml
|
||||
jekyll-paginate
|
||||
jekyll-gist
|
||||
jekyll-coffeescript
|
||||
jekyll-sass-converter
|
||||
])
|
||||
|
||||
@@ -52,7 +52,7 @@ module Jekyll
|
||||
def filtered_entries
|
||||
return Array.new unless exists?
|
||||
Dir.chdir(directory) do
|
||||
entry_filter.filter(entries)
|
||||
entry_filter.filter(entries).reject { |f| File.directory?(f) }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -105,7 +105,7 @@ module Jekyll
|
||||
#
|
||||
# Returns a sanitized version of the label.
|
||||
def sanitize_label(label)
|
||||
label.gsub(/[^a-z0-9_\-]/i, '')
|
||||
label.gsub(/[^a-z0-9_\-\.]/i, '')
|
||||
end
|
||||
|
||||
# Produce a representation of this Collection for use in Liquid.
|
||||
|
||||
@@ -51,7 +51,7 @@ module Jekyll
|
||||
# Returns nothing
|
||||
def process_site(site)
|
||||
site.process
|
||||
rescue Jekyll::FatalException => e
|
||||
rescue Jekyll::Errors::FatalException => e
|
||||
Jekyll.logger.error "ERROR:", "YOUR SITE COULD NOT BE BUILT:"
|
||||
Jekyll.logger.error "", "------------------------------------"
|
||||
Jekyll.logger.error "", e.message
|
||||
|
||||
@@ -38,7 +38,7 @@ module Jekyll
|
||||
# Build your Jekyll site.
|
||||
#
|
||||
# site - the Jekyll::Site instance to build
|
||||
# options - the
|
||||
# options - A Hash of options passed to the command
|
||||
#
|
||||
# Returns nothing.
|
||||
def build(site, options)
|
||||
@@ -58,38 +58,8 @@ module Jekyll
|
||||
#
|
||||
# Returns nothing.
|
||||
def watch(site, options)
|
||||
require 'listen'
|
||||
|
||||
listener = Listen.to(
|
||||
options['source'],
|
||||
:ignore => ignore_paths(options),
|
||||
:force_polling => options['force_polling']
|
||||
) do |modified, added, removed|
|
||||
t = Time.now.strftime("%Y-%m-%d %H:%M:%S")
|
||||
n = modified.length + added.length + removed.length
|
||||
print Jekyll.logger.formatted_topic("Regenerating:") + "#{n} files at #{t} "
|
||||
begin
|
||||
process_site(site)
|
||||
puts "...done."
|
||||
rescue => e
|
||||
puts "...error:"
|
||||
Jekyll.logger.warn "Error:", e.message
|
||||
Jekyll.logger.warn "Error:", "Run jekyll build --trace for more information."
|
||||
end
|
||||
end
|
||||
listener.start
|
||||
|
||||
Jekyll.logger.info "Auto-regeneration:", "enabled for '#{source}'"
|
||||
|
||||
unless options['serving']
|
||||
trap("INT") do
|
||||
listener.stop
|
||||
puts " Halting auto-regeneration."
|
||||
exit 0
|
||||
end
|
||||
|
||||
loop { sleep 1000 }
|
||||
end
|
||||
Deprecator.gracefully_require 'jekyll-watch'
|
||||
Jekyll::Commands::Watch.watch(site, options)
|
||||
end
|
||||
|
||||
end # end of class << self
|
||||
|
||||
@@ -40,6 +40,7 @@ module Jekyll
|
||||
'markdown_ext' => 'markdown,mkdown,mkdn,mkd,md',
|
||||
'textile_ext' => 'textile',
|
||||
|
||||
'quiet' => false,
|
||||
'port' => '4000',
|
||||
'host' => '0.0.0.0',
|
||||
|
||||
@@ -103,6 +104,10 @@ module Jekyll
|
||||
override['source'] || self['source'] || DEFAULTS['source']
|
||||
end
|
||||
|
||||
def quiet?(override = {})
|
||||
override['quiet'] || self['quiet'] || DEFAULTS['quiet']
|
||||
end
|
||||
|
||||
def safe_load_file(filename)
|
||||
case File.extname(filename)
|
||||
when '.toml'
|
||||
@@ -120,6 +125,9 @@ module Jekyll
|
||||
#
|
||||
# Returns an Array of config files
|
||||
def config_files(override)
|
||||
# Be quiet quickly.
|
||||
Jekyll.logger.log_level = :error if quiet?(override)
|
||||
|
||||
# Get configuration from <source>/_config.yml or <source>/<config_file>
|
||||
config_files = override.delete('config')
|
||||
if config_files.to_s.empty?
|
||||
@@ -234,6 +242,7 @@ module Jekyll
|
||||
" as a list of comma-separated values."
|
||||
config[option] = csv_to_array(config[option])
|
||||
end
|
||||
config[option].map!(&:to_s)
|
||||
end
|
||||
|
||||
if config.fetch('markdown', 'kramdown').to_s.downcase.eql?("maruku")
|
||||
|
||||
@@ -11,22 +11,41 @@ module Jekyll
|
||||
@parser =
|
||||
case @config['markdown'].downcase
|
||||
when 'redcarpet' then RedcarpetParser.new(@config)
|
||||
when 'kramdown' then KramdownParser.new(@config)
|
||||
when 'kramdown' then KramdownParser.new(@config)
|
||||
when 'rdiscount' then RDiscountParser.new(@config)
|
||||
when 'maruku' then MarukuParser.new(@config)
|
||||
when 'maruku' then MarukuParser.new(@config)
|
||||
else
|
||||
# So they can't try some tricky bullshit or go down the ancestor chain, I hope.
|
||||
if allowed_custom_class?(@config['markdown'])
|
||||
self.class.const_get(@config['markdown']).new(@config)
|
||||
else
|
||||
Jekyll.logger.error "Invalid Markdown Processor:", "#{@config['markdown']}"
|
||||
Jekyll.logger.error "", "Valid options are [ maruku | rdiscount | kramdown | redcarpet ]"
|
||||
raise FatalException, "Invalid Markdown Processor: #{@config['markdown']}"
|
||||
Jekyll.logger.error "", "Valid options are [ #{valid_processors.join(" | ")} ]"
|
||||
raise Errors::FatalException, "Invalid Markdown Processor: #{@config['markdown']}"
|
||||
end
|
||||
end
|
||||
@setup = true
|
||||
end
|
||||
|
||||
def valid_processors
|
||||
%w[
|
||||
maruku
|
||||
rdiscount
|
||||
kramdown
|
||||
redcarpet
|
||||
] + third_party_processors
|
||||
end
|
||||
|
||||
def third_party_processors
|
||||
self.class.constants - %w[
|
||||
KramdownParser
|
||||
MarukuParser
|
||||
RDiscountParser
|
||||
RedcarpetParser
|
||||
PRIORITIES
|
||||
].map(&:to_sym)
|
||||
end
|
||||
|
||||
def matches(ext)
|
||||
rgx = '^\.(' + @config['markdown_ext'].gsub(',','|') +')$'
|
||||
ext =~ Regexp.new(rgx, Regexp::IGNORECASE)
|
||||
|
||||
@@ -8,7 +8,7 @@ module Jekyll
|
||||
rescue LoadError
|
||||
STDERR.puts 'You are missing a library required for Markdown. Please run:'
|
||||
STDERR.puts ' $ [sudo] gem install kramdown'
|
||||
raise FatalException.new("Missing dependency: kramdown")
|
||||
raise Errors::FatalException.new("Missing dependency: kramdown")
|
||||
end
|
||||
|
||||
def convert(content)
|
||||
|
||||
@@ -15,7 +15,7 @@ module Jekyll
|
||||
rescue LoadError
|
||||
STDERR.puts 'You are missing a library required for Markdown. Please run:'
|
||||
STDERR.puts ' $ [sudo] gem install maruku'
|
||||
raise FatalException.new("Missing dependency: maruku")
|
||||
raise Errors::FatalException.new("Missing dependency: maruku")
|
||||
end
|
||||
|
||||
def load_divs_library
|
||||
|
||||
@@ -3,13 +3,9 @@ module Jekyll
|
||||
class Markdown
|
||||
class RDiscountParser
|
||||
def initialize(config)
|
||||
require 'rdiscount'
|
||||
Jekyll::Deprecator.gracefully_require "rdiscount"
|
||||
@config = config
|
||||
@rdiscount_extensions = @config['rdiscount']['extensions'].map { |e| e.to_sym }
|
||||
rescue LoadError
|
||||
STDERR.puts 'You are missing a library required for Markdown. Please run:'
|
||||
STDERR.puts ' $ [sudo] gem install rdiscount'
|
||||
raise FatalException.new("Missing dependency: rdiscount")
|
||||
end
|
||||
|
||||
def convert(content)
|
||||
|
||||
@@ -14,7 +14,7 @@ module Jekyll
|
||||
module WithPygments
|
||||
include CommonMethods
|
||||
def block_code(code, lang)
|
||||
require 'pygments'
|
||||
Jekyll::Deprecator.gracefully_require("pygments")
|
||||
lang = lang && lang.split.first || "text"
|
||||
add_code_tags(
|
||||
Pygments.highlight(code, :lexer => lang, :options => { :encoding => 'utf-8' }),
|
||||
@@ -55,45 +55,40 @@ module Jekyll
|
||||
|
||||
|
||||
def initialize(config)
|
||||
require 'redcarpet'
|
||||
Deprecator.gracefully_require("redcarpet")
|
||||
@config = config
|
||||
@redcarpet_extensions = {}
|
||||
@config['redcarpet']['extensions'].each { |e| @redcarpet_extensions[e.to_sym] = true }
|
||||
|
||||
@renderer ||= case @config['highlighter']
|
||||
when 'pygments'
|
||||
Class.new(Redcarpet::Render::HTML) do
|
||||
include WithPygments
|
||||
end
|
||||
when 'rouge'
|
||||
Class.new(Redcarpet::Render::HTML) do
|
||||
begin
|
||||
require 'rouge'
|
||||
require 'rouge/plugins/redcarpet'
|
||||
rescue LoadError => e
|
||||
Jekyll.logger.error "You are missing the 'rouge' gem. Please run:"
|
||||
Jekyll.logger.error " $ [sudo] gem install rouge"
|
||||
Jekyll.logger.error "Or add 'rouge' to your Gemfile."
|
||||
raise FatalException.new("Missing dependency: rouge")
|
||||
end
|
||||
@renderer ||= class_with_proper_highlighter(@config['highlighter'])
|
||||
end
|
||||
|
||||
if Rouge.version < '1.3.0'
|
||||
abort "Please install Rouge 1.3.0 or greater and try running Jekyll again."
|
||||
end
|
||||
def class_with_proper_highlighter(highlighter)
|
||||
case highlighter
|
||||
when "pygments"
|
||||
Class.new(Redcarpet::Render::HTML) do
|
||||
include WithPygments
|
||||
end
|
||||
when "rouge"
|
||||
Class.new(Redcarpet::Render::HTML) do
|
||||
Jekyll::Deprecator.gracefully_require(%w[
|
||||
rouge
|
||||
rouge/plugins/redcarpet
|
||||
])
|
||||
|
||||
include Rouge::Plugins::Redcarpet
|
||||
include CommonMethods
|
||||
include WithRouge
|
||||
end
|
||||
else
|
||||
Class.new(Redcarpet::Render::HTML) do
|
||||
include WithoutHighlighting
|
||||
end
|
||||
end
|
||||
rescue LoadError
|
||||
STDERR.puts 'You are missing a library required for Markdown. Please run:'
|
||||
STDERR.puts ' $ [sudo] gem install redcarpet'
|
||||
raise FatalException.new("Missing dependency: redcarpet")
|
||||
if Rouge.version < '1.3.0'
|
||||
abort "Please install Rouge 1.3.0 or greater and try running Jekyll again."
|
||||
end
|
||||
|
||||
include Rouge::Plugins::Redcarpet
|
||||
include CommonMethods
|
||||
include WithRouge
|
||||
end
|
||||
else
|
||||
Class.new(Redcarpet::Render::HTML) do
|
||||
include WithoutHighlighting
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def convert(content)
|
||||
|
||||
@@ -13,7 +13,7 @@ module Jekyll
|
||||
rescue LoadError
|
||||
STDERR.puts 'You are missing a library required for Textile. Please run:'
|
||||
STDERR.puts ' $ [sudo] gem install RedCloth'
|
||||
raise FatalException.new("Missing dependency: RedCloth")
|
||||
raise Errors::FatalException.new("Missing dependency: RedCloth")
|
||||
end
|
||||
|
||||
def matches(ext)
|
||||
@@ -32,7 +32,7 @@ module Jekyll
|
||||
return RedCloth.new(content).to_html if @config['redcloth'].nil?
|
||||
|
||||
# List of attributes defined on RedCloth
|
||||
# (from http://redcloth.rubyforge.org/classes/RedCloth/TextileDoc.html)
|
||||
# (from https://github.com/jgarber/redcloth/blob/master/lib/redcloth/textile_doc.rb)
|
||||
attrs = ['filter_classes', 'filter_html', 'filter_ids', 'filter_styles',
|
||||
'hard_breaks', 'lite_mode', 'no_span_caps', 'sanitize_html']
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ module Jekyll
|
||||
# Returns nothing.
|
||||
def read_yaml(base, name, opts = {})
|
||||
begin
|
||||
self.content = File.read(File.join(base, name),
|
||||
self.content = File.read(Jekyll.sanitized_path(base, name),
|
||||
merged_file_read_opts(opts))
|
||||
if content =~ /\A(---\s*\n.*?\n?)^((---|\.\.\.)\s*$\n?)/m
|
||||
self.content = $POSTMATCH
|
||||
@@ -153,6 +153,15 @@ module Jekyll
|
||||
!asset_file?
|
||||
end
|
||||
|
||||
# Checks if the layout specified in the document actually exists
|
||||
#
|
||||
# layout - the layout to check
|
||||
#
|
||||
# Returns true if the layout is invalid, false if otherwise
|
||||
def invalid_layout?(layout)
|
||||
!data["layout"].nil? && data["layout"] != "none" && layout.nil? && !(self.is_a? Jekyll::Excerpt)
|
||||
end
|
||||
|
||||
# Recursively render layouts
|
||||
#
|
||||
# layouts - a list of the layouts
|
||||
@@ -163,6 +172,9 @@ module Jekyll
|
||||
def render_all_layouts(layouts, payload, info)
|
||||
# recursively render layouts
|
||||
layout = layouts[data["layout"]]
|
||||
|
||||
Jekyll.logger.warn("Build Warning:", "Layout '#{data["layout"]}' requested in #{path} does not exist.") if invalid_layout? layout
|
||||
|
||||
used = Set.new([layout])
|
||||
|
||||
while layout
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
module Jekyll
|
||||
class Deprecator
|
||||
module Deprecator
|
||||
def self.process(args)
|
||||
no_subcommand(args)
|
||||
arg_is_present? args, "--server", "The --server command has been replaced by the \
|
||||
@@ -32,5 +32,23 @@ module Jekyll
|
||||
def self.deprecation_message(message)
|
||||
Jekyll.logger.error "Deprecation:", message
|
||||
end
|
||||
|
||||
def self.gracefully_require(gem_name)
|
||||
Array(gem_name).each do |name|
|
||||
begin
|
||||
require name
|
||||
rescue LoadError => e
|
||||
Jekyll.logger.error "Dependency Error:", <<-MSG
|
||||
Yikes! It looks like you don't have #{name} or one of its dependencies installed.
|
||||
In order to use Jekyll as currently contfigured, you'll need to install this gem.
|
||||
|
||||
The full error message from Ruby is: '#{e.message}'
|
||||
|
||||
If you run into trouble, you can find helpful resources at http://jekyllrb.com/help/!
|
||||
MSG
|
||||
raise Errors::MissingDependencyException.new(name)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -127,7 +127,7 @@ module Jekyll
|
||||
#
|
||||
# Returns the computed URL for the document.
|
||||
def url
|
||||
@url ||= URL.new({
|
||||
@url = URL.new({
|
||||
template: url_template,
|
||||
placeholders: url_placeholders,
|
||||
permalink: permalink
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
module Jekyll
|
||||
class FatalException < StandardError
|
||||
module Errors
|
||||
class FatalException < RuntimeError
|
||||
end
|
||||
|
||||
class MissingDependencyException < FatalException
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
require 'jekyll/convertible'
|
||||
require 'forwardable'
|
||||
|
||||
module Jekyll
|
||||
|
||||
@@ -1,148 +1,146 @@
|
||||
module Jekyll
|
||||
class Configuration
|
||||
# This class handles custom defaults for YAML frontmatter settings.
|
||||
# These are set in _config.yml and apply both to internal use (e.g. layout)
|
||||
# and the data available to liquid.
|
||||
# This class handles custom defaults for YAML frontmatter settings.
|
||||
# These are set in _config.yml and apply both to internal use (e.g. layout)
|
||||
# and the data available to liquid.
|
||||
#
|
||||
# It is exposed via the frontmatter_defaults method on the site class.
|
||||
class FrontmatterDefaults
|
||||
# Initializes a new instance.
|
||||
def initialize(site)
|
||||
@site = site
|
||||
end
|
||||
|
||||
# Finds a default value for a given setting, filtered by path and type
|
||||
#
|
||||
# It is exposed via the frontmatter_defaults method on the site class.
|
||||
class FrontmatterDefaults
|
||||
# Initializes a new instance.
|
||||
def initialize(site)
|
||||
@site = site
|
||||
end
|
||||
# path - the path (relative to the source) of the page, post or :draft the default is used in
|
||||
# type - a symbol indicating whether a :page, a :post or a :draft calls this method
|
||||
#
|
||||
# Returns the default value or nil if none was found
|
||||
def find(path, type, setting)
|
||||
value = nil
|
||||
old_scope = nil
|
||||
|
||||
# Finds a default value for a given setting, filtered by path and type
|
||||
#
|
||||
# path - the path (relative to the source) of the page, post or :draft the default is used in
|
||||
# type - a symbol indicating whether a :page, a :post or a :draft calls this method
|
||||
#
|
||||
# Returns the default value or nil if none was found
|
||||
def find(path, type, setting)
|
||||
value = nil
|
||||
old_scope = nil
|
||||
|
||||
matching_sets(path, type).each do |set|
|
||||
if set['values'].has_key?(setting) && has_precedence?(old_scope, set['scope'])
|
||||
value = set['values'][setting]
|
||||
old_scope = set['scope']
|
||||
end
|
||||
end
|
||||
value
|
||||
end
|
||||
|
||||
# Collects a hash with all default values for a page or post
|
||||
#
|
||||
# path - the relative path of the page or post
|
||||
# type - a symbol indicating the type (:post, :page or :draft)
|
||||
#
|
||||
# Returns a hash with all default values (an empty hash if there are none)
|
||||
def all(path, type)
|
||||
defaults = {}
|
||||
old_scope = nil
|
||||
matching_sets(path, type).each do |set|
|
||||
if has_precedence?(old_scope, set['scope'])
|
||||
defaults.merge! set['values']
|
||||
old_scope = set['scope']
|
||||
else
|
||||
defaults = set['values'].merge(defaults)
|
||||
end
|
||||
end
|
||||
defaults
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# Checks if a given default setting scope matches the given path and type
|
||||
#
|
||||
# scope - the hash indicating the scope, as defined in _config.yml
|
||||
# path - the path to check for
|
||||
# type - the type (:post, :page or :draft) to check for
|
||||
#
|
||||
# Returns true if the scope applies to the given path and type
|
||||
def applies?(scope, path, type)
|
||||
applies_path?(scope, path) && applies_type?(scope, type)
|
||||
end
|
||||
|
||||
def applies_path?(scope, path)
|
||||
return true if scope['path'].empty?
|
||||
|
||||
scope_path = Pathname.new(scope['path'])
|
||||
Pathname.new(sanitize_path(path)).ascend do |path|
|
||||
if path == scope_path
|
||||
return true
|
||||
end
|
||||
matching_sets(path, type).each do |set|
|
||||
if set['values'].has_key?(setting) && has_precedence?(old_scope, set['scope'])
|
||||
value = set['values'][setting]
|
||||
old_scope = set['scope']
|
||||
end
|
||||
end
|
||||
value
|
||||
end
|
||||
|
||||
def applies_type?(scope, type)
|
||||
!scope.has_key?('type') || scope['type'] == type.to_s
|
||||
end
|
||||
|
||||
# Checks if a given set of default values is valid
|
||||
#
|
||||
# set - the default value hash, as defined in _config.yml
|
||||
#
|
||||
# Returns true if the set is valid and can be used in this class
|
||||
def valid?(set)
|
||||
set.is_a?(Hash) && set['scope'].is_a?(Hash) && set['scope']['path'].is_a?(String) && set['values'].is_a?(Hash)
|
||||
end
|
||||
|
||||
# Determines if a new scope has precedence over an old one
|
||||
#
|
||||
# old_scope - the old scope hash, or nil if there's none
|
||||
# new_scope - the new scope hash
|
||||
#
|
||||
# Returns true if the new scope has precedence over the older
|
||||
def has_precedence?(old_scope, new_scope)
|
||||
return true if old_scope.nil?
|
||||
|
||||
new_path = sanitize_path(new_scope['path'])
|
||||
old_path = sanitize_path(old_scope['path'])
|
||||
|
||||
if new_path.length != old_path.length
|
||||
new_path.length >= old_path.length
|
||||
elsif new_scope.has_key? 'type'
|
||||
true
|
||||
# Collects a hash with all default values for a page or post
|
||||
#
|
||||
# path - the relative path of the page or post
|
||||
# type - a symbol indicating the type (:post, :page or :draft)
|
||||
#
|
||||
# Returns a hash with all default values (an empty hash if there are none)
|
||||
def all(path, type)
|
||||
defaults = {}
|
||||
old_scope = nil
|
||||
matching_sets(path, type).each do |set|
|
||||
if has_precedence?(old_scope, set['scope'])
|
||||
defaults = Utils.deep_merge_hashes(defaults, set['values'])
|
||||
old_scope = set['scope']
|
||||
else
|
||||
!old_scope.has_key? 'type'
|
||||
defaults = Utils.deep_merge_hashes(set['values'], defaults)
|
||||
end
|
||||
end
|
||||
defaults
|
||||
end
|
||||
|
||||
# Collects a list of sets that match the given path and type
|
||||
#
|
||||
# Returns an array of hashes
|
||||
def matching_sets(path, type)
|
||||
valid_sets.select do |set|
|
||||
applies?(set['scope'], path, type)
|
||||
end
|
||||
end
|
||||
private
|
||||
|
||||
# Returns a list of valid sets
|
||||
#
|
||||
# This is not cached to allow plugins to modify the configuration
|
||||
# and have their changes take effect
|
||||
#
|
||||
# Returns an array of hashes
|
||||
def valid_sets
|
||||
sets = @site.config['defaults']
|
||||
return [] unless sets.is_a?(Array)
|
||||
# Checks if a given default setting scope matches the given path and type
|
||||
#
|
||||
# scope - the hash indicating the scope, as defined in _config.yml
|
||||
# path - the path to check for
|
||||
# type - the type (:post, :page or :draft) to check for
|
||||
#
|
||||
# Returns true if the scope applies to the given path and type
|
||||
def applies?(scope, path, type)
|
||||
applies_path?(scope, path) && applies_type?(scope, type)
|
||||
end
|
||||
|
||||
sets.select do |set|
|
||||
unless valid?(set)
|
||||
Jekyll.logger.warn "Default:", "An invalid default set was found"
|
||||
end
|
||||
valid?(set)
|
||||
end
|
||||
end
|
||||
def applies_path?(scope, path)
|
||||
return true if scope['path'].empty?
|
||||
|
||||
# Sanitizes the given path by removing a leading and addding a trailing slash
|
||||
def sanitize_path(path)
|
||||
if path.nil? || path.empty?
|
||||
""
|
||||
else
|
||||
path.gsub(/\A\//, '').gsub(/([^\/])\z/, '\1/')
|
||||
scope_path = Pathname.new(scope['path'])
|
||||
Pathname.new(sanitize_path(path)).ascend do |path|
|
||||
if path == scope_path
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def applies_type?(scope, type)
|
||||
!scope.has_key?('type') || scope['type'] == type.to_s
|
||||
end
|
||||
|
||||
# Checks if a given set of default values is valid
|
||||
#
|
||||
# set - the default value hash, as defined in _config.yml
|
||||
#
|
||||
# Returns true if the set is valid and can be used in this class
|
||||
def valid?(set)
|
||||
set.is_a?(Hash) && set['scope'].is_a?(Hash) && set['scope']['path'].is_a?(String) && set['values'].is_a?(Hash)
|
||||
end
|
||||
|
||||
# Determines if a new scope has precedence over an old one
|
||||
#
|
||||
# old_scope - the old scope hash, or nil if there's none
|
||||
# new_scope - the new scope hash
|
||||
#
|
||||
# Returns true if the new scope has precedence over the older
|
||||
def has_precedence?(old_scope, new_scope)
|
||||
return true if old_scope.nil?
|
||||
|
||||
new_path = sanitize_path(new_scope['path'])
|
||||
old_path = sanitize_path(old_scope['path'])
|
||||
|
||||
if new_path.length != old_path.length
|
||||
new_path.length >= old_path.length
|
||||
elsif new_scope.has_key? 'type'
|
||||
true
|
||||
else
|
||||
!old_scope.has_key? 'type'
|
||||
end
|
||||
end
|
||||
|
||||
# Collects a list of sets that match the given path and type
|
||||
#
|
||||
# Returns an array of hashes
|
||||
def matching_sets(path, type)
|
||||
valid_sets.select do |set|
|
||||
applies?(set['scope'], path, type)
|
||||
end
|
||||
end
|
||||
|
||||
# Returns a list of valid sets
|
||||
#
|
||||
# This is not cached to allow plugins to modify the configuration
|
||||
# and have their changes take effect
|
||||
#
|
||||
# Returns an array of hashes
|
||||
def valid_sets
|
||||
sets = @site.config['defaults']
|
||||
return [] unless sets.is_a?(Array)
|
||||
|
||||
sets.select do |set|
|
||||
unless valid?(set)
|
||||
Jekyll.logger.warn "Default:", "An invalid default set was found"
|
||||
end
|
||||
valid?(set)
|
||||
end
|
||||
end
|
||||
|
||||
# Sanitizes the given path by removing a leading and addding a trailing slash
|
||||
def sanitize_path(path)
|
||||
if path.nil? || path.empty?
|
||||
""
|
||||
else
|
||||
path.gsub(/\A\//, '').gsub(/([^\/])\z/, '\1/')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -78,8 +78,9 @@ module Jekyll
|
||||
|
||||
def populate_categories
|
||||
categories_from_data = Utils.pluralized_array_from_hash(data, 'category', 'categories')
|
||||
self.categories = (Array(categories) + categories_from_data).map {|c| c.to_s.downcase}
|
||||
categories.flatten!
|
||||
self.categories = (
|
||||
Array(categories) + categories_from_data
|
||||
).map {|c| c.to_s.downcase}.flatten.uniq
|
||||
end
|
||||
|
||||
def populate_tags
|
||||
@@ -158,6 +159,8 @@ module Jekyll
|
||||
# Returns nothing.
|
||||
def process(name)
|
||||
m, cats, date, slug, ext = *name.match(MATCHER)
|
||||
self.categories ||= []
|
||||
self.categories += (cats || '').downcase.split('/')
|
||||
self.date = Time.parse(date)
|
||||
self.slug = slug
|
||||
self.ext = ext
|
||||
@@ -165,7 +168,7 @@ module Jekyll
|
||||
path = File.join(@dir || "", name)
|
||||
msg = "Post '#{path}' does not have a valid date.\n"
|
||||
msg << "Fix the date, or exclude the file or directory from being processed"
|
||||
raise FatalException.new(msg)
|
||||
raise Errors::FatalException.new(msg)
|
||||
end
|
||||
|
||||
# The generated directory into which the post will be placed
|
||||
|
||||
@@ -92,6 +92,15 @@ module Jekyll
|
||||
raise e
|
||||
end
|
||||
|
||||
# Checks if the layout specified in the document actually exists
|
||||
#
|
||||
# layout - the layout to check
|
||||
#
|
||||
# Returns true if the layout is invalid, false if otherwise
|
||||
def invalid_layout?(layout)
|
||||
!document.data["layout"].nil? && layout.nil?
|
||||
end
|
||||
|
||||
# Render layouts and place given content inside.
|
||||
#
|
||||
# content - the content to be placed in the layout
|
||||
@@ -101,6 +110,9 @@ module Jekyll
|
||||
def place_in_layouts(content, payload, info)
|
||||
output = content.dup
|
||||
layout = site.layouts[document.data["layout"]]
|
||||
|
||||
Jekyll.logger.warn("Build Warning:", "Layout '#{document.data["layout"]}' requested in #{document.relative_path} does not exist.") if invalid_layout? layout
|
||||
|
||||
used = Set.new([layout])
|
||||
|
||||
while layout
|
||||
|
||||
@@ -80,7 +80,7 @@ module Jekyll
|
||||
dest_pathname = Pathname.new(dest)
|
||||
Pathname.new(source).ascend do |path|
|
||||
if path == dest_pathname
|
||||
raise FatalException.new "Destination directory cannot be or contain the Source directory."
|
||||
raise Errors::FatalException.new "Destination directory cannot be or contain the Source directory."
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -195,7 +195,7 @@ module Jekyll
|
||||
#
|
||||
# Returns nothing
|
||||
def read_data(dir)
|
||||
base = File.join(source, dir)
|
||||
base = Jekyll.sanitized_path(source, dir)
|
||||
read_data_to(base, self.data)
|
||||
end
|
||||
|
||||
@@ -214,7 +214,7 @@ module Jekyll
|
||||
end
|
||||
|
||||
entries.each do |entry|
|
||||
path = File.join(dir, entry)
|
||||
path = Jekyll.sanitized_path(dir, entry)
|
||||
next if File.symlink?(path) && safe
|
||||
|
||||
key = sanitize_filename(File.basename(entry, '.*'))
|
||||
@@ -443,7 +443,7 @@ module Jekyll
|
||||
end
|
||||
|
||||
def frontmatter_defaults
|
||||
@frontmatter_defaults ||= Configuration::FrontmatterDefaults.new(self)
|
||||
@frontmatter_defaults ||= FrontmatterDefaults.new(self)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -4,9 +4,11 @@ module Jekyll
|
||||
include Liquid::StandardFilters
|
||||
|
||||
# The regular expression syntax checker. Start with the language specifier.
|
||||
# Follow that by zero or more space separated options that take one of two
|
||||
# forms: name or name=value
|
||||
SYNTAX = /^([a-zA-Z0-9.+#-]+)((\s+\w+(=\w+)?)*)$/
|
||||
# Follow that by zero or more space separated options that take one of three
|
||||
# forms: name, name=value, or name="<quoted list>"
|
||||
#
|
||||
# <quoted list> is a space-separated list of numbers
|
||||
SYNTAX = /^([a-zA-Z0-9.+#-]+)((\s+\w+(=(\w+|"([0-9]+\s)*[0-9]+"))?)*)$/
|
||||
|
||||
def initialize(tag_name, markup, tokens)
|
||||
super
|
||||
@@ -14,8 +16,14 @@ module Jekyll
|
||||
@lang = $1.downcase
|
||||
@options = {}
|
||||
if defined?($2) && $2 != ''
|
||||
$2.split.each do |opt|
|
||||
# Split along 3 possible forms -- key="<quoted list>", key=value, or key
|
||||
$2.scan(/(?:\w="[^"]*"|\w=\w|\w)+/) do |opt|
|
||||
key, value = opt.split('=')
|
||||
# If a quoted list, convert to array
|
||||
if value && value.include?("\"")
|
||||
value.gsub!(/"/, "")
|
||||
value = value.split
|
||||
end
|
||||
@options[key.to_sym] = value || true
|
||||
end
|
||||
end
|
||||
@@ -36,9 +44,11 @@ eos
|
||||
suffix = context["highlighter_suffix"] || ""
|
||||
code = super.to_s.strip
|
||||
|
||||
is_safe = !!context.registers[:site].safe
|
||||
|
||||
output = case context.registers[:site].highlighter
|
||||
when 'pygments'
|
||||
render_pygments(code)
|
||||
render_pygments(code, is_safe)
|
||||
when 'rouge'
|
||||
render_rouge(code)
|
||||
else
|
||||
@@ -49,11 +59,30 @@ eos
|
||||
prefix + rendered_output + suffix
|
||||
end
|
||||
|
||||
def render_pygments(code)
|
||||
def sanitized_opts(opts, is_safe)
|
||||
if is_safe
|
||||
Hash[[
|
||||
[:startinline, opts.fetch(:startinline, nil)],
|
||||
[:hl_linenos, opts.fetch(:hl_linenos, nil)],
|
||||
[:linenos, opts.fetch(:linenos, nil)],
|
||||
[:encoding, opts.fetch(:encoding, 'utf-8')],
|
||||
[:cssclass, opts.fetch(:cssclass, nil)]
|
||||
].reject {|f| f.last.nil? }]
|
||||
else
|
||||
opts
|
||||
end
|
||||
end
|
||||
|
||||
def render_pygments(code, is_safe)
|
||||
require 'pygments'
|
||||
|
||||
@options[:encoding] = 'utf-8'
|
||||
|
||||
highlighted_code = Pygments.highlight(code, :lexer => @lang, :options => @options)
|
||||
highlighted_code = Pygments.highlight(
|
||||
code,
|
||||
:lexer => @lang,
|
||||
:options => sanitized_opts(@options, is_safe)
|
||||
)
|
||||
|
||||
if highlighted_code.nil?
|
||||
Jekyll.logger.error "There was an error highlighting your code:"
|
||||
|
||||
@@ -131,10 +131,6 @@ eos
|
||||
File.exist?(path) && File.realpath(path).start_with?(dir)
|
||||
end
|
||||
|
||||
def blank?
|
||||
false
|
||||
end
|
||||
|
||||
# This method allows to modify the file content by inheriting from the class.
|
||||
def source(file, context)
|
||||
File.read(file, file_read_opts(context))
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
module Jekyll
|
||||
VERSION = '2.0.3'
|
||||
VERSION = '2.2.0'
|
||||
end
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
#! /bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
script/branding
|
||||
bundle exec rake
|
||||
script/proof
|
||||
script/test
|
||||
|
||||
22
script/proof
Executable file
22
script/proof
Executable file
@@ -0,0 +1,22 @@
|
||||
#! /bin/bash
|
||||
#
|
||||
# Usage:
|
||||
# script/proof
|
||||
|
||||
set -e
|
||||
|
||||
git diff --name-only origin $(git log --pretty=format:"%h" -2 | tail -1) | grep '^site/' || {
|
||||
echo "No site files changed. We'll skip proofing."
|
||||
exit 0
|
||||
}
|
||||
|
||||
echo "Some site files have been changed! Proofing..."
|
||||
|
||||
command -v htmlproof || {
|
||||
echo "Installing HTML::Proofer!"
|
||||
gem install html-proofer -- --use-system-libraries
|
||||
}
|
||||
|
||||
bundle exec jekyll build -s site -d _site --trace
|
||||
printf "\e[0;36mProofing begins now!\e[0m\n"
|
||||
htmlproof ./_site
|
||||
10
script/test
10
script/test
@@ -1,11 +1,17 @@
|
||||
#! /bin/bash
|
||||
#
|
||||
# Usage:
|
||||
# script/test
|
||||
# script/test <hi>
|
||||
|
||||
set -x
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
TEST_FILES="test/test*.rb"
|
||||
TEST_FILES="test/test_*.rb"
|
||||
else
|
||||
TEST_FILES="$@"
|
||||
fi
|
||||
|
||||
/usr/bin/env bundle exec ruby -I"lib:test" -r rake -r rake/rake_test_loader ${TEST_FILES}
|
||||
set -x
|
||||
|
||||
bundle exec rake
|
||||
|
||||
@@ -7,4 +7,3 @@ excerpt_separator: noifniof3nioaniof3nioafafinoafnoif
|
||||
repository: https://github.com/jekyll/jekyll
|
||||
help_url: https://github.com/jekyll/jekyll-help
|
||||
google_analytics_id: UA-50755011-1
|
||||
timezone: America/Los_Angeles
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
docs:
|
||||
- github-pages
|
||||
- deployment-methods
|
||||
- continuous-integration
|
||||
|
||||
- title: Miscellaneous
|
||||
docs:
|
||||
|
||||
@@ -699,6 +699,7 @@ pre, code {
|
||||
}
|
||||
|
||||
.highlight {
|
||||
margin: 1em 0;
|
||||
padding: 10px 0;
|
||||
width: 100%;
|
||||
overflow: auto;
|
||||
|
||||
@@ -19,5 +19,5 @@ examples and for compiling this list):
|
||||
|
||||
Take a look at the [Upgrading][] page in the docs for more detailed information.
|
||||
|
||||
[history]: /docs/history/#100__20130506
|
||||
[history]: /docs/history/#v1-0-0
|
||||
[Upgrading]: /docs/upgrading/
|
||||
|
||||
@@ -24,4 +24,4 @@ See the [History][] page for more information on this release.
|
||||
[#{{ issue }}]: {{ site.repository }}/issues/{{ issue }}
|
||||
{% endfor %}
|
||||
|
||||
[History]: /docs/history/#101__20130508
|
||||
[History]: /docs/history/#v1-0-1
|
||||
|
||||
@@ -25,4 +25,4 @@ See the [History][] page for more information on this release.
|
||||
[#{{ issue }}]: {{ site.repository }}/issues/{{ issue }}
|
||||
{% endfor %}
|
||||
|
||||
[History]: /docs/history/#102__20130512
|
||||
[History]: /docs/history/#v1-0-2
|
||||
|
||||
@@ -22,4 +22,4 @@ See the [History][] page for more information on this release.
|
||||
[#{{ issue }}]: {{ site.repository }}/issues/{{ issue }}
|
||||
{% endfor %}
|
||||
|
||||
[History]: /docs/history/#103__20130607
|
||||
[History]: /docs/history/#v1-0-3
|
||||
|
||||
@@ -16,4 +16,4 @@ For a full changelog, check out our [history][] page.
|
||||
Now, back to work on 2.0.0!
|
||||
|
||||
[fun issue with path sanitizing]: https://github.com/jekyll/jekyll/issues/1948
|
||||
[history]: /docs/history/#150__20140324
|
||||
[history]: /docs/history/#v1-5-0
|
||||
|
||||
@@ -22,10 +22,10 @@ Check out our [changelog][] for a complete list of all (200+) changes.
|
||||
|
||||
Many thanks to these 183 contributors for making Jekyll 2.0.0 happen:
|
||||
|
||||
Parker Moore, Matt Rogers, maul.esel, Anatol Broder, Zach Gersh, Joel Glovier, Ben Balter, XhmikosR, Coby Chapple, John Piasetzki, Aidan Feldman, Robin Dupret, Pascal Borreli, Troy Swanson, Erik Michaels-Ober, albertogg, Lucas Jenss, Matt Rogers & Persa Zula, Eric Mill, Shigeya Suzuki, Jens Nazarenus, ddavison, Pat Hawks, Rob Wierzbowski, MURAOKA Taro, Casey Lang, Fabian Rodriguez, Greg Karékinian, Zlatan Vasović, Christopher Nicotera, Dmitry Chestnykh, Ryan Morrissey, Jordon, John Hughes, akira yamada, Matt Swanson, Jashank Jeremy, Matthew Iversen, Meeka, liufengyun, Anand Narayan, nitoyon, Geoff Shannon, Benjamin J. Balter, Juan Ignacio Donoso, David Briggs, Benjamin Esham, Slava Pavlutin, Assaf Gelber, Josh Brown, Nick Fagerlund, Davide Ficano, pilosus, Anthony Smith, André Arko, Mikael Konutgan, Matthew Scharley, Dan Tao, scribu, Mort Yao, m, Stephen McDonald, Marcus Stollsteimer, Thomas Torsney-Weir, Jordon Bedwell, Tom Preston-Werner, Lincoln Mullen, Philip Poots, Ivan Tse, Christopher Giroir, Valery Tolstov, Wlodek Bzyl, Xavier Noria, Yi Zeng, Persa Zula, Phil Leggetter, Pirogov Evgenij, Rafael Revi, Rob McGuire-Dale, Rob Muhlestein, Robin Mehner, Roland Warmerdam, Rusty Geldmacher, Sam Rayner, Santeri Paavolainen, Sebastian Morr, Stephan Groß, Steven Spasbo, Tobias Brunner, Tuomas Kareinen, Tyler Margison, Uwe Dauernheim, Yihang Ho, Zach Leatherman, Zequez, andrew morton, andrewhavens, imathis, jannypie, jaybe@jekyll, kk_Ataka, markets, redwallhp, schneems, szymzet, thomasdao, tomsugden, wǒ_is神仙, 张君君, Noah Slater, Abhi Yerra, Adam Heckler, Ahmed Hazem, Aigars Dzerviniks, Aleksey V. Zapparov, Andreas Möller, Andy Lindeman, Arlen Cuss, Aziz Shamim, Ben Baker-Smith, Ben Hanzl, Ben Hildred, Brian Kim, Brice, Carol Nichols, Chezou, Chris Jones, Christian Grobmeier, Christoph Hochstrasser, Christoph Schiessl, Clint Shryock, Colin Dean, Corey Ward, Damian Lettie, Daniel Schauenberg, David Ensinger, David Paschich, David Sawyer, David Silva Smith, Donald Perry, Doug Johnston, Edward Ball, Eric Dobson, Erik Dungan, Florent Guilleux, Francis, Frederic ROS, GSI2013, Garen Torikian, George Anderson, Giuseppe Capizzi, Ishibashi Hideto, Jarrod Birch, Jeff Kolesky, Jens Bissinger, Jens Krause, John Firebaugh, John Papandriopoulos, Josh Branchaud, Katy DeCorah, Lachlan Holden, Mark Prins, Markus Roth, Martin Charles, Matt Iversen, Matt Sheehan, Matt Swensen, Matthias Vogelgesang, Michael Parker, Miha Rekar, Nathan Youngman, Nick Quaranto, Nick Quinlan, Nick Schonning, Nicolas Alpi, Nicolás Reynolds, Nikkau, 4ensicLog, Octavian Damiean, Olov Lassus, PatrickC8t, Paul Annesley, and Paul Oppenheim.
|
||||
Parker Moore, Matt Rogers, maul.esel, Anatol Broder, Zach Gersh, Joel Glovier, Ben Balter, XhmikosR, Coby Chapple, John Piasetzki, Aidan Feldman, Robin Dupret, Pascal Borreli, Troy Swanson, Erik Michaels-Ober, albertogg, Lucas Jenss, Matt Rogers & Persa Zula, Eric Mill, Shigeya Suzuki, Jens Nazarenus, ddavison, Pat Hawks, Rob Wierzbowski, MURAOKA Taro, Casey Lang, Fabian Rodriguez, Greg Karékinian, Zlatan Vasović, Christopher Nicotera, Dmitry Chestnykh, Ryan Morrissey, Jordon, John Hughes, akira yamada, Matt Swanson, Jashank Jeremy, Matthew Iversen, Meeka, liufengyun, Anand Narayan, nitoyon, Geoff Shannon, Benjamin J. Balter, Juan Ignacio Donoso, David Briggs, Benjamin Esham, Slava Pavlutin, Assaf Gelber, Josh Brown, Nick Fagerlund, Davide Ficano, pilosus, Anthony Smith, André Arko, Mikael Konutgan, Matthew Scharley, Dan Tao, scribu, Mort Yao, m, Stephen McDonald, Marcus Stollsteimer, Thomas Torsney-Weir, Jordon Bedwell, Tom Preston-Werner, Lincoln Mullen, Philip Poots, Ivan Tse, Christopher Giroir, Valery Tolstov, Wlodek Bzyl, Xavier Noria, Yi Zeng, Persa Zula, Phil Leggetter, Pirogov Evgenij, Rafael Revi, Rob McGuire-Dale, Rob Muhlestein, Robin Mehner, Roland Warmerdam, Rusty Geldmacher, Sam Rayner, Santeri Paavolainen, Sebastian Morr, Stephan Groß, Steven Spasbo, Tobias Brunner, Tuomas Kareinen, Tyler Margison, Uwe Dauernheim, Yihang Ho, Zach Leatherman, Zequez, andrew morton, andrewhavens, imathis, jannypie, jaybe@jekyll, kk_Ataka, markets, redwallhp, schneems, szymzet, thomasdao, tomsugden, wǒis神仙, 张君君, Noah Slater, Abhi Yerra, Adam Heckler, Ahmed Hazem, Aigars Dzerviniks, Aleksey V. Zapparov, Andreas Möller, Andy Lindeman, Arlen Cuss, Aziz Shamim, Ben Baker-Smith, Ben Hanzl, Ben Hildred, Brian Kim, Brice, Carol Nichols, Chezou, Chris Jones, Christian Grobmeier, Christoph Hochstrasser, Christoph Schiessl, Clint Shryock, Colin Dean, Corey Ward, Damian Lettie, Daniel Schauenberg, David Ensinger, David Paschich, David Sawyer, David Silva Smith, Donald Perry, Doug Johnston, Edward Ball, Eric Dobson, Erik Dungan, Florent Guilleux, Francis, Frederic ROS, GSI2013, Garen Torikian, George Anderson, Giuseppe Capizzi, Ishibashi Hideto, Jarrod Birch, Jeff Kolesky, Jens Bissinger, Jens Krause, John Firebaugh, John Papandriopoulos, Josh Branchaud, Katy DeCorah, Lachlan Holden, Mark Prins, Markus Roth, Martin Charles, Matt Iversen, Matt Sheehan, Matt Swensen, Matthias Vogelgesang, Michael Parker, Miha Rekar, Nathan Youngman, Nick Quaranto, Nick Quinlan, Nick Schonning, Nicolas Alpi, Nicolás Reynolds, Nikkau, 4ensicLog, Octavian Damiean, Olov Lassus, PatrickC8t, Paul Annesley, and Paul Oppenheim.
|
||||
|
||||
Happy developing!
|
||||
|
||||
[changelog]: /docs/history/
|
||||
[@jglovier]: https://github.com/jglovier
|
||||
[jekyll-1]: {% post_url 2013-05-05-jekyll-1-0-0-released %}
|
||||
[jekyll-1]: /news/2013/05/06/jekyll-1-0-0-released/
|
||||
|
||||
31
site/_posts/2014-06-28-jekyll-turns-21-i-mean-2-1-0.markdown
Normal file
31
site/_posts/2014-06-28-jekyll-turns-21-i-mean-2-1-0.markdown
Normal file
@@ -0,0 +1,31 @@
|
||||
---
|
||||
layout: news_item
|
||||
title: 'Jekyll Turns 21! Err... I mean 2.1.0.'
|
||||
date: 2014-06-28 17:26:59 -0400
|
||||
author: parkr
|
||||
version: 2.1.0
|
||||
categories: [release]
|
||||
---
|
||||
|
||||
Jekyll's finally [legal to drink in the States](http://en.wikipedia.org/wiki/Legal_drinking_age).
|
||||
And he's done a lot of learning in the process! Here are some of the new
|
||||
things to look forward to:
|
||||
|
||||
- Uses the latest Liquid version (2.6.1) (#2495)
|
||||
- Set front-matter defaults for collections (#2419)
|
||||
- Set a collection-specific URL template (#2418)
|
||||
- `pygments.rb` 0.6.0! (#2504)
|
||||
- `.json` files in `_data` (#2369)
|
||||
- Allow subdirectories in `_data` (#2395)
|
||||
- Add support for `hl_lines` in `highlight` tag (#2532)
|
||||
- Post categories now merge with directory, front-matter, and defaults (#2373)
|
||||
- New `--skip_initial_build` flag for `jekyll serve` (#2477)
|
||||
- A bajilion bug fixes and site updates!
|
||||
|
||||
Let's go party!
|
||||
|
||||
*Check out the [full changelog](/docs/history/#v2-1-0) for more.*
|
||||
|
||||
Many thanks to these 37 contributors for the 2.1.0 release:
|
||||
|
||||
Alberto Grespan, Alessandro Lorenzi, Alex Medearis, Alfred Xing, Anatol Broder, Ben, Ben Balter, Bud Parr, Chezou, Denilson Figueiredo de Sá, Denilson Sá, Ivan Tse, Jens Nazarenus, Jesse Shawl, Jordon Bedwell, Josh Davis, János Rusiczki, Marc Ransome, Mathieu Bruyen, Matt Rogers, Parker Moore, Pat Hawks, Paul Henry, Peter Rhoades, Philipp Rudloff, Quinn Shanahan, Renaud Martinet, Rob Murray, Rodrigo Dumont, Simon Sarris, Terry, Terry Schmidt, Tomer Cohen, XhmikosR, Yihang Ho, jaybe@jekyll, and mikecole.
|
||||
30
site/_posts/2014-07-01-jekyll-2-1-1-released.markdown
Normal file
30
site/_posts/2014-07-01-jekyll-2-1-1-released.markdown
Normal file
@@ -0,0 +1,30 @@
|
||||
---
|
||||
layout: news_item
|
||||
title: 'Jekyll 2.1.1 Released'
|
||||
date: 2014-07-01 20:16:43 -0400
|
||||
author: parkr
|
||||
version: 2.1.1
|
||||
categories: [release]
|
||||
---
|
||||
|
||||
This is a minor release for Jekyll 2.1.0. It fixes a couple bugs and
|
||||
introduces fixes for a couple security-related issues.
|
||||
|
||||
It covers two security vulnerabilities:
|
||||
|
||||
1. One in the reading of data
|
||||
2. One in the `layouts` setting
|
||||
|
||||
They were identified in Jekyll 1.5.1 and has been confirmed as patched
|
||||
in this version and the version used by GitHub Pages. If you are in the
|
||||
business of building Jekyll sites, please ensure you upgrade to 2.1.1 as
|
||||
soon as possible.
|
||||
|
||||
For more, check out [`jekyll/jekyll#2563`](https://github.com/jekyll/jekyll/pull/2563).
|
||||
|
||||
Additionally, the dependency on Maruku has been loosened and a bug was
|
||||
fixed with document URLs.
|
||||
|
||||
As always, check out the [full changelog](/docs/history/) for more info!
|
||||
|
||||
Happy Jekylling!
|
||||
19
site/_posts/2014-07-29-jekyll-2-2-0-released.markdown
Normal file
19
site/_posts/2014-07-29-jekyll-2-2-0-released.markdown
Normal file
@@ -0,0 +1,19 @@
|
||||
---
|
||||
layout: news_item
|
||||
title: 'Jekyll 2.2.0 Released'
|
||||
date: 2014-07-29 18:59:13 -0400
|
||||
author: parkr
|
||||
version: 2.2.0
|
||||
categories: [release]
|
||||
---
|
||||
|
||||
Jekyll 2.2.0 contains a few key updates:
|
||||
|
||||
1. A warning will now fire if you specify a layout in any of your pages or
|
||||
posts that doesn't exist.
|
||||
2. Certain Pygments options are now whitelisted in safe mode
|
||||
3. Categories in a post's path are now respected (i.e. folders in `_posts`
|
||||
will now work properly).
|
||||
|
||||
As always, a full list of the updates are on the
|
||||
[history page](/docs/history#v2-2-0). Happy Jekylling!
|
||||
@@ -21,9 +21,9 @@ or `.coffee`) and start the file with two lines of triple dashes, like this:
|
||||
|
||||
Jekyll treats these files the same as a regular page, in that the output file
|
||||
will be placed in the same directory that it came from. For instance, if you
|
||||
have a file named `/css/styles.scss` in your site's source folder, Jekyll
|
||||
have a file named `css/styles.scss` in your site's source folder, Jekyll
|
||||
will process it and put it in your site's destination folder under
|
||||
`/css/styles.css`.
|
||||
`css/styles.css`.
|
||||
|
||||
## Sass/SCSS
|
||||
|
||||
@@ -38,7 +38,21 @@ sass:
|
||||
sass_dir: _sass
|
||||
{% endhighlight %}
|
||||
|
||||
The Sass converter will default to `_sass`.
|
||||
The Sass converter will default the `sass_dir` configuration option to
|
||||
`_sass`.
|
||||
|
||||
<div class="note info">
|
||||
<h5>The <code>sass_dir</code> is only used by Sass</h5>
|
||||
<p>
|
||||
|
||||
Note that the `sass_dir` becomes the load path for Sass imports,
|
||||
nothing more. This means that Jekyll does not know about these files
|
||||
directly, so any files here should not contain the YAML front matter as
|
||||
described above nor will they be transformed as described above. This
|
||||
folder should only contain imports.
|
||||
|
||||
</p>
|
||||
</div>
|
||||
|
||||
You may also specify the output style with the `style` option in your
|
||||
`_config.yml` file:
|
||||
|
||||
@@ -56,7 +56,7 @@ For example, if you have `_my_collection/some_subdir/some_doc.md`,
|
||||
it will be rendered using Liquid and the Markdown converter of your
|
||||
choice and written out to `<dest>/my_collection/some_subdir/some_doc.html`.
|
||||
|
||||
As for posts with [Permalinks](../Permalinks/), document URL can be customized by setting a `permalink` metadata to the collection:
|
||||
As for posts with [Permalinks](../permalinks/), document URL can be customized by setting a `permalink` metadata to the collection:
|
||||
|
||||
{% highlight yaml %}
|
||||
collections:
|
||||
|
||||
@@ -434,7 +434,6 @@ server: false # deprecated
|
||||
host: 0.0.0.0
|
||||
port: 4000
|
||||
baseurl: ""
|
||||
url: http://localhost:4000
|
||||
lsi: false
|
||||
|
||||
maruku:
|
||||
|
||||
177
site/docs/continuous-integration.md
Normal file
177
site/docs/continuous-integration.md
Normal file
@@ -0,0 +1,177 @@
|
||||
---
|
||||
layout: docs
|
||||
title: Continuous Integration
|
||||
prev_section: deployment-methods
|
||||
next_section: troubleshooting
|
||||
permalink: /docs/continuous-integration/
|
||||
---
|
||||
|
||||
You can easily test your website build against one or more versions of Ruby.
|
||||
The following guide will show you how to set up a free build environment on
|
||||
[Travis][0], with [GitHub][1] integration for pull requests. Paid
|
||||
alternatives exist for private repositories.
|
||||
|
||||
[0]: https://travis-ci.org/
|
||||
[1]: https://github.com/
|
||||
|
||||
## 1. Enabling Travis and GitHub
|
||||
|
||||
Enabling Travis builds for your GitHub repository is pretty simple:
|
||||
|
||||
1. Go to your profile on travis-ci.org: https://travis-ci.org/profile/username
|
||||
2. Find the repository for which you're interested in enabling builds.
|
||||
3. Click the slider on the right so it says "ON" and is a dark grey.
|
||||
4. Optionally configure the build by clicking on the wrench icon. Further
|
||||
configuration happens in you `.travis.yml` file. More details on that
|
||||
below.
|
||||
|
||||
## 2. The Test Script
|
||||
|
||||
The simplest test script simply runs `jekyll build` and ensures that Jekyll
|
||||
doesn't fail to build the site. It doesn't check the resulting site, but it
|
||||
does ensure things are built properly.
|
||||
|
||||
When testing Jekyll output, there is no better tool than [html-proofer][2].
|
||||
This tool checks your resulting site to ensure all links and images exist.
|
||||
Utilize it either with the convenient `htmlproof` command-line executable,
|
||||
or write a Ruby script which utilizes the gem.
|
||||
|
||||
### The HTML Proofer Executable
|
||||
|
||||
{% highlight bash %}
|
||||
#!/usr/bin/env bash
|
||||
set -e # halt script on error
|
||||
|
||||
bundle exec jekyll build
|
||||
bundle exec htmlproof ./_site
|
||||
{% endhighlight %}
|
||||
|
||||
Some options can be specified via command-line switches. Check out the
|
||||
`html-proofer` README for more information about these switches, or run
|
||||
`htmlproof --help` locally.
|
||||
|
||||
### The HTML Proofer Library
|
||||
|
||||
You can also invoke `html-proofer` in Ruby scripts (e.g. in a Rakefile):
|
||||
|
||||
{% highlight ruby %}
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
require 'html/proofer'
|
||||
HTML::Proofer.new("./_site").run
|
||||
{% endhighlight %}
|
||||
|
||||
Options are given as a second argument to `.new`, and are encoded in a
|
||||
symbol-keyed Ruby Hash. More information about the configuration options,
|
||||
check out `html-proofer`'s README file.
|
||||
|
||||
[2]: https://github.com/gjtorikian/html-proofer
|
||||
|
||||
## 3. Configuring Your Travis Builds
|
||||
|
||||
This file is used to configure your Travis builds. Because Jekyll is built
|
||||
with Ruby and requires RubyGems to install, we use the Ruby language build
|
||||
environment. Below is a sample `.travis.yml` file, and what follows that is
|
||||
an explanation of each line.
|
||||
|
||||
{% highlight yaml %}
|
||||
language: ruby
|
||||
rvm:
|
||||
- 2.1
|
||||
script: ./script/cibuild
|
||||
|
||||
# branch whitelist
|
||||
branches:
|
||||
only:
|
||||
- gh-pages # test the gh-pages branch
|
||||
- /pages-(.*)/ # test every branch which starts with "pages-"
|
||||
|
||||
env:
|
||||
global:
|
||||
- NOKOGIRI_USE_SYSTEM_LIBRARIES=true # speeds up installation of html-proofer
|
||||
{% endhighlight %}
|
||||
|
||||
Ok, now for an explanation of each line:
|
||||
|
||||
{% highlight yaml %}
|
||||
language: ruby
|
||||
{% endhighlight %}
|
||||
|
||||
This line tells Travis to use a Ruby build container. It gives your script
|
||||
access to Bundler, RubyGems, and and Ruby runtime.
|
||||
|
||||
{% highlight yaml %}
|
||||
rvm:
|
||||
- 2.1
|
||||
{% endhighlight %}
|
||||
|
||||
RVM is a popular Ruby Version Manager (like rbenv, chruby, etc). This
|
||||
directive tells Travis the Ruby version to use when running your test
|
||||
script.
|
||||
|
||||
{% highlight yaml %}
|
||||
script: ./script/cibuild
|
||||
{% endhighlight %}
|
||||
|
||||
Travis allows you to run any arbitrary shell script to test your site. One
|
||||
convention is to put all scripts for your project in the `script`
|
||||
directory, and to call your test script `cibuild`. This line is completely
|
||||
customizable. If your script won't change much, you can write your test
|
||||
incantation here directly:
|
||||
|
||||
{% highlight yaml %}
|
||||
script: jekyll build && htmlproof ./_site
|
||||
{% endhighlight %}
|
||||
|
||||
The `script` directive can be absolutely any valid shell command.
|
||||
|
||||
{% highlight yaml %}
|
||||
# branch whitelist
|
||||
branches:
|
||||
only:
|
||||
- gh-pages # test the gh-pages branch
|
||||
- /pages-(.*)/ # test every branch which starts with "pages-"
|
||||
{% endhighlight %}
|
||||
|
||||
You want to ensure the Travis builds for your site are being run only on
|
||||
the branch or branches which contain your site. One means of ensuring this
|
||||
isolation is including a branch whitelist in your Travis configuration
|
||||
file. By specifying the `gh-pages` branch, you will ensure the associated
|
||||
test script (discussed above) is only executed on site branches. If you use
|
||||
a pull request flow for proposing changes, you may wish to enforce a
|
||||
convention for your builds such that all branches containing edits are
|
||||
prefixed, exemplified above with the `/pages-(.*)/` regular expression.
|
||||
|
||||
The `branches` directive is completely optional.
|
||||
|
||||
{% highlight yaml %}
|
||||
env:
|
||||
global:
|
||||
- NOKOGIRI_USE_SYSTEM_LIBRARIES=true # speeds up installation of html-proofer
|
||||
{% endhighlight %}
|
||||
|
||||
Using `html-proofer`? You'll want this environment variable. Nokogiri, used
|
||||
to parse HTML files in your compiled site, comes bundled with libraries
|
||||
which it must compile each time it is installed. Luckily, you can
|
||||
dramatically increase the install time of Nokogiri by setting the
|
||||
environment variable `NOKOGIRI_USE_SYSTEM_LIBRARIES` to `true`.
|
||||
|
||||
## 4. Gotchas
|
||||
|
||||
### Exclude `vendor`
|
||||
|
||||
Travis bundles all gems in the `vendor` directory on its build servers,
|
||||
which Jekyll will mistakenly read and explode on. To avoid this, exclude
|
||||
`vendor` in your `_config.yml`:
|
||||
|
||||
{% highlight yaml %}
|
||||
exclude: [vendor]
|
||||
{% endhighlight %}
|
||||
|
||||
### Questions?
|
||||
|
||||
This entire guide is open-source. Go ahead and [edit it][3] if you have a
|
||||
fix or [ask for help][4] if you run into trouble and need some help.
|
||||
|
||||
[3]: https://github.com/jekyll/jekyll/edit/master/site/docs/continuous-integration.md
|
||||
[4]: https://github.com/jekyll/jekyll-help#how-do-i-ask-a-question
|
||||
@@ -106,7 +106,7 @@ The [Jekyll wiki]({{ site.repository }}/wiki) on GitHub
|
||||
can be freely updated without a pull request as all
|
||||
GitHub users have access.
|
||||
|
||||
If you want to add your plugin to the [list of plugins](/docs/plugins/#available_plugins),
|
||||
If you want to add your plugin to the [list of plugins](/docs/plugins/#available-plugins),
|
||||
please submit a pull request modifying the [plugins page source
|
||||
file]({{ site.repository }}/blob/master/site/docs/plugins.md) by adding a
|
||||
link to your plugin under the proper subheading depending upon its type.
|
||||
|
||||
@@ -94,7 +94,8 @@ The organizations can then be accessed via `site.data.orgs`, followed by the fil
|
||||
{% highlight html %}
|
||||
{% raw %}
|
||||
<ul>
|
||||
{% for org in site.data.orgs %}
|
||||
{% for org_hash in site.data.orgs %}
|
||||
{% assign org = org_hash[1] %}
|
||||
<li>
|
||||
<a href="https://github.com/{{ org.username }}">
|
||||
{{ org.name }}
|
||||
|
||||
@@ -73,10 +73,23 @@ Deploying is now as easy as telling nginx or Apache to look at
|
||||
laptops$ git push deploy master
|
||||
{% endhighlight %}
|
||||
|
||||
### Jekyll-hook
|
||||
|
||||
You can also use jekyll-hook, a server that listens for webhook posts from
|
||||
GitHub, generates a website with Jekyll, and moves it somewhere to be
|
||||
published. Use this to run your own GitHub Pages-style web server.
|
||||
|
||||
This method is useful if you need to serve your websites behind a firewall,
|
||||
need extra server-level features like HTTP basic authentication or want to
|
||||
host your site directly on a CDN or file host like S3.
|
||||
|
||||
Setup steps are fully documented
|
||||
[in the `jekyll-hook` repo](https://github.com/developmentseed/jekyll-hook).
|
||||
|
||||
### Rake
|
||||
|
||||
Another way to deploy your Jekyll site is to use [Rake](https://github.com/jimweirich/rake), [HighLine](https://github.com/JEG2/highline), and
|
||||
[Net::SSH](http://net-ssh.rubyforge.org/). A more complex example of deploying Jekyll with Rake that deals with multiple branches can be found in [Git Ready](https://github.com/gitready/gitready/blob/cdfbc4ec5321ff8d18c3ce936e9c749dbbc4f190/Rakefile).
|
||||
[Net::SSH](https://github.com/net-ssh/net-ssh). A more complex example of deploying Jekyll with Rake that deals with multiple branches can be found in [Git Ready](https://github.com/gitready/gitready/blob/cdfbc4ec5321ff8d18c3ce936e9c749dbbc4f190/Rakefile).
|
||||
|
||||
### rsync
|
||||
|
||||
@@ -86,7 +99,7 @@ this script from within Textmate.
|
||||
|
||||
## Rack-Jekyll
|
||||
|
||||
[Rack-Jekyll](https://github.com/adaoraul/rack-jekyll/) is an easy way to deploy your site on any Rack server such as Amazon EC2, Slicehost, Heroku, and so forth. It also can run with [shotgun](https://github.com/rtomakyo/shotgun/), [rackup](https://github.com/rack/rack), [mongrel](https://github.com/mongrel/mongrel), [unicorn](https://github.com/defunkt/unicorn/), and [others](https://github.com/adaoraul/rack-jekyll#readme).
|
||||
[Rack-Jekyll](https://github.com/adaoraul/rack-jekyll/) is an easy way to deploy your site on any Rack server such as Amazon EC2, Slicehost, Heroku, and so forth. It also can run with [shotgun](https://github.com/rtomayko/shotgun/), [rackup](https://github.com/rack/rack), [mongrel](https://github.com/mongrel/mongrel), [unicorn](https://github.com/defunkt/unicorn/), and [others](https://github.com/adaoraul/rack-jekyll#readme).
|
||||
|
||||
Read [this post](http://blog.crowdint.com/2010/08/02/instant-blog-using-jekyll-and-heroku.html) on how to deploy to Heroku using Rack-Jekyll.
|
||||
|
||||
|
||||
@@ -9,82 +9,10 @@ permalink: /docs/extras/
|
||||
There are a number of (optional) extra features that Jekyll supports that you
|
||||
may want to install, depending on how you plan to use Jekyll.
|
||||
|
||||
## LaTeX Support
|
||||
## Math Support
|
||||
|
||||
Maruku comes with optional support for LaTeX to PNG rendering via blahtex
|
||||
(Version 0.6) which must be in your `$PATH` along with `dvips`.
|
||||
Kramdown comes with optional support for LaTeX to PNG rendering via [MathJax](http://www.mathjax.org/) within math blocks. See the Kramdown documentation on [math blocks](http://kramdown.gettalong.org/syntax.html#math-blocks) and [math support](http://kramdown.gettalong.org/converter/html.html#math-support) for more details.
|
||||
|
||||
## Alternative Markdown Processors
|
||||
|
||||
While Jekyll defaults to using Maruku for Markdown conversion, you may use one
|
||||
of the other three pre-defined markdown parsers or define your own.
|
||||
|
||||
### RDiscount
|
||||
|
||||
If you prefer to use [RDiscount](https://github.com/rtomayko/rdiscount) instead
|
||||
of [Maruku](https://github.com/bhollis/maruku) for Markdown, just make sure you have
|
||||
it installed:
|
||||
|
||||
{% highlight bash %}
|
||||
$ [sudo] gem install rdiscount
|
||||
{% endhighlight %}
|
||||
|
||||
And then specify RDiscount as the Markdown engine in your `_config.yml` file to
|
||||
have Jekyll run with that option.
|
||||
|
||||
{% highlight yaml %}
|
||||
# In _config.yml
|
||||
markdown: rdiscount
|
||||
{% endhighlight %}
|
||||
|
||||
### Kramdown
|
||||
|
||||
You can also use [Kramdown](http://kramdown.rubyforge.org/) instead of Maruku
|
||||
for Markdown. Make sure that Kramdown is installed:
|
||||
|
||||
{% highlight bash %}
|
||||
$ [sudo] gem install kramdown
|
||||
{% endhighlight %}
|
||||
|
||||
Then you can specify Kramdown as the Markdown engine in `_config.yml`.
|
||||
|
||||
{% highlight yaml %}
|
||||
# In _config.yml
|
||||
markdown: kramdown
|
||||
{% endhighlight %}
|
||||
|
||||
Kramdown has various options for customizing the HTML output. The
|
||||
[Configuration](/docs/configuration/) page lists the default options used by
|
||||
Jekyll. A complete list of options is also available on the [Kramdown
|
||||
website](http://kramdown.rubyforge.org/options.html).
|
||||
|
||||
### User-Defined
|
||||
|
||||
So, you're totally at odds with our four built-in markdown parsers, eh? No
|
||||
sweat. You can define one as a plugin:
|
||||
|
||||
{% highlight ruby %}
|
||||
require 'jekyll'
|
||||
require 'some_renderer'
|
||||
|
||||
class Jekyll::Converters::Markdown::MyCustomParser
|
||||
def initialize(config)
|
||||
@site_config = config
|
||||
end
|
||||
|
||||
def convert(content)
|
||||
# (this _must_ return the resulting String after the rendering)
|
||||
SomeRenderer.new(@site_config).to_html(content)
|
||||
end
|
||||
end
|
||||
{% endhighlight %}
|
||||
|
||||
Once you've got that setup, ask Jekyll to use your custom markdown parser in
|
||||
your `_config.yml` file:
|
||||
|
||||
{% highlight yaml %}
|
||||
markdown: MyCustomParser
|
||||
{% endhighlight %}
|
||||
|
||||
(Note that this **is case-sensitive**, and is only the piece after
|
||||
`Jekyll::Converters::Markdown`.) And there you are!
|
||||
See the Markdown section on the [configuration page](/docs/configuration/#markdown-options) for instructions on how to use and configure alternative Markdown processors, as well as how to create [custom processors](/docs/configuration/#custom-markdown-processors).
|
||||
|
||||
@@ -8,7 +8,7 @@ permalink: /docs/github-pages/
|
||||
|
||||
[GitHub Pages](http://pages.github.com) are public web pages for users,
|
||||
organizations, and repositories, that are freely hosted on GitHub's
|
||||
[github.io]() domain or on a custom domain name of your choice. GitHub Pages are
|
||||
`github.io` domain or on a custom domain name of your choice. GitHub Pages are
|
||||
powered by Jekyll behind the scenes, so in addition to supporting regular HTML
|
||||
content, they’re also a great way to host your Jekyll-powered website for free.
|
||||
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
---
|
||||
layout: docs
|
||||
title: Heroku
|
||||
prev_section: github-pages
|
||||
next_section: manual-deployment
|
||||
permalink: /docs/heroku/
|
||||
---
|
||||
|
||||
Move along, people. Nothing to see here.
|
||||
File diff suppressed because it is too large
Load Diff
@@ -16,7 +16,7 @@ development of Jekyll itself.
|
||||
Jekyll is a simple, blog-aware, static site generator. It takes a template
|
||||
directory containing raw text files in various formats, runs it through
|
||||
[Markdown](http://daringfireball.net/projects/markdown/) (or
|
||||
[Textile](http://textile.sitemonks.com/)) and
|
||||
[Textile](http://redcloth.org/textile)) and
|
||||
[Liquid](http://wiki.shopify.com/Liquid)
|
||||
converters, and spits out a complete, ready-to-publish static website suitable
|
||||
for serving with your favorite web server. Jekyll also happens to be the engine
|
||||
|
||||
@@ -19,6 +19,8 @@ you’ll need to make sure your system has before you start.
|
||||
- [Ruby](http://www.ruby-lang.org/en/downloads/)
|
||||
- [RubyGems](http://rubygems.org/pages/download)
|
||||
- Linux, Unix, or Mac OS X
|
||||
- [NodeJS](http://nodejs.org), or another JavaScript runtime (for
|
||||
CoffeeScript support).
|
||||
|
||||
<div class="note info">
|
||||
<h5>Running Jekyll on Windows</h5>
|
||||
@@ -32,7 +34,7 @@ you’ll need to make sure your system has before you start.
|
||||
## Install with RubyGems
|
||||
|
||||
The best way to install Jekyll is via
|
||||
[RubyGems](http://docs.rubygems.org/read/chapter/3). At the terminal prompt,
|
||||
[RubyGems](http://rubygems.org/pages/download). At the terminal prompt,
|
||||
simply run the following command to install Jekyll:
|
||||
|
||||
{% highlight bash %}
|
||||
|
||||
@@ -427,6 +427,8 @@ You can find a few useful plugins at the following locations:
|
||||
- [Pages Directory by Ben Baker-Smith](https://github.com/bbakersmith/jekyll-pages-directory): Defines a `_pages` directory for page files which routes its output relative to the project root.
|
||||
- [Page Collections by Jeff Kolesky](https://github.com/jeffkole/jekyll-page-collections): Generates collections of pages with functionality that resembles posts.
|
||||
- [Windows 8.1 Live Tile Generation by Matt Sheehan](https://github.com/sheehamj13/jekyll-live-tiles): Generates Internet Explorer 11 config.xml file and Tile Templates for pinning your site to Windows 8.1.
|
||||
- [Jekyll::AutolinkEmail by Ivan Tse](https://github.com/ivantsepp/jekyll-autolink_email): Autolink your emails.
|
||||
- [Jekyll::GitMetadata by Ivan Tse](https://github.com/ivantsepp/jekyll-git_metadata): Expose Git metadata for your templates.
|
||||
|
||||
#### Converters
|
||||
|
||||
@@ -445,6 +447,7 @@ You can find a few useful plugins at the following locations:
|
||||
- [Jekyll-pandoc-multiple-formats](https://github.com/fauno/jekyll-pandoc-multiple-formats) by [edsl](https://github.com/edsl): Use pandoc to generate your site in multiple formats. Supports pandoc’s markdown extensions.
|
||||
- [Transform Layouts](https://gist.github.com/1472645): Allows HAML layouts (you need a HAML Converter plugin for this to work).
|
||||
- [Org-mode Converter](https://gist.github.com/abhiyerra/7377603): Org-mode converter for Jekyll.
|
||||
- [Customized Kramdown Converter](https://github.com/mvdbos/kramdown-with-pygments): Enable Pygments syntax highlighting for Kramdown-parsed fenced code blocks.
|
||||
|
||||
#### Filters
|
||||
|
||||
@@ -454,7 +457,7 @@ You can find a few useful plugins at the following locations:
|
||||
- [URL encoding by James An](https://gist.github.com/919275): Percent encoding for URIs.
|
||||
- [JSON Filter](https://gist.github.com/1850654) by [joelverhagen](https://github.com/joelverhagen): Filter that takes input text and outputs it as JSON. Great for rendering JavaScript.
|
||||
- [i18n_filter](https://github.com/gacha/gacha.id.lv/blob/master/_plugins/i18n_filter.rb): Liquid filter to use I18n localization.
|
||||
- [Smilify](https://github.com/SaswatPadhi/jekyll_smilify) by [SaswatPadhi](https://github.com/SaswatPadhi): Convert text emoticons in your content to themeable smiley pics ([Demo](http://saswatpadhi.github.com/)).
|
||||
- [Smilify](https://github.com/SaswatPadhi/jekyll_smilify) by [SaswatPadhi](https://github.com/SaswatPadhi): Convert text emoticons in your content to themeable smiley pics.
|
||||
- [Read in X Minutes](https://gist.github.com/zachleat/5792681) by [zachleat](https://github.com/zachleat): Estimates the reading time of a string (for blog post content).
|
||||
- [Jekyll-timeago](https://github.com/markets/jekyll-timeago): Converts a time value to the time ago in words.
|
||||
- [pluralize](https://github.com/bdesham/pluralize): Easily combine a number and a word into a gramatically-correct amount like “1 minute” or “2 minute**s**”.
|
||||
@@ -468,7 +471,7 @@ You can find a few useful plugins at the following locations:
|
||||
|
||||
- [Asset Path Tag](https://github.com/samrayner/jekyll-asset-path-plugin) by [Sam Rayner](http://www.samrayner.com/): Allows organisation of assets into subdirectories by outputting a path for a given file relative to the current post or page.
|
||||
- [Delicious Plugin by Christian Hellsten](https://github.com/christianhellsten/jekyll-plugins): Fetches and renders bookmarks from delicious.com.
|
||||
- [Ultraviolet Plugin by Steve Alex](https://gist.github.com/480380): Jekyll tag for the [Ultraviolet](http://ultraviolet.rubyforge.org/) code highligher.
|
||||
- [Ultraviolet Plugin by Steve Alex](https://gist.github.com/480380): Jekyll tag for the [Ultraviolet](https://github.com/grosser/ultraviolet) code highligher.
|
||||
- [Tag Cloud Plugin by Ilkka Laukkanen](https://gist.github.com/710577): Generate a tag cloud that links to tag pages.
|
||||
- [GIT Tag by Alexandre Girard](https://gist.github.com/730347): Add Git activity inside a list.
|
||||
- [MathJax Liquid Tags by Jessy Cowan-Sharp](https://gist.github.com/834610): Simple liquid tags for Jekyll that convert inline math and block equations to the appropriate MathJax script tags.
|
||||
@@ -540,6 +543,7 @@ You can find a few useful plugins at the following locations:
|
||||
- [grunt-jekyll](https://github.com/dannygarcia/grunt-jekyll): A straightforward [Grunt](http://gruntjs.com/) plugin for Jekyll.
|
||||
- [jekyll-postfiles](https://github.com/indirect/jekyll-postfiles): Add `_postfiles` directory and {% raw %}`{{ postfile }}`{% endraw %} tag so the files a post refers to will always be right there inside your repo.
|
||||
- [A layout that compresses HTML](https://github.com/penibelst/jekyll-compress-html) by [Anatol Broder](http://penibelst.de/): Github Pages compatible, configurable way to compress HTML files on site build.
|
||||
- [Jekyll CO₂](https://github.com/wdenton/jekyll-co2): Generates HTML showing the monthly change in atmospheric CO₂ at the Mauna Loa observatory in Hawaii.
|
||||
|
||||
#### Editors
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ and web-based CMS systems, this will be a welcome change!
|
||||
As explained on the [directory structure](../structure/) page, the `_posts`
|
||||
folder is where your blog posts will live. These files can be either
|
||||
[Markdown](http://daringfireball.net/projects/markdown/) or
|
||||
[Textile](http://textile.sitemonks.com/) formatted text files, and as long as
|
||||
[Textile](http://redcloth.org/textile) formatted text files, and as long as
|
||||
they have [YAML front-matter](../frontmatter/), they will be converted from their
|
||||
source format into an HTML page that is part of your static site.
|
||||
|
||||
@@ -44,7 +44,7 @@ file. For example, the following are examples of valid post filenames:
|
||||
<div class="note">
|
||||
<h5>ProTip™: Link to other posts</h5>
|
||||
<p>
|
||||
Use the <a href="../templates#post_url"><code>post_url</code></a>
|
||||
Use the <a href="../templates#post-url"><code>post_url</code></a>
|
||||
tag to link to other posts without having to worry about the URL's
|
||||
breaking when the site permalink style changes.
|
||||
</p>
|
||||
@@ -56,7 +56,7 @@ All blog post files must begin with [YAML front-matter](../frontmatter/). After
|
||||
that, it's simply a matter of deciding which format you prefer. Jekyll supports
|
||||
two popular content markup formats:
|
||||
[Markdown](http://daringfireball.net/projects/markdown/) and
|
||||
[Textile](http://textile.sitemonks.com/). These formats each have their own way
|
||||
[Textile](http://redcloth.org/textile). These formats each have their own way
|
||||
of marking up different types of content within a post, so you should
|
||||
familiarize yourself with these formats and decide which one best suits your
|
||||
needs.
|
||||
|
||||
@@ -35,12 +35,9 @@ Jekyll’s growing use is producing a wide variety of tutorials, frameworks, ext
|
||||
> “Jekyll is a well-architected throwback to a time before WordPress, when men were men, and HTML was static. I like the ideas it espouses, and have made a few improvements to it’s core. Here, I’ll point out some highlights of my fork in the hopes that they see usage beyond this site.”
|
||||
- [‘About this Website’, by Carter Allen](http://cartera.me/2010/08/12/about-this-website/)
|
||||
> “Jekyll is everything that I ever wanted in a blogging engine. Really. It isn’t perfect, but what’s excellent about it is that if there’s something wrong, I know exactly how it works and how to fix it. It runs on the your machine only, and is essentially an added”build" step between you and the browser. I coded this entire site in TextMate using standard HTML5 and CSS3, and then at the end I added just a few little variables to the markup. Presto-chango, my site is built and I am at peace with the world.”
|
||||
- [Generating a Tag Cloud in Jekyll](http://www.justkez.com/generating-a-tag-cloud-in-jekyll/)
|
||||
- [Generating a Tag Cloud in Jekyll](http://www.justkez.com/generating-a-tag-cloud-in-jekyll/)
|
||||
A guide to implementing a tag cloud and per-tag content pages using Jekyll.
|
||||
|
||||
A guide to implementing a tag cloud and per-tag content pages using Jekyll.
|
||||
|
||||
- [Jekyll Extensions -= Pain](http://rfelix.com/2010/01/19/jekyll-extensions-minus-equal-pain/)
|
||||
|
||||
A way to [extend Jekyll](https://github.com/rfelix/jekyll_ext) without forking and modifying the Jekyll gem codebase and some [portable Jekyll extensions](https://wiki.github.com/rfelix/jekyll_ext/extensions) that can be reused and shared.
|
||||
- A way to [extend Jekyll](https://github.com/rfelix/jekyll_ext) without forking and modifying the Jekyll gem codebase and some [portable Jekyll extensions](https://wiki.github.com/rfelix/jekyll_ext/extensions) that can be reused and shared.
|
||||
|
||||
- [Using your Rails layouts in Jekyll](http://numbers.brighterplanet.com/2010/08/09/sharing-rails-views-with-jekyll)
|
||||
|
||||
@@ -119,16 +119,6 @@ Firefox and possibly other browsers and is [discouraged in
|
||||
XHTML.](http://www.w3.org/TR/xhtml1/#C_3) An easy fix is to put a space
|
||||
between the opening and closing tags.
|
||||
|
||||
### RedCloth
|
||||
|
||||
Versions 4.1.1 and higher do not obey the notextile tag. [This is a known
|
||||
bug](http://aaronqian.com/articles/2009/04/07/redcloth-ate-my-notextile.html)
|
||||
and will hopefully be fixed for 4.2. You can still use 4.1.9, but the
|
||||
test suite requires that 4.1.0 be installed. If you use a version of
|
||||
RedCloth that does not have the notextile tag, you may notice that
|
||||
syntax highlighted blocks from Pygments or Rouge are not formatted
|
||||
correctly, among other things. If you’re seeing this just install 4.1.0.
|
||||
|
||||
### Liquid
|
||||
|
||||
The latest version, version 2.0, seems to break the use of `{{ "{{" }}` in
|
||||
|
||||
@@ -122,6 +122,30 @@ following is a reference of the available data.
|
||||
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><code>site.html_pages</code></p></td>
|
||||
<td><p>
|
||||
|
||||
A list of all HTML Pages.
|
||||
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><code>site.collections</code></p></td>
|
||||
<td><p>
|
||||
|
||||
A list of all the collections.
|
||||
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><code>site.data</code></p></td>
|
||||
<td><p>
|
||||
|
||||
A list containing the data loaded from the YAML files located in the <code>_data</code> directory.
|
||||
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><code>site.documents</code></p></td>
|
||||
<td><p>
|
||||
|
||||
@@ -12,7 +12,7 @@ knowledge and lessons that have been unearthed by Windows users.
|
||||
|
||||
## Installation
|
||||
|
||||
Madhur Ahuja has written up instructions to get
|
||||
Julian Thilo has written up instructions to get
|
||||
[Jekyll running on Windows][windows-installation] and it seems to work for most.
|
||||
|
||||
## Encoding
|
||||
@@ -29,7 +29,7 @@ the site generation process. It can be done with the following command:
|
||||
$ chcp 65001
|
||||
{% endhighlight %}
|
||||
|
||||
[windows-installation]: http://www.madhur.co.in/blog/2011/09/01/runningjekyllwindows.html
|
||||
[windows-installation]: http://jekyll-windows.juthilo.com/
|
||||
|
||||
## Auto-regeneration
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ overview: true
|
||||
</div>
|
||||
<div class="unit one-third">
|
||||
<h2>Static</h2>
|
||||
<p><a href="http://daringfireball.net/projects/markdown/">Markdown</a> (or <a href="http://textile.sitemonks.com/">Textile</a>), <a href="http://wiki.shopify.com/Liquid">Liquid</a>, HTML <span class="amp">&</span> CSS go in. Static sites come out ready for deployment.</p>
|
||||
<p><a href="http://daringfireball.net/projects/markdown/">Markdown</a> (or <a href="http://redcloth.org/textile">Textile</a>), <a href="http://wiki.shopify.com/Liquid">Liquid</a>, HTML <span class="amp">&</span> CSS go in. Static sites come out ready for deployment.</p>
|
||||
<a href="/docs/templates/">Jekyll template guide →</a>
|
||||
</div>
|
||||
<div class="unit one-third">
|
||||
|
||||
5
test/source/_slides/example-slide-3.html
Normal file
5
test/source/_slides/example-slide-3.html
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
title: Override permalink
|
||||
layout: slide
|
||||
permalink: /slide/3/
|
||||
---
|
||||
5
test/source/_with.dots/all.dots/2.4.0.md
Normal file
5
test/source/_with.dots/all.dots/2.4.0.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
title: v2.4.0
|
||||
---
|
||||
|
||||
v2.4.0
|
||||
0
test/source/_with.dots/file.with.dots.md
Normal file
0
test/source/_with.dots/file.with.dots.md
Normal file
@@ -17,15 +17,15 @@ class TestCollections < Test::Unit::TestCase
|
||||
end
|
||||
|
||||
should "sanitize the label name" do
|
||||
assert_equal @collection.label, "etcpassword"
|
||||
assert_equal @collection.label, "....etcpassword"
|
||||
end
|
||||
|
||||
should "have a sanitized relative path name" do
|
||||
assert_equal @collection.relative_directory, "_etcpassword"
|
||||
assert_equal @collection.relative_directory, "_....etcpassword"
|
||||
end
|
||||
|
||||
should "have a sanitized full path" do
|
||||
assert_equal @collection.directory, source_dir("_etcpassword")
|
||||
assert_equal @collection.directory, source_dir("_....etcpassword")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -194,4 +194,31 @@ class TestCollections < Test::Unit::TestCase
|
||||
end
|
||||
end
|
||||
|
||||
context "with dots in the filenames" do
|
||||
setup do
|
||||
@site = fixture_site({
|
||||
"collections" => ["with.dots"],
|
||||
"safe" => true
|
||||
})
|
||||
@site.process
|
||||
@collection = @site.collections["with.dots"]
|
||||
end
|
||||
|
||||
should "exist" do
|
||||
assert_not_nil @collection
|
||||
end
|
||||
|
||||
should "contain one document" do
|
||||
assert_equal 2, @collection.docs.size
|
||||
end
|
||||
|
||||
should "allow dots in the filename" do
|
||||
assert_equal "_with.dots", @collection.relative_directory
|
||||
end
|
||||
|
||||
should "read document in subfolders with dots" do
|
||||
assert @collection.docs.any? { |d| d.path.include?("all.dots") }
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -44,7 +44,7 @@ class TestCommand < Test::Unit::TestCase
|
||||
context "when fatal error occurs" do
|
||||
should "exit with non-zero error code" do
|
||||
site = Object.new
|
||||
stub(site).process { raise Jekyll::FatalException }
|
||||
stub(site).process { raise Jekyll::Errors::FatalException }
|
||||
error = assert_raise(SystemExit) { Command.process_site(site) }
|
||||
assert_not_equal 0, error.status
|
||||
end
|
||||
|
||||
@@ -165,6 +165,28 @@ class TestDocument < Test::Unit::TestCase
|
||||
end
|
||||
end
|
||||
|
||||
context "a document in a collection with a custom permalink" do
|
||||
setup do
|
||||
@site = Site.new(Jekyll.configuration({
|
||||
"collections" => ["slides"],
|
||||
"source" => source_dir,
|
||||
"destination" => dest_dir
|
||||
}))
|
||||
@site.process
|
||||
@document = @site.collections["slides"].docs[2]
|
||||
@dest_file = dest_dir("slide/3/index.html")
|
||||
end
|
||||
|
||||
should "know its permalink" do
|
||||
assert_equal "/slide/3/", @document.permalink
|
||||
end
|
||||
|
||||
should "produce the right URL" do
|
||||
assert_equal "/slide/3/", @document.url
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
context " a document part of a rendered collection" do
|
||||
end
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ class TestKramdown < Test::Unit::TestCase
|
||||
@markdown = Converters::Markdown.new(@config)
|
||||
end
|
||||
|
||||
# http://kramdown.rubyforge.org/converter/html.html#options
|
||||
# http://kramdown.gettalong.org/converter/html.html#options
|
||||
should "pass kramdown options" do
|
||||
assert_equal "<h1>Some Header</h1>", @markdown.convert('# Some Header #').strip
|
||||
end
|
||||
|
||||
@@ -76,6 +76,21 @@ class TestPost < Test::Unit::TestCase
|
||||
assert_equal "/2008/09/09/foo-bar", @post.id
|
||||
end
|
||||
|
||||
should "keep categories" do
|
||||
post = Post.allocate
|
||||
post.site = @site
|
||||
post.process("cat1/2008-09-09-foo-bar.textile")
|
||||
assert_equal 1, post.categories.size
|
||||
assert_equal "cat1", post.categories[0]
|
||||
|
||||
post = Post.allocate
|
||||
post.site = @site
|
||||
post.process("cat2/CAT3/2008-09-09-foo-bar.textile")
|
||||
assert_equal 2, post.categories.size
|
||||
assert_equal "cat2", post.categories[0]
|
||||
assert_equal "cat3", post.categories[1]
|
||||
end
|
||||
|
||||
should "create url based on date and title" do
|
||||
@post.categories = []
|
||||
@post.process(@fake_file)
|
||||
@@ -83,7 +98,7 @@ class TestPost < Test::Unit::TestCase
|
||||
end
|
||||
|
||||
should "raise a good error on invalid post date" do
|
||||
assert_raise Jekyll::FatalException do
|
||||
assert_raise Jekyll::Errors::FatalException do
|
||||
@post.process("2009-27-03-foo-bar.textile")
|
||||
end
|
||||
end
|
||||
@@ -615,7 +630,7 @@ class TestPost < Test::Unit::TestCase
|
||||
|
||||
should "generate categories and topics" do
|
||||
post = Post.new(@site, File.join(File.dirname(__FILE__), *%w[source]), 'foo', 'bar/2008-12-12-topical-post.textile')
|
||||
assert_equal ['foo'], post.categories
|
||||
assert_equal ['foo', 'bar'], post.categories
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -212,7 +212,7 @@ class TestSite < Test::Unit::TestCase
|
||||
|
||||
posts = Dir[source_dir("**", "_posts", "**", "*")]
|
||||
posts.delete_if { |post| File.directory?(post) && !Post.valid?(post) }
|
||||
categories = %w(2013 bar baz category foo z_category publish_test win).sort
|
||||
categories = %w(2013 bar baz category es foo z_category publish_test win).sort
|
||||
|
||||
assert_equal posts.size - @num_invalid_posts, @site.posts.size
|
||||
assert_equal categories, @site.categories.keys.sort
|
||||
@@ -225,7 +225,7 @@ class TestSite < Test::Unit::TestCase
|
||||
Jekyll::Configuration::DEFAULTS.merge({'source' => source_dir, 'destination' => source_dir})
|
||||
end
|
||||
|
||||
assert_raise Jekyll::FatalException do
|
||||
assert_raise Jekyll::Errors::FatalException do
|
||||
site = Site.new(Jekyll.configuration)
|
||||
end
|
||||
end
|
||||
@@ -235,7 +235,7 @@ class TestSite < Test::Unit::TestCase
|
||||
Jekyll::Configuration::DEFAULTS.merge({'source' => source_dir, 'destination' => File.join(source_dir, "..")})
|
||||
end
|
||||
|
||||
assert_raise Jekyll::FatalException do
|
||||
assert_raise Jekyll::Errors::FatalException do
|
||||
site = Site.new(Jekyll.configuration)
|
||||
end
|
||||
end
|
||||
@@ -332,7 +332,7 @@ class TestSite < Test::Unit::TestCase
|
||||
|
||||
bad_processor = "Custom::Markdown"
|
||||
s = Site.new(Jekyll.configuration.merge({ 'markdown' => bad_processor }))
|
||||
assert_raise Jekyll::FatalException do
|
||||
assert_raise Jekyll::Errors::FatalException do
|
||||
s.process
|
||||
end
|
||||
|
||||
@@ -352,7 +352,7 @@ class TestSite < Test::Unit::TestCase
|
||||
should 'throw FatalException at process time' do
|
||||
bad_processor = 'not a processor name'
|
||||
s = Site.new(Jekyll.configuration.merge({ 'markdown' => bad_processor }))
|
||||
assert_raise Jekyll::FatalException do
|
||||
assert_raise Jekyll::Errors::FatalException do
|
||||
s.process
|
||||
end
|
||||
end
|
||||
|
||||
@@ -76,11 +76,48 @@ CONTENT
|
||||
tag = Jekyll::Tags::HighlightBlock.new('highlight', 'ruby linenos=table cssclass=hl', ["test", "{% endhighlight %}", "\n"])
|
||||
assert_equal({ :cssclass => 'hl', :linenos => 'table' }, tag.instance_variable_get(:@options))
|
||||
|
||||
tag = Jekyll::Tags::HighlightBlock.new('highlight', 'ruby linenos=table cssclass=hl hl_linenos=3', ["test", "{% endhighlight %}", "\n"])
|
||||
assert_equal({ :cssclass => 'hl', :linenos => 'table', :hl_linenos => '3' }, tag.instance_variable_get(:@options))
|
||||
|
||||
tag = Jekyll::Tags::HighlightBlock.new('highlight', 'ruby linenos=table cssclass=hl hl_linenos="3 5 6"', ["test", "{% endhighlight %}", "\n"])
|
||||
assert_equal({ :cssclass => 'hl', :linenos => 'table', :hl_linenos => ['3', '5', '6'] }, tag.instance_variable_get(:@options))
|
||||
|
||||
tag = Jekyll::Tags::HighlightBlock.new('highlight', 'Ruby ', ["test", "{% endhighlight %}", "\n"])
|
||||
assert_equal "ruby", tag.instance_variable_get(:@lang), "lexers should be case insensitive"
|
||||
end
|
||||
end
|
||||
|
||||
context "in safe mode" do
|
||||
setup do
|
||||
@tag = Jekyll::Tags::HighlightBlock.new('highlight', 'text ', ["test", "{% endhighlight %}", "\n"])
|
||||
end
|
||||
|
||||
should "allow linenos" do
|
||||
sanitized = @tag.sanitized_opts({:linenos => true}, true)
|
||||
assert_equal true, sanitized[:linenos]
|
||||
end
|
||||
|
||||
should "allow hl_linenos" do
|
||||
sanitized = @tag.sanitized_opts({:hl_linenos => %w[1 2 3 4]}, true)
|
||||
assert_equal %w[1 2 3 4], sanitized[:hl_linenos]
|
||||
end
|
||||
|
||||
should "allow cssclass" do
|
||||
sanitized = @tag.sanitized_opts({:cssclass => "ahoy"}, true)
|
||||
assert_equal "ahoy", sanitized[:cssclass]
|
||||
end
|
||||
|
||||
should "allow startinline" do
|
||||
sanitized = @tag.sanitized_opts({:startinline => true}, true)
|
||||
assert_equal true, sanitized[:startinline]
|
||||
end
|
||||
|
||||
should "strip unknown options" do
|
||||
sanitized = @tag.sanitized_opts({:light => true}, true)
|
||||
assert_nil sanitized[:light]
|
||||
end
|
||||
end
|
||||
|
||||
context "post content has highlight tag" do
|
||||
setup do
|
||||
fill_post("test")
|
||||
@@ -238,8 +275,8 @@ CONTENT
|
||||
end
|
||||
|
||||
should "have the url to the \"nested\" post from 2008-11-21" do
|
||||
assert_match %r{3\s/2008/11/21/nested/}, @result
|
||||
assert_match %r{4\s/2008/11/21/nested/}, @result
|
||||
assert_match %r{3\s/es/2008/11/21/nested/}, @result
|
||||
assert_match %r{4\s/es/2008/11/21/nested/}, @result
|
||||
end
|
||||
end
|
||||
|
||||
@@ -414,9 +451,8 @@ CONTENT
|
||||
)
|
||||
end
|
||||
|
||||
# todo: if #112 is merged into maruku, update to remove the newlines inside code block
|
||||
should "render fenced code blocks" do
|
||||
assert_match %r{<pre class=\"ruby\"><code class=\"ruby\">\nputs "Hello world"\n</code></pre>}, @result.strip
|
||||
assert_match %r{<pre class=\"ruby\"><code class=\"ruby\">puts "Hello world"</code></pre>}, @result.strip
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user