mirror of
https://github.com/jekyll/jekyll.git
synced 2026-04-28 03:01:03 -04:00
Compare commits
129 Commits
debug-7328
...
pages-as-d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2d191bce81 | ||
|
|
49c4666ec9 | ||
|
|
b16080d016 | ||
|
|
94fb5985b7 | ||
|
|
0ae6fa4c7a | ||
|
|
caae9d2eca | ||
|
|
cb84017bbe | ||
|
|
0728ccf08b | ||
|
|
0b6962cfe9 | ||
|
|
3204445d6f | ||
|
|
76422b03b7 | ||
|
|
76919eea3b | ||
|
|
1d461224dd | ||
|
|
8b63fbed6b | ||
|
|
f0cbbbb304 | ||
|
|
55ea4c840b | ||
|
|
bbc9c99cf9 | ||
|
|
6dbf8f469c | ||
|
|
cd996387a5 | ||
|
|
baf70295f9 | ||
|
|
10b23f7466 | ||
|
|
e47dad9d20 | ||
|
|
4baa0093ed | ||
|
|
d7cef0c6db | ||
|
|
4c2c33aefd | ||
|
|
c6415ce081 | ||
|
|
0e360623cb | ||
|
|
035ea729ff | ||
|
|
6c771608e5 | ||
|
|
6805f1c342 | ||
|
|
1684905ec7 | ||
|
|
d64493806c | ||
|
|
e3b325931b | ||
|
|
a96f846bdb | ||
|
|
97c28f5495 | ||
|
|
e932a1e27f | ||
|
|
9aec161550 | ||
|
|
9968df06b3 | ||
|
|
bc84603017 | ||
|
|
784f2e2c0d | ||
|
|
aed72f6464 | ||
|
|
b915c7577b | ||
|
|
3bf940b7ee | ||
|
|
fbaf591c12 | ||
|
|
007af750f4 | ||
|
|
62d297d4a0 | ||
|
|
df0a5f7b0b | ||
|
|
8bb98632b4 | ||
|
|
5a41149b7b | ||
|
|
4f06767ac8 | ||
|
|
c6000597d9 | ||
|
|
b63036989a | ||
|
|
9343d2e6bb | ||
|
|
5d1823b604 | ||
|
|
149d5de59a | ||
|
|
c2211eec0c | ||
|
|
0b196ebd00 | ||
|
|
56593bf897 | ||
|
|
e9b507a0df | ||
|
|
a59eaff789 | ||
|
|
e2d8d3b92f | ||
|
|
66f8e748fe | ||
|
|
0c5b74377b | ||
|
|
cec17d03f8 | ||
|
|
9e76d2b496 | ||
|
|
192df096b0 | ||
|
|
694800270a | ||
|
|
7612056bed | ||
|
|
e0758ba550 | ||
|
|
41fa9cda36 | ||
|
|
be25b47486 | ||
|
|
f8dfbd2f7b | ||
|
|
acdbf81476 | ||
|
|
7e1afd32a5 | ||
|
|
1eff0214d1 | ||
|
|
bb1889afe4 | ||
|
|
3eb73f2795 | ||
|
|
b95151c4a7 | ||
|
|
c0ae27f068 | ||
|
|
64677e7c36 | ||
|
|
3899bf52f8 | ||
|
|
15f1ed8c4f | ||
|
|
b6201db17f | ||
|
|
ed9e72db9e | ||
|
|
a499018dc8 | ||
|
|
c08b882717 | ||
|
|
b0a1c42222 | ||
|
|
da6c4c488a | ||
|
|
a80442ee87 | ||
|
|
305342ffa4 | ||
|
|
b22e281bc5 | ||
|
|
5b37555835 | ||
|
|
95a103b882 | ||
|
|
12fa319ee4 | ||
|
|
9461c900c0 | ||
|
|
e00c8c72e9 | ||
|
|
3e8196fc7e | ||
|
|
eea203c77e | ||
|
|
8c8e2db0e5 | ||
|
|
ebce53dd08 | ||
|
|
34b710e133 | ||
|
|
f686b244cf | ||
|
|
739411ff3b | ||
|
|
c8eb0c1950 | ||
|
|
27ca1282fa | ||
|
|
b22915fe22 | ||
|
|
cf6d60b145 | ||
|
|
c60dd66db5 | ||
|
|
c2851766c5 | ||
|
|
c27533c75d | ||
|
|
f81f1e8e1b | ||
|
|
99da7cd940 | ||
|
|
3e32d12c45 | ||
|
|
3af8553c7c | ||
|
|
7f9ac93e4f | ||
|
|
4dd00fd354 | ||
|
|
3ee71c048c | ||
|
|
77fe78eaf7 | ||
|
|
0dede77a4a | ||
|
|
f9f5d5fa57 | ||
|
|
d5c2ebe610 | ||
|
|
f691121d2b | ||
|
|
29787c7eb7 | ||
|
|
83d950a4b7 | ||
|
|
5966e84313 | ||
|
|
66a8a03124 | ||
|
|
40d6ebd85e | ||
|
|
21d5dd7761 | ||
|
|
ef3e660620 |
64
.rubocop.yml
64
.rubocop.yml
@@ -8,7 +8,7 @@ Jekyll/NoPutsAllowed:
|
||||
- rake/*.rake
|
||||
|
||||
AllCops:
|
||||
TargetRubyVersion: 2.1
|
||||
TargetRubyVersion: 2.3
|
||||
Include:
|
||||
- lib/**/*.rb
|
||||
Exclude:
|
||||
@@ -18,30 +18,14 @@ AllCops:
|
||||
- script/**/*
|
||||
- vendor/**/*
|
||||
- tmp/**/*
|
||||
Layout/AlignArray:
|
||||
Enabled: false
|
||||
Layout/AlignHash:
|
||||
EnforcedHashRocketStyle: table
|
||||
Layout/AlignParameters:
|
||||
Enabled: false
|
||||
Layout/EmptyLinesAroundAccessModifier:
|
||||
Enabled: false
|
||||
Layout/EmptyLinesAroundModuleBody:
|
||||
Enabled: false
|
||||
Layout/EndOfLine:
|
||||
EnforcedStyle: native
|
||||
Layout/ExtraSpacing:
|
||||
AllowForAlignment: true
|
||||
Layout/FirstParameterIndentation:
|
||||
EnforcedStyle: consistent
|
||||
Layout/IndentationWidth:
|
||||
Severity: error
|
||||
Layout/IndentArray:
|
||||
EnforcedStyle: consistent
|
||||
Layout/IndentHash:
|
||||
EnforcedStyle: consistent
|
||||
Layout/IndentHeredoc:
|
||||
Enabled: false
|
||||
Layout/MultilineMethodCallIndentation:
|
||||
EnforcedStyle: indented
|
||||
Layout/MultilineOperationIndentation:
|
||||
@@ -55,10 +39,9 @@ Layout/EndAlignment:
|
||||
Severity: error
|
||||
Lint/UnreachableCode:
|
||||
Severity: error
|
||||
Lint/UselessAccessModifier:
|
||||
Enabled: false
|
||||
Lint/Void:
|
||||
Enabled: false
|
||||
Exclude:
|
||||
- lib/jekyll/site.rb
|
||||
Metrics/AbcSize:
|
||||
Max: 21
|
||||
Metrics/BlockLength:
|
||||
@@ -66,22 +49,26 @@ Metrics/BlockLength:
|
||||
- test/**/*.rb
|
||||
- lib/jekyll/configuration.rb
|
||||
- rake/*.rake
|
||||
- jekyll.gemspec
|
||||
Metrics/ClassLength:
|
||||
Exclude:
|
||||
- !ruby/regexp /features\/.*.rb$/
|
||||
- !ruby/regexp /test\/.*.rb$/
|
||||
Max: 300
|
||||
- lib/jekyll/document.rb
|
||||
- lib/jekyll/site.rb
|
||||
- lib/jekyll/commands/serve.rb
|
||||
- lib/jekyll/configuration.rb
|
||||
Max: 240
|
||||
Metrics/CyclomaticComplexity:
|
||||
Max: 9
|
||||
Exclude:
|
||||
- lib/jekyll/utils.rb
|
||||
- lib/jekyll/commands/serve.rb
|
||||
Metrics/LineLength:
|
||||
Exclude:
|
||||
- !ruby/regexp /features\/.*.rb/
|
||||
- Rakefile
|
||||
- rake/*.rake
|
||||
- Gemfile
|
||||
- jekyll.gemspec
|
||||
Max: 90
|
||||
Max: 100
|
||||
Severity: warning
|
||||
Metrics/MethodLength:
|
||||
CountComments: false
|
||||
@@ -95,8 +82,6 @@ Metrics/PerceivedComplexity:
|
||||
Max: 8
|
||||
Naming/FileName:
|
||||
Enabled: false
|
||||
Naming/HeredocDelimiterNaming:
|
||||
Enabled: false
|
||||
Naming/MemoizedInstanceVariableName:
|
||||
Exclude:
|
||||
- lib/jekyll/page_without_a_file.rb
|
||||
@@ -113,20 +98,16 @@ Security/YAMLLoad:
|
||||
Exclude:
|
||||
- !ruby/regexp /features\/.*.rb/
|
||||
- !ruby/regexp /test\/.*.rb$/
|
||||
Style/Alias:
|
||||
Style/AccessModifierDeclarations:
|
||||
Enabled: false
|
||||
Style/Alias:
|
||||
EnforcedStyle: prefer_alias_method
|
||||
Style/AndOr:
|
||||
Severity: error
|
||||
Style/BracesAroundHashParameters:
|
||||
Enabled: false
|
||||
Style/ClassAndModuleChildren:
|
||||
Enabled: false
|
||||
Style/FrozenStringLiteralComment:
|
||||
EnforcedStyle: always
|
||||
Style/Documentation:
|
||||
Enabled: false
|
||||
Exclude:
|
||||
- !ruby/regexp /features\/.*.rb$/
|
||||
Style/DoubleNegation:
|
||||
Enabled: false
|
||||
Style/FormatStringToken:
|
||||
@@ -137,10 +118,6 @@ Style/GuardClause:
|
||||
Style/HashSyntax:
|
||||
EnforcedStyle: hash_rockets
|
||||
Severity: error
|
||||
Style/IfUnlessModifier:
|
||||
Enabled: false
|
||||
Style/InverseMethods:
|
||||
Enabled: false
|
||||
Style/MixinUsage:
|
||||
Exclude:
|
||||
- test/helper.rb
|
||||
@@ -157,24 +134,21 @@ Style/PercentLiteralDelimiters:
|
||||
"%w": "()"
|
||||
"%W": "()"
|
||||
"%x": "()"
|
||||
Style/RedundantReturn:
|
||||
Enabled: false
|
||||
Style/RedundantSelf:
|
||||
Enabled: false
|
||||
Style/RegexpLiteral:
|
||||
EnforcedStyle: percent_r
|
||||
Style/RescueModifier:
|
||||
Enabled: false
|
||||
Style/SafeNavigation:
|
||||
Exclude:
|
||||
- lib/jekyll/document.rb
|
||||
Style/SignalException:
|
||||
EnforcedStyle: only_raise
|
||||
Style/SingleLineMethods:
|
||||
Enabled: false
|
||||
Style/StringLiterals:
|
||||
EnforcedStyle: double_quotes
|
||||
Style/StringLiteralsInInterpolation:
|
||||
EnforcedStyle: double_quotes
|
||||
Style/SymbolArray:
|
||||
Enabled: false
|
||||
EnforcedStyle: brackets
|
||||
Style/TrailingCommaInArrayLiteral:
|
||||
EnforcedStyleForMultiline: consistent_comma
|
||||
Style/TrailingCommaInHashLiteral:
|
||||
|
||||
@@ -8,7 +8,6 @@ rvm:
|
||||
- &ruby1 2.5.1
|
||||
- &ruby2 2.4.4
|
||||
- &ruby3 2.3.7
|
||||
- &ruby4 2.2.10
|
||||
- &jruby jruby-9.1.16.0
|
||||
|
||||
matrix:
|
||||
@@ -17,8 +16,6 @@ matrix:
|
||||
env: TEST_SUITE=fmt
|
||||
- rvm: *ruby1
|
||||
env: TEST_SUITE=default-site
|
||||
- rvm: *ruby1
|
||||
env: ROUGE_VERSION=1.11.1 # runs everything with this version
|
||||
exclude:
|
||||
- rvm: *jruby
|
||||
env: TEST_SUITE=cucumber
|
||||
|
||||
20
Gemfile
20
Gemfile
@@ -5,11 +5,6 @@ gemspec :name => "jekyll"
|
||||
|
||||
gem "rake", "~> 12.0"
|
||||
|
||||
gem "rouge", ENV["ROUGE"] if ENV["ROUGE"]
|
||||
|
||||
# Dependency of jekyll-mentions. RubyGems in Ruby 2.1 doesn't shield us from this.
|
||||
gem "activesupport", "~> 4.2", :groups => [:test_legacy, :site] if RUBY_VERSION < "2.2.2"
|
||||
|
||||
group :development do
|
||||
gem "launchy", "~> 2.3"
|
||||
gem "pry"
|
||||
@@ -23,15 +18,14 @@ end
|
||||
|
||||
group :test do
|
||||
gem "codeclimate-test-reporter", "~> 1.0.5"
|
||||
gem "cucumber", RUBY_VERSION >= "2.2" ? "~> 3.0" : "3.0.1"
|
||||
gem "cucumber", "~> 3.0"
|
||||
gem "httpclient"
|
||||
gem "jekyll_test_plugin"
|
||||
gem "jekyll_test_plugin_malicious"
|
||||
# nokogiri v1.8 does not work with ruby 2.1 and below
|
||||
gem "nokogiri", RUBY_VERSION >= "2.2" ? "~> 1.7" : "~> 1.7.0"
|
||||
gem "nokogiri", "~> 1.7"
|
||||
gem "rspec"
|
||||
gem "rspec-mocks"
|
||||
gem "rubocop", "~> 0.56.0"
|
||||
gem "rubocop", "~> 0.57.2"
|
||||
gem "test-dependency-theme", :path => File.expand_path("test/fixtures/test-dependency-theme", __dir__)
|
||||
gem "test-theme", :path => File.expand_path("test/fixtures/test-theme", __dir__)
|
||||
|
||||
@@ -41,7 +35,7 @@ end
|
||||
#
|
||||
|
||||
group :test_legacy do
|
||||
if RUBY_PLATFORM =~ %r!cygwin! || RUBY_VERSION.start_with?("2.2")
|
||||
if RUBY_PLATFORM =~ %r!cygwin!
|
||||
gem "test-unit"
|
||||
end
|
||||
|
||||
@@ -75,16 +69,14 @@ group :jekyll_optional_dependencies do
|
||||
gem "jekyll-redirect-from"
|
||||
gem "kramdown", "~> 1.14"
|
||||
gem "mime-types", "~> 3.0"
|
||||
gem "rdoc", RUBY_VERSION >= "2.2.2" ? "~> 6.0" : "~> 5.1"
|
||||
gem "rdoc", "~> 6.0"
|
||||
gem "tomlrb", "~> 1.2"
|
||||
|
||||
platform :ruby, :mswin, :mingw, :x64_mingw do
|
||||
gem "classifier-reborn", "~> 2.2.0"
|
||||
gem "liquid-c", "~> 3.0"
|
||||
gem "pygments.rb", "~> 1.0"
|
||||
gem "rdiscount", "~> 2.0"
|
||||
gem "redcarpet", "~> 3.2", ">= 3.2.3"
|
||||
gem "yajl-ruby", "~> 1.3.1"
|
||||
gem "yajl-ruby", "~> 1.3"
|
||||
end
|
||||
|
||||
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
|
||||
|
||||
@@ -1,3 +1,66 @@
|
||||
## HEAD
|
||||
|
||||
* Textile is only supported through a converter plugin (#7003)
|
||||
|
||||
### Documentation
|
||||
|
||||
* Release post for v3.8.0 (#6849)
|
||||
* Add Installation Instructions for Ubuntu (#6925)
|
||||
* add liquid tag jekyll-flickr (#6946)
|
||||
* Add 4.0 development post (#6934)
|
||||
* Updated copy - fixed casing of SaaS on resources page. (#6949)
|
||||
* WIP: Do not advise users to install Jekyll outside of Bundler (#6927)
|
||||
* Don't prompt for sudo when installing with Ubuntu WSL (#6781)
|
||||
* Fix typo (#6969)
|
||||
* Add version number for group_by_exp doc (#6956)
|
||||
* Update Windows install docs (#6926)
|
||||
* Remove documentation for using Redcarpet (#6990)
|
||||
* Updated nginx configuration for custom-404-page documentation (#6994)
|
||||
* List all static files variables (#7002)
|
||||
* Document that _drafts need to be contained within the custom collection directory (#6985)
|
||||
* proposed change for passive voice. (#7005)
|
||||
* added the CAT plugin to the plugin list (#7011)
|
||||
* Updated to supported version (#7031)
|
||||
* Clarify definition of 'draft' (#7037)
|
||||
* Listed the jekyll-target-blank plugin in plugins list. (#7046)
|
||||
* Typo (#7058)
|
||||
* Add Hints for some Improved Travis Config in Doc (#7049)
|
||||
* Added plugin json-get. (#7086)
|
||||
* Update travis-ci.md to point out "this is an example Gemfile" (#7089)
|
||||
* Adding `jekyll-info` plugin (#7091)
|
||||
|
||||
### Minor Enhancements
|
||||
|
||||
* use jekyll-compose if installed (#6932)
|
||||
* Memoize computing excerpt's relative_path (#6951)
|
||||
* Liquefied link tag (#6269)
|
||||
* Suggest re-running command with --trace on fail (#6551)
|
||||
|
||||
### Major Enhancements
|
||||
|
||||
* Remove unused error class (#6511)
|
||||
* Drop support for Ruby 2.1 and 2.2 (#6560)
|
||||
* Add vendor folder to a newly installed site's .gitignore (#6968)
|
||||
* bump i18n (#6931)
|
||||
* We are not using Ruby 2.2 anymore (#6977)
|
||||
* Drop support for older versions of Rouge (#6978)
|
||||
* Remove support for Redcarpet (#6987)
|
||||
* Remove support for rdiscount (#6988)
|
||||
|
||||
### Development Fixes
|
||||
|
||||
* Remove unnecessary Jekyll::Page constant (#6770)
|
||||
* Loggers should accept both numbers and symbols (#6967)
|
||||
* Update instructions for releasing docs Gem (#6975)
|
||||
* yajl-ruby update to v1.4.0 (#6976)
|
||||
* Load Rouge for TestKramdown (#7007)
|
||||
* Useless privates removed (#6768)
|
||||
* Allow i18n v0.9.5 and higher (#7044)
|
||||
* Update Rubocop's config (#7050)
|
||||
* Remember to release docs gem (#7066)
|
||||
* Use assert_include (#7093)
|
||||
* Update rubocop version to 0.57.x (#7078)
|
||||
|
||||
## 3.8.3 / 2018-06-05
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
@@ -5,11 +5,9 @@
|
||||
[][appveyor]
|
||||
[](codeclimate)
|
||||
[](coverage)
|
||||
[][gemnasium]
|
||||
[][hakiri]
|
||||
|
||||
[ruby-gems]: https://rubygems.org/gems/jekyll
|
||||
[gemnasium]: https://gemnasium.com/jekyll/jekyll
|
||||
[codeclimate]: https://codeclimate.com/github/jekyll/jekyll
|
||||
[coverage]: https://codeclimate.com/github/jekyll/jekyll/coverage
|
||||
[hakiri]: https://hakiri.io/github/jekyll/jekyll/master
|
||||
@@ -45,7 +43,7 @@ conduct.
|
||||
Please adhere to this code of conduct in any interactions you have in the
|
||||
Jekyll community. It is strictly enforced on all official Jekyll
|
||||
repositories, websites, and resources. If you encounter someone violating
|
||||
these terms, please let one of our core team members [Olivia](mailto:olivia@jekyllrb.com?subject=Jekyll%20CoC%20Violation), [Pat](mailto:pat@jekyllrb.com?subject=Jekyll%20CoC%20Violation), [Matt](mailto:matt@jekyllrb.com?subject=Jekyll%20CoC%20Violation) or [Parker](mailto:parker@jekyllrb.com?subject=Jekyll%20CoC%20Violation) know and we will address it as soon as possible.
|
||||
these terms, please let one of our [core team members](https://jekyllrb.com/team/#core-team) know and we will address it as soon as possible.
|
||||
|
||||
## Diving In
|
||||
|
||||
|
||||
@@ -28,8 +28,6 @@ environment:
|
||||
TEST_SUITE: "test"
|
||||
- RUBY_FOLDER_VER: "23"
|
||||
TEST_SUITE: "test"
|
||||
- RUBY_FOLDER_VER: "22"
|
||||
TEST_SUITE: "test"
|
||||
|
||||
test_script:
|
||||
- ruby --version
|
||||
|
||||
@@ -56,9 +56,9 @@ defaults:
|
||||
</div>
|
||||
|
||||
<div class="note warning">
|
||||
<h5>Be sure to move posts into custom collections directory</h5>
|
||||
<h5>Be sure to move drafts and posts into custom collections directory</h5>
|
||||
|
||||
<p>If you specify a directory to store all your collections in the same place with <code>collections_dir: my_collections</code>, then you will need to move your <code>_posts</code> directory to <code>my_collections/_posts</code>. Note that, the name of your collections directory cannot start with an underscore (`_`).</p>
|
||||
<p>If you specify a directory to store all your collections in the same place with <code>collections_dir: my_collections</code>, then you will need to move your <code>_drafts</code> and <code>_posts</code> directory to <code>my_collections/_drafts</code> and <code>my_collections/_posts</code>. Note that, the name of your collections directory cannot start with an underscore (`_`).</p>
|
||||
</div>
|
||||
|
||||
### Step 2: Add your content {#step2}
|
||||
|
||||
@@ -76,7 +76,7 @@ with Ruby and requires RubyGems to install, we use the Ruby language build
|
||||
environment. Below is a sample `.travis.yml` file, followed by
|
||||
an explanation of each line.
|
||||
|
||||
**Note:** You will need a Gemfile as well, [Travis will automatically install](https://docs.travis-ci.com/user/languages/ruby/#Dependency-Management) the dependencies based on the referenced gems:
|
||||
**Note:** You will need a Gemfile as well, [Travis will automatically install](https://docs.travis-ci.com/user/languages/ruby/#Dependency-Management) the dependencies based on the referenced gems. Here is an example `Gemfile` with two referenced gems, "jekyll" and "html-proofer":
|
||||
|
||||
```ruby
|
||||
source "https://rubygems.org"
|
||||
@@ -90,7 +90,7 @@ Your `.travis.yml` file should look like this:
|
||||
```yaml
|
||||
language: ruby
|
||||
rvm:
|
||||
- 2.3.3
|
||||
- 2.4.1
|
||||
|
||||
before_script:
|
||||
- chmod +x ./script/cibuild # or do this locally and commit
|
||||
@@ -110,6 +110,12 @@ env:
|
||||
- NOKOGIRI_USE_SYSTEM_LIBRARIES=true # speeds up installation of html-proofer
|
||||
|
||||
sudo: false # route your build to the container-based infrastructure for a faster build
|
||||
|
||||
cache: bundler # caching bundler gem packages will speed up build
|
||||
|
||||
# Optional: disable email notifications about the outcome of your builds
|
||||
notifications:
|
||||
email: false
|
||||
```
|
||||
|
||||
Ok, now for an explanation of each line:
|
||||
@@ -123,12 +129,13 @@ access to Bundler, RubyGems, and a Ruby runtime.
|
||||
|
||||
```yaml
|
||||
rvm:
|
||||
- 2.3.3
|
||||
- 2.4.1
|
||||
```
|
||||
|
||||
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.
|
||||
script. Use a [version which is pre-installed on the Travis build docker][5]
|
||||
image to speed up the build.
|
||||
|
||||
```yaml
|
||||
before_script:
|
||||
@@ -210,6 +217,23 @@ does need `sudo` access, modify the line to `sudo: required`.
|
||||
sudo: false
|
||||
```
|
||||
|
||||
To speed up the build, you should cache the gem packages created by `bundler`.
|
||||
Travis has a pre-defined [cache strategy for this tool][6] which should have
|
||||
all the default configs to do exactly that.
|
||||
|
||||
```yaml
|
||||
cache: bundler
|
||||
```
|
||||
|
||||
Optionally, if you are not interested in the build email notifications you
|
||||
can disable them with this configuration. Travis supports a wide array of
|
||||
notification services, you may find [another one more useful (e.g. slack)][7].
|
||||
|
||||
```yaml
|
||||
notifications:
|
||||
email: false
|
||||
```
|
||||
|
||||
### Troubleshooting
|
||||
|
||||
**Travis error:** *"You are trying to install in deployment mode after changing
|
||||
@@ -227,3 +251,6 @@ fix or [ask for help][4] if you run into trouble and need some help.
|
||||
|
||||
[3]: https://github.com/jekyll/jekyll/edit/master/docs/_docs/continuous-integration/travis-ci.md
|
||||
[4]: https://jekyllrb.com/help/
|
||||
[5]: https://docs.travis-ci.com/user/languages/ruby/#Specifying-Ruby-versions-and-implementations
|
||||
[6]: https://docs.travis-ci.com/user/caching/#Caching-directories-(Bundler%2C-dependencies)
|
||||
[7]: https://docs.travis-ci.com/user/notifications/
|
||||
|
||||
@@ -16,7 +16,7 @@ Whether you're a developer, a designer, or just a Jekyll devotee, there are lots
|
||||
|
||||
* [Install Jekyll on your computer](https://jekyllrb.com/docs/installation/) and kick the tires. Does it work? Does it do what you'd expect? If not, [open an issue](https://github.com/jekyll/jekyll/issues/new) and let us know.
|
||||
* Comment on some of the project's [open issues](https://github.com/jekyll/jekyll/issues). Have you experienced the same problem? Know a work around? Do you have a suggestion for how the feature could be better?
|
||||
* Read through [the documentation](https://jekyllrb.com/docs/home/), and click the "improve this page" button, any time you see something confusing, or have a suggestion for something that could be improved.
|
||||
* Read through [the documentation](https://jekyllrb.com/docs/home/), and click the "improve this page" button, any time you see something confusing, or have a suggestion on how to improve something.
|
||||
* Browse through [the Jekyll discussion forum](https://talk.jekyllrb.com/), and lend a hand answering questions. There's a good chance you've already experienced what another user is experiencing.
|
||||
* Find [an open issue](https://github.com/jekyll/jekyll/issues) (especially [those labeled `help-wanted`](https://github.com/jekyll/jekyll/issues?q=is%3Aopen+is%3Aissue+label%3Ahelp-wanted)), and submit a proposed fix. If it's your first pull request, we promise we won't bite, and are glad to answer any questions.
|
||||
* Help evaluate [open pull requests](https://github.com/jekyll/jekyll/pulls), by testing the changes locally and reviewing what's proposed.
|
||||
|
||||
@@ -3,7 +3,7 @@ title: Working with drafts
|
||||
permalink: /docs/drafts/
|
||||
---
|
||||
|
||||
Drafts are posts without a date. They're posts you're still working on and
|
||||
Drafts are posts without a date in the filename. They're posts you're still working on and
|
||||
don't want to publish yet. To get up and running with drafts, create a
|
||||
`_drafts` folder in your site's root (as described in the [site structure](/docs/structure/) section) and create your
|
||||
first draft:
|
||||
|
||||
@@ -4,12 +4,14 @@ description: Official guide to install Jekyll on macOS, GNU/Linux or Windows.
|
||||
permalink: /docs/installation/
|
||||
---
|
||||
|
||||
- [Requirements](#requirements)
|
||||
- [Install on macOS](#macOS)
|
||||
- [Install on Windows](../windows/)
|
||||
- [Upgrade Jekyll](#upgrade-jekyll)
|
||||
Jekyll is a [Ruby Gem](http://guides.rubygems.org/rubygems-basics/), and can be
|
||||
installed on most systems.
|
||||
|
||||
Installing Jekyll should be straight-forward if your system meets the requirements.
|
||||
- [Requirements](#requirements)
|
||||
- [Install Jekyll on macOS](#macOS)
|
||||
- [Install Jekyll on Ubuntu Linux](#ubuntu)
|
||||
- [Install Jekyll on Windows](../windows/)
|
||||
- [Upgrade Jekyll](#upgrade-jekyll)
|
||||
|
||||
## Requirements
|
||||
|
||||
@@ -111,6 +113,35 @@ Check out the [troubleshooting](../troubleshooting/) page or
|
||||
|
||||
</div>
|
||||
|
||||
## Install on Ubuntu Linux {#ubuntu}
|
||||
|
||||
Before we install Jekyll, we need to make sure we have all the required
|
||||
dependencies.
|
||||
|
||||
```sh
|
||||
sudo apt-get install ruby ruby-dev build-essential
|
||||
```
|
||||
|
||||
It is best to avoid installing Ruby Gems as the root user. Therefore, we need to
|
||||
set up a gem installation directory for your user account. The following
|
||||
commands will add environment variables to your `~/.bashrc` file to configure
|
||||
the gem installation path. Run them now:
|
||||
|
||||
```sh
|
||||
echo '# Install Ruby Gems to ~/gems' >> ~/.bashrc
|
||||
echo 'export GEM_HOME=$HOME/gems' >> ~/.bashrc
|
||||
echo 'export PATH=$HOME/gems/bin:$PATH' >> ~/.bashrc
|
||||
source ~/.bashrc
|
||||
```
|
||||
|
||||
Finally, install Jekyll:
|
||||
|
||||
```sh
|
||||
gem install jekyll bundler
|
||||
```
|
||||
|
||||
That's it! You're ready to start using Jekyll.
|
||||
|
||||
## Upgrade Jekyll
|
||||
|
||||
Before you start developing with Jekyll, you may want to check that you're up to date with the latest version. To find the currently installed version of Jekyll, run one of these commands:
|
||||
|
||||
@@ -69,6 +69,14 @@ And then, you're done! :tada: Feel free to celebrate!
|
||||
|
||||
If you have access to the [@jekyllrb](https://twitter.com/jekyllrb) Twitter account, you should tweet the release post from there. If not, just ask another maintainer to do it or to give you access.
|
||||
|
||||
### Build the docs
|
||||
|
||||
We package our documentation as a :gem: Gem for offline use.
|
||||
|
||||
This is done with the
|
||||
[**jekyll-docs**](https://github.com/jekyll/jekyll-docs#building) repository,
|
||||
and more detailed instructions are provided there.
|
||||
|
||||
## For non-core gems
|
||||
|
||||
If you're not a maintainer for `jekyll/jekyll`, the procedure is much simpler in a lot of cases. Generally, the procedure still looks like this:
|
||||
|
||||
@@ -14,7 +14,7 @@ your `_config.yml` under `plugins`. For Jekyll 2, this is standard.
|
||||
<div class="note info">
|
||||
<h5>Pagination only works within HTML files</h5>
|
||||
<p>
|
||||
Pagination does not work from within Markdown or Textile files from
|
||||
Pagination does not work from within Markdown files from
|
||||
your Jekyll site. Pagination works when called from within the HTML
|
||||
file, named <code>index.html</code>, which optionally may reside in and
|
||||
produce pagination from within a subdirectory, via the
|
||||
|
||||
@@ -787,6 +787,8 @@ You can find a few useful plugins at the following locations:
|
||||
- [Jekyll::Paginate::Content](https://github.com/ibrado/jekyll-paginate-content): Content paginator in the style of jekyll-paginator-v2 that splits pages, posts, and collection entries into several pages. Specify a separator or use HTML <h1> etc. headers. Automatic splitting, single-page view, pager/trail, self-adjusting links, multipage TOC, SEO support.
|
||||
- [Premonition](https://github.com/amedia/premonition): Adds block-styled side content to your page. For example summary, notes, hints or warning boxes.
|
||||
- [jekyll-fontello](https://github.com/ericcornelissen/jekyll-fontello): A Jekyll plugin that automatically downloads your webfont from Fontello.
|
||||
- [Target Blank](https://github.com/keithmifsud/jekyll-target-blank): A Jekyll plugin to automatically open external links in a new browser tab or window.
|
||||
- [jekyll-info](https://github.com/swestmoreland/jekyll-info): A plugin to provide information about your Jekyll site’s configuration.
|
||||
|
||||
#### Converters
|
||||
|
||||
@@ -886,6 +888,8 @@ You can find a few useful plugins at the following locations:
|
||||
- [jekyll-html](https://github.com/kacperduras/jekyll-html): A Jekyll plugin to use HTML tags in Jekyll pages, posts and collections.
|
||||
- [jekyll-onebox](https://github.com/rriemann/jekyll-onebox): Liquid tag for displaying HTML previews (embeds) for links to popular domains. Plugin is based on [Onebox](https://github.com/discourse/onebox) that powers link previews in [Discourse](http://github.com/discourse/discourse) forums.
|
||||
- [jekyll-w2m](https://github.com/kacperduras/jekyll-w2m): A Jekyll plugin to liberate content from Microsoft Word documents (powered by [word-to-markdown](https://github.com/benbalter/word-to-markdown)).
|
||||
- [jekyll-flickr](https://github.com/rriemann/jekyll-flickr): Liquid tag for responsive Flickr images using HTML5 srcset. Subtitles and automatic license notices are supported.
|
||||
- [CAT](https://github.com/binfalse/jekyll-cat): Include the contents of any file (like the `include` command, but also for files outside of `_include`). Similar to Unix' `cat` tool; useful for including source code etc. in posts and pages.
|
||||
|
||||
#### Collections
|
||||
|
||||
@@ -935,6 +939,7 @@ You can find a few useful plugins at the following locations:
|
||||
- [jekyll-pre-commit](https://github.com/mpchadwick/jekyll-pre-commit): A framework for running checks against your posts using a git pre-commit hook before you publish them.
|
||||
- [jekyll-pwa-plugin](https://github.com/lavas-project/jekyll-pwa): A plugin provides PWA support for Jekyll. It generates a service worker in Jekyll build process and makes precache and runtime cache available in the runtime with Google Workbox.
|
||||
- [jekyll-algolia](https://community.algolia.com/jekyll-algolia/): Add fast and relevant search to your Jekyll site through the Algolia API.
|
||||
- [jekyll-get](https://github.com/18F/jekyll-get): Download data from external JSON API sources to use in generating a site.
|
||||
|
||||
<div class="note info">
|
||||
<h5>Submit your gem plugins</h5>
|
||||
|
||||
@@ -26,13 +26,15 @@ If you encounter any unexpected errors during the above, please refer to the [tr
|
||||
|
||||
## About Bundler
|
||||
|
||||
`gem install jekyll bundler` installs the [jekyll](https://rubygems.org/gems/jekyll/) and [bundler](https://rubygems.org/gems/bundler) gems through [RubyGems](https://rubygems.org/). You need only to install the gems one time — not every time you create a new Jekyll project. Here are some additional details:
|
||||
`gem install bundler` installs the [bundler](https://rubygems.org/gems/bundler) gem through [RubyGems](https://rubygems.org/). You only need to install it once — not every time you create a new Jekyll project. Here are some additional details:
|
||||
|
||||
* `bundler` is a gem that manages other Ruby gems. It makes sure your gems and gem versions are compatible, and that you have all necessary dependencies each gem requires.
|
||||
* The `Gemfile` and `Gemfile.lock` files inform Bundler about the gem requirements in your site. If your site doesn't have these Gemfiles, you can omit `bundle exec` and just run `jekyll serve`.
|
||||
|
||||
* When you run `bundle exec jekyll serve`, Bundler uses the gems and versions as specified in `Gemfile.lock` to ensure your Jekyll site builds with no compatibility or dependency conflicts.
|
||||
|
||||
For more information about how to use Bundler in your Jekyll project, this [tutorial](https://jekyllrb.com/tutorials/using-jekyll-with-bundler/) should provide answers to the most common questions and explain how to get up and running quickly.
|
||||
|
||||
## Options for creating a new site with Jekyll
|
||||
|
||||
`jekyll new <PATH>` installs a new Jekyll site at the path specified (relative to current directory). In this case, Jekyll will be installed in a directory called `myblog`. Here are some additional details:
|
||||
|
||||
@@ -25,7 +25,7 @@ Jekyll's growing use is producing a wide variety of tutorials, frameworks, exten
|
||||
|
||||
## Integrations
|
||||
|
||||
- Use a saas service as a backend for forms (contact forms, hiring forms, etc.)
|
||||
- Use a SaaS service as a backend for forms (contact forms, hiring forms, etc.)
|
||||
|
||||
- [Formspree (open source)](https://formspree.io/)
|
||||
- [FormKeep](https://formkeep.com/guides/contact-form-jekyll?utm_source=github&utm_medium=jekyll-docs&utm_campaign=contact-form-jekyll)
|
||||
|
||||
@@ -5,7 +5,8 @@ permalink: /docs/structure/
|
||||
|
||||
Jekyll is, at its core, a text transformation engine. The concept behind the
|
||||
system is this: you give it text written in your favorite markup language, be
|
||||
that Markdown, Textile, or just plain HTML, and it churns that through a layout
|
||||
that Markdown, [Textile](https://github.com/jekyll/jekyll-textile-converter)
|
||||
, or just plain HTML, and it churns that through a layout
|
||||
or a series of layout files. Throughout that process you can tweak how you want
|
||||
the site URLs to look, what data gets displayed in the layout, and more. This
|
||||
is all done through editing text files; the static web site is the final
|
||||
@@ -185,7 +186,7 @@ An overview of what each of these does:
|
||||
<tr>
|
||||
<td>
|
||||
<p><code>index.html</code> or <code>index.md</code> and other HTML,
|
||||
Markdown, Textile files</p>
|
||||
Markdown files</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
|
||||
@@ -147,7 +147,8 @@ you come up with your own tags via plugins.
|
||||
<tr>
|
||||
<td>
|
||||
<p class="name"><strong>Where Expression</strong></p>
|
||||
<p>Select all the objects in an array where the expression is true. Jekyll v3.2.0 & later.</p>
|
||||
<p>Select all the objects in an array where the expression is true.
|
||||
{% include docs_version_badge.html version="3.2.0" %}</p>
|
||||
</td>
|
||||
<td class="align-center">
|
||||
<p>
|
||||
@@ -178,7 +179,8 @@ you come up with your own tags via plugins.
|
||||
<tr>
|
||||
<td>
|
||||
<p class="name"><strong>Group By Expression</strong></p>
|
||||
<p>Group an array's items using a Liquid expression.</p>
|
||||
<p>Group an array's items using a Liquid expression.
|
||||
{% include docs_version_badge.html version="3.4.0" %}</p>
|
||||
</td>
|
||||
<td class="align-center">
|
||||
<p>
|
||||
|
||||
@@ -44,6 +44,10 @@ For `site.collections.myCollection` in Jekyll 2, you now do:
|
||||
|
||||
This is a bit cumbersome at first, but is easier than a big `for` loop.
|
||||
|
||||
### Textile support
|
||||
|
||||
We dropped native support for Textile, from now on you have to install our [jekyll-textile-converter](https://github.com/jekyll/jekyll-textile-converter) plugin to work with Textile files.
|
||||
|
||||
### Dropped dependencies
|
||||
|
||||
We dropped a number of dependencies the Core Team felt were optional. As such, in 3.0, they must be explicitly installed and included if you use any of the features. They are:
|
||||
|
||||
@@ -124,8 +124,7 @@ following is a reference of the available data.
|
||||
|
||||
A list of all <a href="/docs/static-files/">static files</a> (i.e.
|
||||
files not processed by Jekyll's converters or the Liquid renderer).
|
||||
Each file has three properties: <code>path</code>,
|
||||
<code>modified_time</code> and <code>extname</code>.
|
||||
Each file has five properties: <code>path</code>, <code>modified_time</code>, <code>name</code>, <code>basename</code> and <code>extname</code>.
|
||||
|
||||
</p></td>
|
||||
</tr>
|
||||
|
||||
@@ -7,13 +7,72 @@ While Windows is not an officially-supported platform, it can be used to run Jek
|
||||
|
||||
|
||||
## Installing Jekyll
|
||||
The easiest way to run Jekyll is by using the [RubyInstaller][] for Windows.
|
||||
|
||||
If you are using Windows 10 Anniversary Update, the easiest way to run Jekyll is by [installing][WSL-Guide] the new Bash on Ubuntu on Windows.
|
||||
### Installation via RubyInstaller
|
||||
|
||||
[RubyInstaller][] is a self-contained Windows-based installer that includes the Ruby language, an execution environment, important documentation, and more.
|
||||
We only cover RubyInstaller-2.4 and newer here, older versions need to [install the Devkit][Devkit-install] manually.
|
||||
|
||||
1. Download and Install a **Ruby+Devkit** version from [RubyInstaller Downloads][RubyInstaller-downloads].
|
||||
Use default options for installation.
|
||||
2. Open a new command prompt window from the start menu, so that changes to the `PATH` environment variable becomes effective.
|
||||
Install Jekyll and Bundler via: `gem install jekyll bundler`
|
||||
3. Check if Jekyll installed properly: `jekyll -v`
|
||||
|
||||
That's it, you're ready to install our [default minimal blog theme](https://github.com/jekyll/minima) with `jekyll new jekyll-website`.
|
||||
|
||||
[RubyInstaller]: https://rubyinstaller.org/
|
||||
[RubyInstaller-downloads]: https://rubyinstaller.org/downloads/
|
||||
[Devkit-install]: https://github.com/oneclick/rubyinstaller/wiki/Development-Kit
|
||||
|
||||
|
||||
### Installation via Bash on Windows 10
|
||||
### Encoding
|
||||
|
||||
*Note:* You must have [Bash on Ubuntu on Windows][BASH-WSL] enabled.
|
||||
If you use UTF-8 encoding, make sure that no `BOM` header characters exist in your files or very, very bad things will happen to
|
||||
Jekyll. This is especially relevant when you're running Jekyll on Windows.
|
||||
|
||||
Additionally, you might need to change the code page of the console window to UTF-8 in case you get a "Liquid Exception: Incompatible character encoding" error during the site generation process. It can be done with the following command:
|
||||
|
||||
```sh
|
||||
chcp 65001
|
||||
```
|
||||
|
||||
|
||||
### Time-Zone Management
|
||||
|
||||
Since Windows doesn't have a native source of zoneinfo data, the Ruby Interpreter would not understand IANA Timezones and hence using them had the `TZ` environment variable default to UTC/GMT 00:00.
|
||||
Though Windows users could alternatively define their blog's timezone by setting the key to use POSIX format of defining timezones, it wasn't as user-friendly when it came to having the clock altered to changing DST-rules.
|
||||
|
||||
Jekyll now uses a rubygem to internally configure Timezone based on established [IANA Timezone Database][IANA-database].
|
||||
While 'new' blogs created with Jekyll v3.4 and greater, will have the following added to their 'Gemfile' by default, existing sites *will* have to update their 'Gemfile' (and installed) to enable development on Windows:
|
||||
|
||||
```ruby
|
||||
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
|
||||
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
|
||||
```
|
||||
|
||||
[IANA-database]: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
|
||||
|
||||
### Auto Regeneration
|
||||
|
||||
Jekyll uses the `listen` gem to watch for changes when the `--watch` switch is specified during a build or serve. While `listen` has built-in support for UNIX systems, it may require an extra gem for compatibility with Windows.
|
||||
|
||||
Add the following to the Gemfile for your site if you have issues with auto-regeneration on Windows alone:
|
||||
|
||||
```ruby
|
||||
gem 'wdm', '~> 0.1.1' if Gem.win_platform?
|
||||
```
|
||||
|
||||
You have to use a [Ruby+Devkit](https://rubyinstaller.org/downloads/) version of the RubyInstaller.
|
||||
|
||||
|
||||
## Installation via Bash on Windows 10
|
||||
|
||||
If you are using Windows 10 version 1607 or later, another option to run Jekyll is by [installing][WSL-Guide] the Windows Subsystem for Linux.
|
||||
|
||||
|
||||
*Note:* You must have [Windows Subsystem for Linux][BASH-WSL] enabled.
|
||||
|
||||
First let's make sure all our packages / repositories are up to date. Open a new Command Prompt instance, and type the following:
|
||||
|
||||
@@ -30,7 +89,7 @@ Now we can install Ruby. To do this we will use a repository from [BrightBox](ht
|
||||
```sh
|
||||
sudo apt-add-repository ppa:brightbox/ruby-ng
|
||||
sudo apt-get update
|
||||
sudo apt-get install ruby2.3 ruby2.3-dev build-essential dh-autoreconf
|
||||
sudo apt-get install ruby2.4 ruby2.4-dev build-essential dh-autoreconf
|
||||
```
|
||||
|
||||
Next let's update our Ruby gems:
|
||||
@@ -51,6 +110,12 @@ Check if Jekyll installed properly by running:
|
||||
jekyll -v
|
||||
```
|
||||
|
||||
Configure the bundler/gem path so bundle doesn't prompt for sudo
|
||||
|
||||
```sh
|
||||
bundle config path vendor/bundle
|
||||
```
|
||||
|
||||
**And that's it!**
|
||||
|
||||
To start a new project named `my_blog`, just run:
|
||||
@@ -71,148 +136,3 @@ You can make sure time management is working properly by inspecting your `_posts
|
||||
[WSL-Guide]: https://msdn.microsoft.com/en-us/commandline/wsl/install_guide
|
||||
[BASH-WSL]: https://msdn.microsoft.com/en-us/commandline/wsl/about
|
||||
|
||||
|
||||
### Installation via RubyInstaller
|
||||
|
||||
[RubyInstaller][] is a self-contained Windows-based installer that includes the Ruby language, an execution environment, important documentation, and more.
|
||||
|
||||
1. Download and Install a package manager version from [RubyInstaller Downloads][RubyInstaller-downloads].
|
||||
2. Install Jekyll and Bundler via a command prompt window: `gem install jekyll bundler`
|
||||
3. Check if Jekyll installed properly: `jekyll -v`
|
||||
|
||||
[RubyInstaller]: https://rubyinstaller.org/
|
||||
[RubyInstaller-downloads]: https://rubyinstaller.org/downloads/
|
||||
|
||||
|
||||
### Installation via Chocolatey
|
||||
|
||||
A quick way to install Jekyll using Chocolatey is to follow the [installation instructions by David Burela](https://davidburela.wordpress.com/2015/11/28/easily-install-jekyll-on-windows-with-3-command-prompt-entries-and-chocolatey/):
|
||||
|
||||
1. Install a package manager for Windows called [Chocolatey][]
|
||||
2. Install Ruby via Chocolatey: `choco install ruby -y`
|
||||
3. Reopen a command prompt and install Jekyll: `gem install jekyll`
|
||||
|
||||
Updates in the infrastructure of Ruby may cause SSL errors when attempting to use `gem install` with versions of the RubyGems package older than 2.6. (The RubyGems package installed via the Chocolatey tool is version 2.3) If you have installed an older version, you can update the RubyGems package using the directions [here][ssl-certificate-update].
|
||||
|
||||
[ssl-certificate-update]: http://guides.rubygems.org/ssl-certificate-update/#installing-using-update-packages
|
||||
|
||||
|
||||
### Installing *github-pages* via Chocolatey
|
||||
|
||||
This section is part of an article written by [Jens Willmer][jwillmerPost]. To follow the instructions you need to have [Chocolatey][] installed on your system. If you already have a version of Ruby installed you need to uninstall it before you can continue.
|
||||
|
||||
|
||||
#### Install Ruby and Ruby development kit
|
||||
|
||||
Open a command prompt and execute the following commands:
|
||||
|
||||
* `choco install ruby -version 2.2.4`
|
||||
* `choco install ruby2.devkit` - _needed for compilation of json gem_
|
||||
|
||||
|
||||
#### Configure Ruby development kit
|
||||
|
||||
The development kit did not set the environment path for Ruby so we need to do it.
|
||||
|
||||
* Open command prompt in `C:\tools\DevKit2`
|
||||
* Execute `ruby dk.rb init` to create a file called `config.yml`
|
||||
* Edit the `config.yml` file and include the path to Ruby `- C:/tools/ruby22`
|
||||
* Execute the following command to set the path: `ruby dk.rb install`
|
||||
|
||||
|
||||
#### Nokogiri gem installation
|
||||
|
||||
This gem is also needed in the github-pages and to get it running on Windows x64 we have to install a few things.
|
||||
|
||||
**Note:** In the current [pre release][nokogiriFails] it works out of the box with Windows x64 but this version is not referenced in the github-pages.
|
||||
|
||||
```sh
|
||||
choco install libxml2 -Source "https://www.nuget.org/api/v2/"
|
||||
|
||||
choco install libxslt -Source "https://www.nuget.org/api/v2/"
|
||||
|
||||
choco install libiconv -Source "https://www.nuget.org/api/v2/
|
||||
|
||||
gem install nokogiri --^
|
||||
--with-xml2-include=C:\Chocolatey\lib\libxml2.2.7.8.7\build\native\include^
|
||||
--with-xml2-lib=C:\Chocolatey\lib\libxml2.redist.2.7.8.7\build\native\bin\v110\x64\Release\dynamic\cdecl^
|
||||
--with-iconv-include=C:\Chocolatey\lib\libiconv.1.14.0.11\build\native\include^
|
||||
--with-iconv-lib=C:\Chocolatey\lib\libiconv.redist.1.14.0.11\build\native\bin\v110\x64\Release\dynamic\cdecl^
|
||||
--with-xslt-include=C:\Chocolatey\lib\libxslt.1.1.28.0\build\native\include^
|
||||
--with-xslt-lib=C:\Chocolatey\lib\libxslt.redist.1.1.28.0\build\native\bin\v110\x64\Release\dynamic
|
||||
```
|
||||
|
||||
#### Install github-pages
|
||||
|
||||
* Open command prompt and install [Bundler][]: `gem install bundler`
|
||||
* Create a file called `Gemfile` without any extension in your root directory of your blog
|
||||
* Copy & paste the two lines into the file:
|
||||
|
||||
|
||||
```ruby
|
||||
source 'https://rubygems.org'
|
||||
gem 'github-pages', group: :jekyll_plugins
|
||||
```
|
||||
|
||||
* **Note:** We use an unsecure connection because SSL throws exceptions in the version of Ruby
|
||||
* Open a command prompt, target your local blog repository root, and install github-pages: `bundle install`
|
||||
|
||||
|
||||
After this process you should have github-pages installed on your system and you can host your blog again with `jekyll s`.
|
||||
There will be a warning on startup that you should include `gem 'wdm', '>= 0.1.0' if Gem.win_platform?` to your `Gemfile` but I could not get `jekyll s` working if I include that line so for the moment I ignore that warning.
|
||||
|
||||
In the future the installation process of the github-pages should be as simple as the setup of the blog. But as long as the new version of the Nokogiri ([v1.6.8][nokogiriReleases]) is not stable and referenced, it is work to get it up and running on Windows.
|
||||
|
||||
[jwillmerPost]: https://jwillmer.de/blog/tutorial/how-to-install-jekyll-and-pages-gem-on-windows-10-x46 "Installation instructions by Jens Willmer"
|
||||
[Chocolatey]: https://chocolatey.org/install "Package manager for Windows"
|
||||
[nokogiriFails]: https://github.com/sparklemotion/nokogiri/issues/1456#issuecomment-206481794 "Nokogiri fails to install on Ruby 2.3 for Windows"
|
||||
[Bundler]: http://bundler.io/ "Ruby Dependencie Manager"
|
||||
[nokogiriReleases]: https://github.com/sparklemotion/nokogiri/releases "Nokogiri Releases"
|
||||
|
||||
For a more conventional way of installing Jekyll you can follow this [complete guide to install Jekyll 3 on Windows by Sverrir Sigmundarson][windows-installjekyll3].
|
||||
|
||||
Optionally you can use [Autoinstall Jekyll for Windows][fastjekyll-autoinstall].
|
||||
|
||||
[windows-installjekyll3]: https://labs.sverrirs.com/jekyll/
|
||||
[fastjekyll-autoinstall]: https://github.com/KeJunMao/fastjekyll#autoinstall-jekyll-for-windows
|
||||
|
||||
|
||||
## Encoding
|
||||
|
||||
If you use UTF-8 encoding, make sure that no `BOM` header characters exist in your files or very, very bad things will happen to
|
||||
Jekyll. This is especially relevant when you're running Jekyll on Windows.
|
||||
|
||||
Additionally, you might need to change the code page of the console window to UTF-8 in case you get a "Liquid Exception: Incompatible character encoding" error during the site generation process. It can be done with the following command:
|
||||
|
||||
```sh
|
||||
chcp 65001
|
||||
```
|
||||
|
||||
|
||||
## Time-Zone Management
|
||||
|
||||
Since Windows doesn't have a native source of zoneinfo data, the Ruby Interpreter would not understand IANA Timezones and hence using them had the `TZ` environment variable default to UTC/GMT 00:00.
|
||||
Though Windows users could alternatively define their blog's timezone by setting the key to use POSIX format of defining timezones, it wasn't as user-friendly when it came to having the clock altered to changing DST-rules.
|
||||
|
||||
Jekyll now uses a rubygem to internally configure Timezone based on established [IANA Timezone Database][IANA-database].
|
||||
While 'new' blogs created with Jekyll v3.4 and greater, will have the following added to their 'Gemfile' by default, existing sites *will* have to update their 'Gemfile' (and installed) to enable development on Windows:
|
||||
|
||||
```ruby
|
||||
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
|
||||
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
|
||||
```
|
||||
|
||||
[IANA-database]: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
|
||||
|
||||
|
||||
## Auto Regeneration
|
||||
|
||||
Jekyll uses the `listen` gem to watch for changes when the `--watch` switch is specified during a build or serve. While `listen` has built-in support for UNIX systems, it may require an extra gem for compatibility with Windows.
|
||||
|
||||
Add the following to the Gemfile for your site if you have issues with auto-regeneration on Windows alone:
|
||||
|
||||
```ruby
|
||||
gem 'wdm', '~> 0.1.1' if Gem.win_platform?
|
||||
```
|
||||
|
||||
You may first have to download and install the [Ruby DevKit](https://rubyinstaller.org/downloads/) by following [the instructions here](https://github.com/oneclick/rubyinstaller/wiki/Development-Kit).
|
||||
|
||||
28
docs/_posts/2018-03-14-development-update.md
Normal file
28
docs/_posts/2018-03-14-development-update.md
Normal file
@@ -0,0 +1,28 @@
|
||||
---
|
||||
title: "Jekyll 4.0 is on the Horizon!"
|
||||
date: "2018-04-19 16:07:00 +0100"
|
||||
author: oe
|
||||
categories: [community]
|
||||
---
|
||||
|
||||
With the release of Jekyll 3.8.0, it's been 2 and a half years since the last major release. Jekyll 3.0.0 was released in late October of 2015! That's a long time ago, and we've been working towards the next major release of Jekyll for a couple of months now. Here's a small preview of what's to come:
|
||||
|
||||
- Dropping support for Ruby 2.1 and 2.2. Both versions have reached their EOL period.
|
||||
- Dropping Pygments as a dependency. We're already defaulting to Rouge, and this removes the implicit Python dependency. (finally!)
|
||||
- Making the `link` tag use relative URLs. This is a big breaking change, but it's the cleaner solution.
|
||||
|
||||
We're open to more ideas, though. If the development cost isn't too high, or if someone volunteers to take care of the implementation, it's likely that your suggestion might make it into Jekyll 4.0. Head over to this [issue] for more details. Some interesting topics might be improving Internationalization support in Jekyll, creating convenience Liquid tags, et cetera.
|
||||
|
||||
That being said, the development period of version 4.0 begins _now_. This means a couple of things:
|
||||
|
||||
- New features will only be implemented in Jekyll 4.0. There will be no 3.9.0 or the like.
|
||||
- Same with bug fixes, unless they concern something introduced in Jekyll 3.7 or 3.8, in which case we will backport the fixes and release a patch version.
|
||||
- Now is a great time to finally take on the feature you've wanted to see in Jekyll for ages! Just open an issue or experiment with the code to get going!
|
||||
|
||||
As for a release date, we're currently aiming for late summer, around September or so. However, keep in mind that this project is purely volunteer-run, and as such, delays might occur and we might not hit that release date.
|
||||
|
||||
Finally, this is a great time for newcomers to open-source to make their first contribution. We'll be doing our best to mark recommended contributions and create newcomer-friendly issues, as well as to provide mentoring throughout the contribution process (although we'd like to think that we're already pretty proficient at that). So if you've always been hestitant about contributing to a large open-source project, Jekyll is a good place to start!
|
||||
|
||||
Happy Jekylling! :wave:
|
||||
|
||||
[issue]: https://github.com/jekyll/jekyll/issues/6948
|
||||
43
docs/_posts/2018-03-15-jekyll-3-8-0-released.markdown
Normal file
43
docs/_posts/2018-03-15-jekyll-3-8-0-released.markdown
Normal file
@@ -0,0 +1,43 @@
|
||||
---
|
||||
title: 'Jekyll 3.8.0 Released'
|
||||
date: 2018-04-19 19:45:15 +0530
|
||||
author: ashmaroli
|
||||
version: 3.8.0
|
||||
categories: [release]
|
||||
---
|
||||
|
||||
Aloha Jekyllers!! :wave:
|
||||
|
||||
After months of toiling on the codebase and shipping a couple of release-candidates, the Jekyll Team is delighted to finally
|
||||
present `v3.8.0`, packed with optimizations, improvements, some new features and a couple of bug-fixes. Yay!!!
|
||||
|
||||
Under the hood, Jekyll has undergone many minor changes that will allow it to run more performantly in the coming years. :smiley:
|
||||
Rest assured, our users should see minor improvements in their site's build times.
|
||||
|
||||
Speaking of improvements, users running a site containing a huge amount of posts or those who like to use our `where` filter
|
||||
frequently in a single template, are going to see a massive reduction in their total build times!! :tada:
|
||||
|
||||
Hold on, this version is not just about optimizations, there are some new features as well..:
|
||||
* Detect non-existent variables and filters specified in a template by enabling `strict_variables` and `strict_filters` under the
|
||||
`liquid` key in your config file.
|
||||
* Allow *date filters* to output ordinal days.
|
||||
* `jekyll doctor` now warns you if you have opted for custom `collections_dir` but placed `_posts` directory outside that
|
||||
directory.
|
||||
|
||||
..and yes, a couple of bug-fixes, notably:
|
||||
* Jekyll now handles future-dated documents properly.
|
||||
* Jekyll is able to handle Liquid blocks intelligently in excerpts.
|
||||
* A few methods that were *not meant to be publically accessible* have been entombed properly.
|
||||
* A few bugs that still plagued our `collections_dir` feature from `v3.7` got crushed.
|
||||
|
||||
As always, the full list of changes since last release can be viewed [here](/docs/history/#v3-8-0).
|
||||
|
||||
A big thanks to the following people who contributed to our repository with pull-requests that improved our codebase, documentation
|
||||
and tests:
|
||||
|
||||
Ana María Martínez Gómez, Antonio Argote, Ashwin Maroli, Awjin Ahn, Ben Balter, Benjamin Høegh, Christian Oliff, Damien Solodow,
|
||||
David Zhang, Delson Lima, Eric Cornelissen, Florian Thomas, Frank Taillandier, Heinrich Hartmann, Jakob Vad Nielsen, John Eismeier,
|
||||
Kacper Duras, KajMagnus, Mario Cekic, Max Vilimpoc, Michael H, Mike Kasberg, Parker Moore, Pat Hawks, Paweł Kuna, Robert Riemann,
|
||||
Roger Rohrbach, Semen Zhydenko, Stefan Dellmuth, Tim Carry, olivia, and steelman.
|
||||
|
||||
Happy Jekylling!! :sparkles:
|
||||
@@ -53,7 +53,7 @@ More info on configuring Apache Error Pages can found in [official documentation
|
||||
|
||||
The procedure is just as simple as configuring Apache servers, but slightly different.
|
||||
|
||||
Add the following to the nginx configuration file, `nginx.conf`, which is usually located inside `/etc/nginx/` or `/etc/nginx/conf/`:
|
||||
The nginx configuration file depends on the system in which it is installed. In most systems, it is the `nginx.conf` file, which is usually located inside `/etc/nginx/` or `/etc/nginx/conf/`. However, in other systems like Ubuntu, you would have to look for a `default` nginx configuration file, containing server related information, which is usually located inside `/etc/nginx/sites-available/` or `/etc/nginx/sites-enabled/`. Add the following to your nginx configuration file, _i.e._ either to `nginx.conf` file or to `default` file:
|
||||
|
||||
```nginx
|
||||
server {
|
||||
@@ -63,5 +63,11 @@ server {
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
If the `server` block already exists, only add the code inside the `server` block given above.
|
||||
The `location` directive prevents users from directly browsing the 404.html page.
|
||||
|
||||
More info on nginx error page can be found on [nginx official documentation](http://nginx.org/en/docs/http/ngx_http_core_module.html#error_page).
|
||||
|
||||
<p class="note warning">
|
||||
Proceed with caution while editing the configuration file.
|
||||
</p>
|
||||
|
||||
@@ -90,7 +90,7 @@ If you're storing your new site in version control, you'll want to ignore the
|
||||
`./vendor/` and `./.bundle/` folders since they contain user- or
|
||||
platform-specific information. New users will be able to install the correct
|
||||
dependencies based on `Gemfile` and `Gemfile.lock`, which should both be checked
|
||||
in. You can use this `.gitigonre` to get started, if you want.
|
||||
in. You can use this `.gitignore` to get started, if you want.
|
||||
|
||||
**.gitignore**
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ overview: true
|
||||
</div>
|
||||
<div class="unit one-third">
|
||||
<h2>Static</h2>
|
||||
<p><a href="https://daringfireball.net/projects/markdown/">Markdown</a> (or <a href="http://redcloth.org/textile">Textile</a>), <a href="https://github.com/Shopify/liquid/wiki">Liquid</a>, HTML <span class="amp">&</span> CSS go in. Static sites come out ready for deployment.</p>
|
||||
<p><a href="https://daringfireball.net/projects/markdown/">Markdown</a>, <a href="https://github.com/Shopify/liquid/wiki">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">
|
||||
@@ -45,7 +45,7 @@ overview: true
|
||||
<p class="line">
|
||||
<span class="path">~</span>
|
||||
<span class="prompt">$</span>
|
||||
<span class="command">gem install jekyll bundler</span>
|
||||
<span class="command">gem install bundler jekyll</span>
|
||||
</p>
|
||||
<p class="line">
|
||||
<span class="path">~</span>
|
||||
|
||||
@@ -82,10 +82,10 @@ Feature: Create sites
|
||||
When I run jekyll build
|
||||
Then I should get a zero exit status
|
||||
And the _site directory should exist
|
||||
And I should see "Page : Site contains 2 pages and 4 posts" in "_site/index.html"
|
||||
And I should see "Page Index: Site contains 2 pages and 4 posts" in "_site/index.html"
|
||||
And I should see "No replacement \{\{ site.posts.size \}\}" in "_site/about.html"
|
||||
And I should see "" in "_site/another_file"
|
||||
And I should see "Page : blog category index page" in "_site/blog/index.html"
|
||||
And I should see "Page Index: blog category index page" in "_site/blog/index.html"
|
||||
And I should see "Post entry1: <p>content for entry1.</p>" in "_site/2009/03/27/entry1.html"
|
||||
And I should see "Post entry2: <p>content for entry2.</p>" in "_site/2009/04/27/entry2.html"
|
||||
And I should see "Post entry3: <p>content for entry3.</p>" in "_site/category/2009/05/27/entry3.html"
|
||||
@@ -200,6 +200,6 @@ Feature: Create sites
|
||||
When I run jekyll build
|
||||
Then I should get a zero exit status
|
||||
And the _site directory should exist
|
||||
And I should see "Page : Site contains 1 pages and 2 posts; Related posts: 0" in "_site/index.html"
|
||||
And I should see "Page Index: Site contains 1 pages and 2 posts; Related posts: 0" in "_site/index.html"
|
||||
And I should see "Post entry1: <p>content for entry1.</p>\nRelated posts: 1" in "_site/2009/03/27/entry1.html"
|
||||
And I should see "Post entry2: <p>content for entry2.</p>\nRelated posts: 1" in "_site/2009/04/27/entry2.html"
|
||||
|
||||
@@ -106,4 +106,4 @@ Feature: Embed filters
|
||||
When I run jekyll build
|
||||
Then I should get a zero exit status
|
||||
And the _site directory should exist
|
||||
And I should see exactly "The rule of 3: Fly, Run, Jump," in "_site/bird.html"
|
||||
And I should see exactly "The rule of 3: Jump, Fly, Run," in "_site/bird.html"
|
||||
|
||||
@@ -7,20 +7,9 @@ Feature: Hooks
|
||||
And I have a "_plugins/ext.rb" file with content:
|
||||
"""
|
||||
Jekyll::Hooks.register :site, :after_reset do |site|
|
||||
pageklass = Class.new(Jekyll::Page) do
|
||||
def initialize(site, base)
|
||||
@site = site
|
||||
@base = base
|
||||
@data = {}
|
||||
@dir = '/'
|
||||
@name = 'foo.html'
|
||||
@content = 'mytinypage'
|
||||
|
||||
self.process(@name)
|
||||
end
|
||||
end
|
||||
|
||||
site.pages << pageklass.new(site, site.source)
|
||||
page = Jekyll::Page.new(site, site.source, "/", "foo.html")
|
||||
page.content = "mytinypage"
|
||||
site.pages.docs << page
|
||||
end
|
||||
"""
|
||||
When I run jekyll build
|
||||
@@ -79,7 +68,7 @@ Feature: Hooks
|
||||
And I have a "_plugins/ext.rb" file with content:
|
||||
"""
|
||||
Jekyll::Hooks.register :pages, :post_init do |page|
|
||||
page.name = 'renamed.html'
|
||||
page.instance_variable_set "@relative_path", '/renamed.html'
|
||||
page.process(page.name)
|
||||
end
|
||||
"""
|
||||
@@ -256,6 +245,7 @@ Feature: Hooks
|
||||
And I have a "_plugins/ext.rb" file with content:
|
||||
"""
|
||||
Jekyll::Hooks.register :documents, :pre_render do |doc, payload|
|
||||
doc.data['text'] ||= ''
|
||||
doc.data['text'] = doc.data['text'] << ' are belong to us'
|
||||
end
|
||||
"""
|
||||
|
||||
@@ -65,14 +65,6 @@ Feature: Site configuration
|
||||
And the "_site/Rakefile" file should not exist
|
||||
And the "_site/README" file should not exist
|
||||
|
||||
Scenario: Use RDiscount for markup
|
||||
Given I have an "index.markdown" page that contains "[Google](https://www.google.com)"
|
||||
And I have a configuration file with "markdown" set to "rdiscount"
|
||||
When I run jekyll build
|
||||
Then I should get a zero exit status
|
||||
And the _site directory should exist
|
||||
And I should see "<a href=\"https://www.google.com\">Google</a>" in "_site/index.html"
|
||||
|
||||
Scenario: Use Kramdown for markup
|
||||
Given I have an "index.markdown" page that contains "[Google](https://www.google.com)"
|
||||
And I have a configuration file with "markdown" set to "kramdown"
|
||||
@@ -81,14 +73,6 @@ Feature: Site configuration
|
||||
And the _site directory should exist
|
||||
And I should see "<a href=\"https://www.google.com\">Google</a>" in "_site/index.html"
|
||||
|
||||
Scenario: Use Redcarpet for markup
|
||||
Given I have an "index.markdown" page that contains "[Google](https://www.google.com)"
|
||||
And I have a configuration file with "markdown" set to "redcarpet"
|
||||
When I run jekyll build
|
||||
Then I should get a zero exit status
|
||||
And the _site directory should exist
|
||||
And I should see "<a href=\"https://www.google.com\">Google</a>" in "_site/index.html"
|
||||
|
||||
Scenario: Highlight code with pygments
|
||||
Given I have an "index.html" page that contains "{% highlight ruby %} puts 'Hello world!' {% endhighlight %}"
|
||||
When I run jekyll build
|
||||
|
||||
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
|
||||
s.specification_version = 2 if s.respond_to? :specification_version=
|
||||
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
||||
s.rubygems_version = "2.2.2"
|
||||
s.required_ruby_version = ">= 2.1.0"
|
||||
s.required_ruby_version = ">= 2.3.0"
|
||||
|
||||
s.name = "jekyll"
|
||||
s.version = Jekyll::VERSION
|
||||
@@ -33,14 +33,13 @@ Gem::Specification.new do |s|
|
||||
s.add_runtime_dependency("addressable", "~> 2.4")
|
||||
s.add_runtime_dependency("colorator", "~> 1.0")
|
||||
s.add_runtime_dependency("em-websocket", "~> 0.5")
|
||||
s.add_runtime_dependency("i18n", "~> 0.7")
|
||||
s.add_runtime_dependency("i18n", ">= 0.9.5", "< 2")
|
||||
s.add_runtime_dependency("jekyll-sass-converter", "~> 1.0")
|
||||
s.add_runtime_dependency("jekyll-watch", "~> 2.0")
|
||||
s.add_runtime_dependency("kramdown", "~> 1.14")
|
||||
s.add_runtime_dependency("liquid", "~> 4.0")
|
||||
s.add_runtime_dependency("mercenary", "~> 0.3.3")
|
||||
s.add_runtime_dependency("pathutil", "~> 0.9")
|
||||
rouge_versions = ENV["ROUGE_VERSION"] ? ["~> #{ENV["ROUGE_VERSION"]}"] : [">= 1.7", "< 4"]
|
||||
s.add_runtime_dependency("rouge", *rouge_versions)
|
||||
s.add_runtime_dependency("rouge", "~> 3.0")
|
||||
s.add_runtime_dependency("safe_yaml", "~> 1.0")
|
||||
end
|
||||
|
||||
@@ -35,7 +35,7 @@ module Jekyll
|
||||
def method_missing(method, *args, &blck)
|
||||
if docs.respond_to?(method.to_sym)
|
||||
Jekyll.logger.warn "Deprecation:",
|
||||
"#{label}.#{method} should be changed to #{label}.docs.#{method}."
|
||||
"#{label}.#{method} should be changed to #{label}.docs.#{method}."
|
||||
Jekyll.logger.warn "", "Called by #{caller(0..0)}."
|
||||
docs.public_send(method.to_sym, *args, &blck)
|
||||
else
|
||||
@@ -207,18 +207,12 @@ module Jekyll
|
||||
@container ||= site.config["collections_dir"]
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def read_document(full_path)
|
||||
doc = Document.new(full_path, :site => site, :collection => self)
|
||||
doc.read
|
||||
if site.unpublished || doc.published?
|
||||
docs << doc
|
||||
end
|
||||
docs << doc if site.unpublished || doc.published?
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def read_static_file(file_path, full_path)
|
||||
relative_dir = Jekyll.sanitized_path(
|
||||
relative_directory,
|
||||
|
||||
@@ -51,28 +51,52 @@ module Jekyll
|
||||
# rubocop:disable Metrics/MethodLength
|
||||
def add_build_options(cmd)
|
||||
cmd.option "config", "--config CONFIG_FILE[,CONFIG_FILE2,...]",
|
||||
Array, "Custom configuration file"
|
||||
Array, "Custom configuration file"
|
||||
cmd.option "destination", "-d", "--destination DESTINATION",
|
||||
"The current folder will be generated into DESTINATION"
|
||||
"The current folder will be generated into DESTINATION"
|
||||
cmd.option "source", "-s", "--source SOURCE", "Custom source directory"
|
||||
cmd.option "future", "--future", "Publishes posts with a future date"
|
||||
cmd.option "limit_posts", "--limit_posts MAX_POSTS", Integer,
|
||||
"Limits the number of posts to parse and publish"
|
||||
"Limits the number of posts to parse and publish"
|
||||
cmd.option "watch", "-w", "--[no-]watch", "Watch for changes and rebuild"
|
||||
cmd.option "baseurl", "-b", "--baseurl URL",
|
||||
"Serve the website from the given base URL"
|
||||
"Serve the website from the given base URL"
|
||||
cmd.option "force_polling", "--force_polling", "Force watch to use polling"
|
||||
cmd.option "lsi", "--lsi", "Use LSI for improved related posts"
|
||||
cmd.option "show_drafts", "-D", "--drafts", "Render posts in the _drafts folder"
|
||||
cmd.option "unpublished", "--unpublished",
|
||||
"Render posts that were marked as unpublished"
|
||||
"Render posts that were marked as unpublished"
|
||||
cmd.option "quiet", "-q", "--quiet", "Silence output."
|
||||
cmd.option "verbose", "-V", "--verbose", "Print verbose output."
|
||||
cmd.option "incremental", "-I", "--incremental", "Enable incremental rebuild."
|
||||
cmd.option "strict_front_matter", "--strict_front_matter",
|
||||
"Fail if errors are present in front matter"
|
||||
"Fail if errors are present in front matter"
|
||||
end
|
||||
# rubocop:enable Metrics/MethodLength
|
||||
|
||||
# Run ::process method in a given set of Jekyll::Command subclasses and suggest
|
||||
# re-running the associated command with --trace switch to obtain any additional
|
||||
# information or backtrace regarding the encountered Exception.
|
||||
#
|
||||
# cmd - the Jekyll::Command to be handled
|
||||
# options - configuration overrides
|
||||
# klass - an array of Jekyll::Command subclasses associated with the command
|
||||
#
|
||||
# Note that all exceptions are rescued..
|
||||
# rubocop: disable RescueException
|
||||
def process_with_graceful_fail(cmd, options, *klass)
|
||||
klass.each { |k| k.process(options) if k.respond_to?(:process) }
|
||||
rescue Exception => e
|
||||
raise e if cmd.trace
|
||||
|
||||
msg = " Please append `--trace` to the `#{cmd.name}` command "
|
||||
dashes = "-" * msg.length
|
||||
Jekyll.logger.error "", dashes
|
||||
Jekyll.logger.error "Jekyll #{Jekyll::VERSION} ", msg
|
||||
Jekyll.logger.error "", " for any additional information or backtrace. "
|
||||
Jekyll.logger.abort_with "", dashes
|
||||
end
|
||||
# rubocop: enable RescueException
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -15,7 +15,7 @@ module Jekyll
|
||||
|
||||
c.action do |_, options|
|
||||
options["serving"] = false
|
||||
Jekyll::Commands::Build.process(options)
|
||||
process_with_graceful_fail(c, options, self)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -31,14 +31,14 @@ module Jekyll
|
||||
|
||||
if options.fetch("skip_initial_build", false)
|
||||
Jekyll.logger.warn "Build Warning:", "Skipping the initial build." \
|
||||
" This may result in an out-of-date site."
|
||||
" This may result in an out-of-date site."
|
||||
else
|
||||
build(site, options)
|
||||
end
|
||||
|
||||
if options.fetch("detach", false)
|
||||
Jekyll.logger.info "Auto-regeneration:",
|
||||
"disabled when running server detached."
|
||||
"disabled when running server detached."
|
||||
elsif options.fetch("watch", false)
|
||||
watch(site, options)
|
||||
else
|
||||
@@ -60,7 +60,7 @@ module Jekyll
|
||||
Jekyll.logger.info "Source:", source
|
||||
Jekyll.logger.info "Destination:", destination
|
||||
Jekyll.logger.info "Incremental build:",
|
||||
(incremental ? "enabled" : "disabled. Enable with --incremental")
|
||||
(incremental ? "enabled" : "disabled. Enable with --incremental")
|
||||
Jekyll.logger.info "Generating..."
|
||||
process_site(site)
|
||||
Jekyll.logger.info "", "done in #{(Time.now - t).round(3)} seconds."
|
||||
@@ -76,12 +76,12 @@ module Jekyll
|
||||
# Warn Windows users that they might need to upgrade.
|
||||
if Utils::Platforms.bash_on_windows?
|
||||
Jekyll.logger.warn "",
|
||||
"Auto-regeneration may not work on some Windows versions."
|
||||
"Auto-regeneration may not work on some Windows versions."
|
||||
Jekyll.logger.warn "",
|
||||
"Please see: https://github.com/Microsoft/BashOnWindows/issues/216"
|
||||
"Please see: https://github.com/Microsoft/BashOnWindows/issues/216"
|
||||
Jekyll.logger.warn "",
|
||||
"If it does not work, please upgrade Bash on Windows or "\
|
||||
"run Jekyll with --no-watch."
|
||||
"If it does not work, please upgrade Bash on Windows or "\
|
||||
"run Jekyll with --no-watch."
|
||||
end
|
||||
|
||||
External.require_with_graceful_fail "jekyll-watch"
|
||||
|
||||
@@ -11,7 +11,7 @@ module Jekyll
|
||||
c.alias(:hyde)
|
||||
|
||||
c.option "config", "--config CONFIG_FILE[,CONFIG_FILE2,...]", Array,
|
||||
"Custom configuration file"
|
||||
"Custom configuration file"
|
||||
|
||||
c.action do |_, options|
|
||||
Jekyll::Commands::Doctor.process(options)
|
||||
@@ -48,26 +48,25 @@ module Jekyll
|
||||
posts_at_root = site.in_source_dir("_posts")
|
||||
return true unless File.directory?(posts_at_root)
|
||||
Jekyll.logger.warn "Warning:",
|
||||
"Detected '_posts' directory outside custom `collections_dir`!"
|
||||
"Detected '_posts' directory outside custom `collections_dir`!"
|
||||
Jekyll.logger.warn "",
|
||||
"Please move '#{posts_at_root}' into the custom directory at " \
|
||||
"Please move '#{posts_at_root}' into the custom directory at " \
|
||||
"'#{site.in_source_dir(site.config["collections_dir"])}'"
|
||||
false
|
||||
end
|
||||
|
||||
def deprecated_relative_permalinks(site)
|
||||
if site.config["relative_permalinks"]
|
||||
Jekyll::Deprecator.deprecation_message "Your site still uses relative" \
|
||||
" permalinks, which was removed in" \
|
||||
" Jekyll v3.0.0."
|
||||
return true
|
||||
Jekyll::Deprecator.deprecation_message "Your site still uses relative permalinks," \
|
||||
" which was removed in Jekyll v3.0.0."
|
||||
true
|
||||
end
|
||||
end
|
||||
|
||||
def conflicting_urls(site)
|
||||
conflicting_urls = false
|
||||
urls = {}
|
||||
urls = collect_urls(urls, site.pages, site.dest)
|
||||
urls = collect_urls(urls, site.pages.docs, site.dest)
|
||||
urls = collect_urls(urls, site.posts.docs, site.dest)
|
||||
urls.each do |url, paths|
|
||||
next unless paths.size > 1
|
||||
@@ -96,7 +95,7 @@ module Jekyll
|
||||
|
||||
def urls_only_differ_by_case(site)
|
||||
urls_only_differ_by_case = false
|
||||
urls = case_insensitive_urls(site.pages + site.docs_to_write, site.dest)
|
||||
urls = case_insensitive_urls(site.docs_to_write, site.dest)
|
||||
urls.each_value do |real_urls|
|
||||
next unless real_urls.uniq.size > 1
|
||||
urls_only_differ_by_case = true
|
||||
@@ -117,6 +116,7 @@ module Jekyll
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def collect_urls(urls, things, destination)
|
||||
things.each do |thing|
|
||||
dest = thing.destination(destination)
|
||||
|
||||
@@ -25,7 +25,7 @@ module Jekyll
|
||||
|
||||
def invalid_command(prog, cmd)
|
||||
Jekyll.logger.error "Error:",
|
||||
"Hmm... we don't know what the '#{cmd}' command is."
|
||||
"Hmm... we don't know what the '#{cmd}' command is."
|
||||
Jekyll.logger.info "Valid commands:", prog.commands.keys.join(", ")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -62,38 +62,32 @@ module Jekyll
|
||||
private
|
||||
|
||||
def gemfile_contents
|
||||
<<-RUBY
|
||||
source "https://rubygems.org"
|
||||
<<~RUBY
|
||||
source "https://rubygems.org"
|
||||
# Hello! This is where you manage which Jekyll version is used to run.
|
||||
# When you want to use a different version, change it below, save the
|
||||
# file and run `bundle install`. Run Jekyll with `bundle exec`, like so:
|
||||
#
|
||||
# bundle exec jekyll serve
|
||||
#
|
||||
# This will help ensure the proper Jekyll version is running.
|
||||
# Happy Jekylling!
|
||||
gem "jekyll", "~> #{Jekyll::VERSION}"
|
||||
# This is the default theme for new Jekyll sites. You may change this to anything you like.
|
||||
gem "minima", "~> 2.0"
|
||||
# If you want to use GitHub Pages, remove the "gem "jekyll"" above and
|
||||
# uncomment the line below. To upgrade, run `bundle update github-pages`.
|
||||
# gem "github-pages", group: :jekyll_plugins
|
||||
# If you have any plugins, put them here!
|
||||
group :jekyll_plugins do
|
||||
gem "jekyll-feed", "~> 0.6"
|
||||
end
|
||||
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
|
||||
gem "tzinfo-data", platforms: [:mingw, :mswin, :x64_mingw, :jruby]
|
||||
# Performance-booster for watching directories on Windows
|
||||
gem "wdm", "~> 0.1.0" if Gem.win_platform?
|
||||
|
||||
# Hello! This is where you manage which Jekyll version is used to run.
|
||||
# When you want to use a different version, change it below, save the
|
||||
# file and run `bundle install`. Run Jekyll with `bundle exec`, like so:
|
||||
#
|
||||
# bundle exec jekyll serve
|
||||
#
|
||||
# This will help ensure the proper Jekyll version is running.
|
||||
# Happy Jekylling!
|
||||
gem "jekyll", "~> #{Jekyll::VERSION}"
|
||||
|
||||
# This is the default theme for new Jekyll sites. You may change this to anything you like.
|
||||
gem "minima", "~> 2.0"
|
||||
|
||||
# If you want to use GitHub Pages, remove the "gem "jekyll"" above and
|
||||
# uncomment the line below. To upgrade, run `bundle update github-pages`.
|
||||
# gem "github-pages", group: :jekyll_plugins
|
||||
|
||||
# If you have any plugins, put them here!
|
||||
group :jekyll_plugins do
|
||||
gem "jekyll-feed", "~> 0.6"
|
||||
end
|
||||
|
||||
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
|
||||
gem "tzinfo-data", platforms: [:mingw, :mswin, :x64_mingw, :jruby]
|
||||
|
||||
# Performance-booster for watching directories on Windows
|
||||
gem "wdm", "~> 0.1.0" if Gem.win_platform?
|
||||
|
||||
RUBY
|
||||
RUBY
|
||||
end
|
||||
|
||||
def create_site(new_blog_path)
|
||||
|
||||
@@ -2,39 +2,41 @@
|
||||
|
||||
require "erb"
|
||||
|
||||
class Jekyll::Commands::NewTheme < Jekyll::Command
|
||||
class << self
|
||||
def init_with_program(prog)
|
||||
prog.command(:"new-theme") do |c|
|
||||
c.syntax "new-theme NAME"
|
||||
c.description "Creates a new Jekyll theme scaffold"
|
||||
c.option "code_of_conduct", \
|
||||
"-c", "--code-of-conduct", \
|
||||
"Include a Code of Conduct. (defaults to false)"
|
||||
module Jekyll
|
||||
module Commands
|
||||
class NewTheme < Jekyll::Command
|
||||
class << self
|
||||
def init_with_program(prog)
|
||||
prog.command(:"new-theme") do |c|
|
||||
c.syntax "new-theme NAME"
|
||||
c.description "Creates a new Jekyll theme scaffold"
|
||||
c.option "code_of_conduct", \
|
||||
"-c", "--code-of-conduct", \
|
||||
"Include a Code of Conduct. (defaults to false)"
|
||||
|
||||
c.action do |args, opts|
|
||||
Jekyll::Commands::NewTheme.process(args, opts)
|
||||
c.action do |args, opts|
|
||||
Jekyll::Commands::NewTheme.process(args, opts)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# rubocop:disable Metrics/AbcSize
|
||||
def process(args, opts)
|
||||
if !args || args.empty?
|
||||
raise Jekyll::Errors::InvalidThemeName, "You must specify a theme name."
|
||||
end
|
||||
|
||||
new_theme_name = args.join("_")
|
||||
theme = Jekyll::ThemeBuilder.new(new_theme_name, opts)
|
||||
Jekyll.logger.abort_with "Conflict:", "#{theme.path} already exists." if theme.path.exist?
|
||||
|
||||
theme.create!
|
||||
Jekyll.logger.info "Your new Jekyll theme, #{theme.name.cyan}," \
|
||||
" is ready for you in #{theme.path.to_s.cyan}!"
|
||||
Jekyll.logger.info "For help getting started, read #{theme.path}/README.md."
|
||||
end
|
||||
# rubocop:enable Metrics/AbcSize
|
||||
end
|
||||
end
|
||||
|
||||
# rubocop:disable Metrics/AbcSize
|
||||
def process(args, opts)
|
||||
if !args || args.empty?
|
||||
raise Jekyll::Errors::InvalidThemeName, "You must specify a theme name."
|
||||
end
|
||||
|
||||
new_theme_name = args.join("_")
|
||||
theme = Jekyll::ThemeBuilder.new(new_theme_name, opts)
|
||||
if theme.path.exist?
|
||||
Jekyll.logger.abort_with "Conflict:", "#{theme.path} already exists."
|
||||
end
|
||||
|
||||
theme.create!
|
||||
Jekyll.logger.info "Your new Jekyll theme, #{theme.name.cyan}," \
|
||||
" is ready for you in #{theme.path.to_s.cyan}!"
|
||||
Jekyll.logger.info "For help getting started, read #{theme.path}/README.md."
|
||||
end
|
||||
# rubocop:enable Metrics/AbcSize
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "thread"
|
||||
|
||||
module Jekyll
|
||||
module Commands
|
||||
class Serve < Command
|
||||
@@ -19,25 +17,28 @@ module Jekyll
|
||||
"host" => ["host", "-H", "--host [HOST]", "Host to bind to"],
|
||||
"open_url" => ["-o", "--open-url", "Launch your site in a browser"],
|
||||
"detach" => ["-B", "--detach",
|
||||
"Run the server in the background",],
|
||||
"Run the server in the background",],
|
||||
"ssl_key" => ["--ssl-key [KEY]", "X.509 (SSL) Private Key."],
|
||||
"port" => ["-P", "--port [PORT]", "Port to listen on"],
|
||||
"show_dir_listing" => ["--show-dir-listing",
|
||||
"Show a directory listing instead of loading your index file.",],
|
||||
"Show a directory listing instead of loading" \
|
||||
" your index file.",],
|
||||
"skip_initial_build" => ["skip_initial_build", "--skip-initial-build",
|
||||
"Skips the initial site build which occurs before the server is started.",],
|
||||
"Skips the initial site build which occurs before" \
|
||||
" the server is started.",],
|
||||
"livereload" => ["-l", "--livereload",
|
||||
"Use LiveReload to automatically refresh browsers",],
|
||||
"Use LiveReload to automatically refresh browsers",],
|
||||
"livereload_ignore" => ["--livereload-ignore ignore GLOB1[,GLOB2[,...]]",
|
||||
Array,
|
||||
"Files for LiveReload to ignore. Remember to quote the values so your shell "\
|
||||
"won't expand them",],
|
||||
Array,
|
||||
"Files for LiveReload to ignore. " \
|
||||
"Remember to quote the values so your shell " \
|
||||
"won't expand them",],
|
||||
"livereload_min_delay" => ["--livereload-min-delay [SECONDS]",
|
||||
"Minimum reload delay",],
|
||||
"Minimum reload delay",],
|
||||
"livereload_max_delay" => ["--livereload-max-delay [SECONDS]",
|
||||
"Maximum reload delay",],
|
||||
"Maximum reload delay",],
|
||||
"livereload_port" => ["--livereload-port [PORT]", Integer,
|
||||
"Port for LiveReload to listen on",],
|
||||
"Port for LiveReload to listen on",],
|
||||
}.freeze
|
||||
|
||||
DIRECTORY_INDEX = %w(
|
||||
@@ -72,29 +73,21 @@ module Jekyll
|
||||
opts["serving"] = true
|
||||
opts["watch"] = true unless opts.key?("watch")
|
||||
|
||||
start(opts)
|
||||
# Set the reactor to nil so any old reactor will be GCed.
|
||||
# We can't unregister a hook so while running tests we don't want to
|
||||
# inadvertently keep using a reactor created by a previous test.
|
||||
@reload_reactor = nil
|
||||
|
||||
config = configuration_from_options(opts)
|
||||
config["url"] = default_url(config) if Jekyll.env == "development"
|
||||
|
||||
process_with_graceful_fail(cmd, config, Build, Serve)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#
|
||||
|
||||
def start(opts)
|
||||
# Set the reactor to nil so any old reactor will be GCed.
|
||||
# We can't unregister a hook so in testing when Serve.start is
|
||||
# called multiple times we don't want to inadvertently keep using
|
||||
# a reactor created by a previous test when our test might not
|
||||
@reload_reactor = nil
|
||||
|
||||
config = configuration_from_options(opts)
|
||||
if Jekyll.env == "development"
|
||||
config["url"] = default_url(config)
|
||||
end
|
||||
[Build, Serve].each { |klass| klass.process(config) }
|
||||
end
|
||||
|
||||
#
|
||||
|
||||
def process(opts)
|
||||
opts = configuration_from_options(opts)
|
||||
destination = opts["destination"]
|
||||
@@ -111,11 +104,12 @@ module Jekyll
|
||||
# Perform logical validation of CLI options
|
||||
|
||||
private
|
||||
|
||||
def validate_options(opts)
|
||||
if opts["livereload"]
|
||||
if opts["detach"]
|
||||
Jekyll.logger.warn "Warning:",
|
||||
"--detach and --livereload are mutually exclusive. Choosing --livereload"
|
||||
Jekyll.logger.warn "Warning:", "--detach and --livereload are mutually exclusive." \
|
||||
" Choosing --livereload"
|
||||
opts["detach"] = false
|
||||
end
|
||||
if opts["ssl_cert"] || opts["ssl_key"]
|
||||
@@ -130,18 +124,15 @@ module Jekyll
|
||||
opts["watch"] = true
|
||||
end
|
||||
elsif %w(livereload_min_delay
|
||||
livereload_max_delay
|
||||
livereload_ignore
|
||||
livereload_port).any? { |o| opts[o] }
|
||||
livereload_max_delay
|
||||
livereload_ignore
|
||||
livereload_port).any? { |o| opts[o] }
|
||||
Jekyll.logger.abort_with "--livereload-min-delay, "\
|
||||
"--livereload-max-delay, --livereload-ignore, and "\
|
||||
"--livereload-port require the --livereload option."
|
||||
end
|
||||
end
|
||||
|
||||
#
|
||||
|
||||
private
|
||||
# rubocop:disable Metrics/AbcSize
|
||||
def register_reload_hooks(opts)
|
||||
require_relative "serve/live_reload_reactor"
|
||||
@@ -179,7 +170,6 @@ module Jekyll
|
||||
# when we get ready to party, checking for an setting up an error page
|
||||
# and making sure our destination exists.
|
||||
|
||||
private
|
||||
def setup(destination)
|
||||
require_relative "serve/servlet"
|
||||
|
||||
@@ -194,9 +184,6 @@ module Jekyll
|
||||
end
|
||||
end
|
||||
|
||||
#
|
||||
|
||||
private
|
||||
def webrick_opts(opts)
|
||||
opts = {
|
||||
:JekyllOptions => opts,
|
||||
@@ -217,13 +204,8 @@ module Jekyll
|
||||
opts
|
||||
end
|
||||
|
||||
#
|
||||
|
||||
private
|
||||
def start_up_webrick(opts, destination)
|
||||
if opts["livereload"]
|
||||
@reload_reactor.start(opts)
|
||||
end
|
||||
@reload_reactor.start(opts) if opts["livereload"]
|
||||
|
||||
@server = WEBrick::HTTPServer.new(webrick_opts(opts)).tap { |o| o.unmount("") }
|
||||
@server.mount(opts["baseurl"].to_s, Servlet, destination, file_handler_opts)
|
||||
@@ -234,20 +216,15 @@ module Jekyll
|
||||
end
|
||||
|
||||
# Recreate NondisclosureName under utf-8 circumstance
|
||||
|
||||
private
|
||||
def file_handler_opts
|
||||
WEBrick::Config::FileHandler.merge({
|
||||
WEBrick::Config::FileHandler.merge(
|
||||
:FancyIndexing => true,
|
||||
:NondisclosureName => [
|
||||
".ht*", "~*",
|
||||
],
|
||||
})
|
||||
]
|
||||
)
|
||||
end
|
||||
|
||||
#
|
||||
|
||||
private
|
||||
def server_address(server, options = {})
|
||||
format_url(
|
||||
server.config[:SSLEnable],
|
||||
@@ -257,19 +234,14 @@ module Jekyll
|
||||
)
|
||||
end
|
||||
|
||||
private
|
||||
def format_url(ssl_enabled, address, port, baseurl = nil)
|
||||
format("%<prefix>s://%<address>s:%<port>i%<baseurl>s", {
|
||||
:prefix => ssl_enabled ? "https" : "http",
|
||||
:address => address,
|
||||
:port => port,
|
||||
:baseurl => baseurl ? "#{baseurl}/" : "",
|
||||
})
|
||||
format("%<prefix>s://%<address>s:%<port>i%<baseurl>s",
|
||||
:prefix => ssl_enabled ? "https" : "http",
|
||||
:address => address,
|
||||
:port => port,
|
||||
:baseurl => baseurl ? "#{baseurl}/" : "")
|
||||
end
|
||||
|
||||
#
|
||||
|
||||
private
|
||||
def default_url(opts)
|
||||
config = configuration_from_options(opts)
|
||||
format_url(
|
||||
@@ -279,9 +251,6 @@ module Jekyll
|
||||
)
|
||||
end
|
||||
|
||||
#
|
||||
|
||||
private
|
||||
def launch_browser(server, opts)
|
||||
address = server_address(server, opts)
|
||||
return system "start", address if Utils::Platforms.windows?
|
||||
@@ -294,8 +263,6 @@ module Jekyll
|
||||
# Keep in our area with a thread or detach the server as requested
|
||||
# by the user. This method determines what we do based on what you
|
||||
# ask us to do.
|
||||
|
||||
private
|
||||
def boot_or_detach(server, opts)
|
||||
if opts["detach"]
|
||||
pid = Process.fork do
|
||||
@@ -304,7 +271,8 @@ module Jekyll
|
||||
|
||||
Process.detach(pid)
|
||||
Jekyll.logger.info "Server detached with pid '#{pid}'.", \
|
||||
"Run `pkill -f jekyll' or `kill -9 #{pid}' to stop the server."
|
||||
"Run `pkill -f jekyll' or `kill -9 #{pid}'" \
|
||||
" to stop the server."
|
||||
else
|
||||
t = Thread.new { server.start }
|
||||
trap("INT") { server.shutdown }
|
||||
@@ -313,8 +281,6 @@ module Jekyll
|
||||
end
|
||||
|
||||
# Make the stack verbose if the user requests it.
|
||||
|
||||
private
|
||||
def enable_logging(opts)
|
||||
opts[:AccessLog] = []
|
||||
level = WEBrick::Log.const_get(opts[:JekyllOptions]["verbose"] ? :DEBUG : :WARN)
|
||||
@@ -324,8 +290,6 @@ module Jekyll
|
||||
# Add SSL to the stack if the user triggers --enable-ssl and they
|
||||
# provide both types of certificates commonly needed. Raise if they
|
||||
# forget to add one of the certificates.
|
||||
|
||||
private
|
||||
def enable_ssl(opts)
|
||||
cert, key, src =
|
||||
opts[:JekyllOptions].values_at("ssl_cert", "ssl_key", "source")
|
||||
@@ -341,13 +305,12 @@ module Jekyll
|
||||
opts[:SSLEnable] = true
|
||||
end
|
||||
|
||||
private
|
||||
def start_callback(detached)
|
||||
unless detached
|
||||
proc do
|
||||
mutex.synchronize do
|
||||
# Block until EventMachine reactor starts
|
||||
@reload_reactor.started_event.wait unless @reload_reactor.nil?
|
||||
@reload_reactor&.started_event&.wait
|
||||
@running = true
|
||||
Jekyll.logger.info("Server running...", "press ctrl-c to stop.")
|
||||
@run_cond.broadcast
|
||||
@@ -356,7 +319,6 @@ module Jekyll
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def stop_callback(detached)
|
||||
unless detached
|
||||
proc do
|
||||
@@ -372,13 +334,11 @@ module Jekyll
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def mime_types
|
||||
file = File.expand_path("../mime.types", __dir__)
|
||||
WEBrick::HTTPUtils.load_mime_types(file)
|
||||
end
|
||||
|
||||
private
|
||||
def read_file(source_dir, file_path)
|
||||
File.read(Jekyll.sanitized_path(source_dir, file_path))
|
||||
end
|
||||
|
||||
@@ -58,7 +58,7 @@ module Jekyll
|
||||
EM.add_shutdown_hook { @stopped_event.set }
|
||||
|
||||
Jekyll.logger.info "LiveReload address:",
|
||||
"http://#{opts["host"]}:#{opts["livereload_port"]}"
|
||||
"http://#{opts["host"]}:#{opts["livereload_port"]}"
|
||||
end
|
||||
end
|
||||
@thread.abort_on_exception = true
|
||||
@@ -68,11 +68,11 @@ module Jekyll
|
||||
# http://feedback.livereload.com/knowledgebase/articles/86174-livereload-protocol
|
||||
def reload(pages)
|
||||
pages.each do |p|
|
||||
json_message = JSON.dump({
|
||||
json_message = JSON.dump(
|
||||
:command => "reload",
|
||||
:path => p.url,
|
||||
:liveCSS => true,
|
||||
})
|
||||
:liveCSS => true
|
||||
)
|
||||
|
||||
Jekyll.logger.debug "LiveReload:", "Reloading #{p.url}"
|
||||
Jekyll.logger.debug "", json_message
|
||||
@@ -81,6 +81,7 @@ module Jekyll
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def connect(websocket, handshake)
|
||||
@connections_count += 1
|
||||
if @connections_count == 1
|
||||
@@ -99,22 +100,17 @@ module Jekyll
|
||||
@websockets << websocket
|
||||
end
|
||||
|
||||
private
|
||||
def disconnect(websocket)
|
||||
@websockets.delete(websocket)
|
||||
end
|
||||
|
||||
private
|
||||
def print_message(json_message)
|
||||
msg = JSON.parse(json_message)
|
||||
# Not sure what the 'url' command even does in LiveReload. The spec is silent
|
||||
# on its purpose.
|
||||
if msg["command"] == "url"
|
||||
Jekyll.logger.info "LiveReload:", "Browser URL: #{msg["url"]}"
|
||||
end
|
||||
Jekyll.logger.info "LiveReload:", "Browser URL: #{msg["url"]}" if msg["command"] == "url"
|
||||
end
|
||||
|
||||
private
|
||||
def log_error(error)
|
||||
Jekyll.logger.error "LiveReload experienced an error. " \
|
||||
"Run with --trace for more information."
|
||||
|
||||
@@ -121,9 +121,7 @@ module Jekyll
|
||||
if @options["livereload_max_delay"]
|
||||
src += "&maxdelay=#{@options["livereload_max_delay"]}"
|
||||
end
|
||||
if @options["livereload_port"]
|
||||
src += "&port=#{@options["livereload_port"]}"
|
||||
end
|
||||
src += "&port=#{@options["livereload_port"]}" if @options["livereload_port"]
|
||||
src
|
||||
end
|
||||
end
|
||||
@@ -178,9 +176,8 @@ module Jekyll
|
||||
end
|
||||
# rubocop:enable Naming/MethodName
|
||||
|
||||
#
|
||||
|
||||
private
|
||||
|
||||
def validate_and_ensure_charset(_req, res)
|
||||
key = res.header.keys.grep(%r!content-type!i).first
|
||||
typ = res.header[key]
|
||||
@@ -190,9 +187,6 @@ module Jekyll
|
||||
end
|
||||
end
|
||||
|
||||
#
|
||||
|
||||
private
|
||||
def set_defaults
|
||||
hash_ = @jekyll_opts.fetch("webrick", {}).fetch("headers", {})
|
||||
DEFAULTS.each_with_object(@headers = hash_) do |(key, val), hash|
|
||||
|
||||
@@ -66,14 +66,6 @@ module Jekyll
|
||||
"strict_variables" => false,
|
||||
},
|
||||
|
||||
"rdiscount" => {
|
||||
"extensions" => [],
|
||||
},
|
||||
|
||||
"redcarpet" => {
|
||||
"extensions" => [],
|
||||
},
|
||||
|
||||
"kramdown" => {
|
||||
"auto_ids" => true,
|
||||
"toc_levels" => "1..6",
|
||||
@@ -265,9 +257,10 @@ module Jekyll
|
||||
end
|
||||
|
||||
config["collections"] = Utils.deep_merge_hashes(
|
||||
{ "posts" => {} }, config["collections"]
|
||||
{ "posts" => {}, "pages" => {} }, config["collections"]
|
||||
).tap do |collections|
|
||||
collections["posts"]["output"] = true
|
||||
collections["pages"]["output"] = true
|
||||
if config["permalink"]
|
||||
collections["posts"]["permalink"] ||= style_to_permalink(config["permalink"])
|
||||
end
|
||||
@@ -286,6 +279,7 @@ module Jekyll
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def style_to_permalink(permalink_style)
|
||||
case permalink_style.to_sym
|
||||
when :pretty
|
||||
@@ -307,14 +301,12 @@ module Jekyll
|
||||
# file - the file from which the config was extracted
|
||||
#
|
||||
# Raises an ArgumentError if given config is not a hash
|
||||
private
|
||||
def check_config_is_hash!(extracted_config, file)
|
||||
unless extracted_config.is_a?(Hash)
|
||||
raise ArgumentError, "Configuration file: (INVALID) #{file}".yellow
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def check_auto(config)
|
||||
if config.key?("auto") || config.key?("watch")
|
||||
Jekyll::Deprecator.deprecation_message "Auto-regeneration can no longer" \
|
||||
@@ -325,7 +317,6 @@ module Jekyll
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def check_server(config)
|
||||
if config.key?("server")
|
||||
Jekyll::Deprecator.deprecation_message "The 'server' configuration option" \
|
||||
@@ -335,7 +326,6 @@ module Jekyll
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def check_pygments(config)
|
||||
if config.key?("pygments")
|
||||
Jekyll::Deprecator.deprecation_message "The 'pygments' configuration option" \
|
||||
@@ -348,7 +338,6 @@ module Jekyll
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def check_include_exclude(config)
|
||||
%w(include exclude).each do |option|
|
||||
if config[option].is_a?(String)
|
||||
@@ -358,11 +347,10 @@ module Jekyll
|
||||
" as a list of comma-separated values."
|
||||
config[option] = csv_to_array(config[option])
|
||||
end
|
||||
config[option].map!(&:to_s) if config[option]
|
||||
config[option]&.map!(&:to_s)
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def check_coderay(config)
|
||||
if (config["kramdown"] || {}).key?("use_coderay")
|
||||
Jekyll::Deprecator.deprecation_message "Please change 'use_coderay'" \
|
||||
@@ -371,7 +359,6 @@ module Jekyll
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def check_maruku(config)
|
||||
if config.fetch("markdown", "kramdown").to_s.casecmp("maruku").zero?
|
||||
Jekyll.logger.abort_with "Error:", "You're using the 'maruku' " \
|
||||
@@ -388,7 +375,6 @@ module Jekyll
|
||||
#
|
||||
# Raises a Jekyll::Errors::InvalidConfigurationError if the config `plugins`
|
||||
# is a string
|
||||
private
|
||||
def check_plugins(config)
|
||||
if config.key?("plugins") && config["plugins"].is_a?(String)
|
||||
Jekyll.logger.error "Configuration Error:", "You specified the" \
|
||||
@@ -396,8 +382,8 @@ module Jekyll
|
||||
" use an array instead. If you wanted to set the directory of your" \
|
||||
" plugins, use the config key `plugins_dir` instead."
|
||||
raise Jekyll::Errors::InvalidConfigurationError,
|
||||
"'plugins' should not be a string, but was: " \
|
||||
"#{config["plugins"].inspect}. Use 'plugins_dir' instead."
|
||||
"'plugins' should not be a string, but was: " \
|
||||
"#{config["plugins"].inspect}. Use 'plugins_dir' instead."
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -11,9 +11,7 @@ module Jekyll
|
||||
return if @setup ||= false
|
||||
unless (@parser = get_processor)
|
||||
Jekyll.logger.error "Invalid Markdown processor given:", @config["markdown"]
|
||||
if @config["safe"]
|
||||
Jekyll.logger.info "", "Custom processors are not loaded in safe mode"
|
||||
end
|
||||
Jekyll.logger.info "", "Custom processors are not loaded in safe mode" if @config["safe"]
|
||||
Jekyll.logger.error(
|
||||
"",
|
||||
"Available processors are: #{valid_processors.join(", ")}"
|
||||
@@ -30,9 +28,7 @@ module Jekyll
|
||||
# rubocop:disable Naming/AccessorMethodName
|
||||
def get_processor
|
||||
case @config["markdown"].downcase
|
||||
when "redcarpet" then return RedcarpetParser.new(@config)
|
||||
when "kramdown" then return KramdownParser.new(@config)
|
||||
when "rdiscount" then return RDiscountParser.new(@config)
|
||||
when "kramdown" then KramdownParser.new(@config)
|
||||
else
|
||||
custom_processor
|
||||
end
|
||||
@@ -44,7 +40,7 @@ module Jekyll
|
||||
# are not in safe mode.)
|
||||
|
||||
def valid_processors
|
||||
%w(rdiscount kramdown redcarpet) + third_party_processors
|
||||
%w(kramdown) + third_party_processors
|
||||
end
|
||||
|
||||
# Public: A list of processors that you provide via plugins.
|
||||
@@ -53,7 +49,7 @@ module Jekyll
|
||||
|
||||
def third_party_processors
|
||||
self.class.constants - \
|
||||
%w(KramdownParser RDiscountParser RedcarpetParser PRIORITIES).map(
|
||||
%w(KramdownParser PRIORITIES).map(
|
||||
&:to_sym
|
||||
)
|
||||
end
|
||||
@@ -78,11 +74,10 @@ module Jekyll
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def custom_processor
|
||||
converter_name = @config["markdown"]
|
||||
if custom_class_allowed?(converter_name)
|
||||
self.class.const_get(converter_name).new(@config)
|
||||
end
|
||||
self.class.const_get(converter_name).new(@config) if custom_class_allowed?(converter_name)
|
||||
end
|
||||
|
||||
# Private: Determine whether a class name is an allowed custom
|
||||
@@ -92,8 +87,6 @@ module Jekyll
|
||||
#
|
||||
# Returns true if the parser name contains only alphanumeric
|
||||
# characters and is defined within Jekyll::Converters::Markdown
|
||||
|
||||
private
|
||||
def custom_class_allowed?(parser_name)
|
||||
parser_name !~ %r![^A-Za-z0-9_]! && self.class.constants.include?(
|
||||
parser_name.to_sym
|
||||
|
||||
@@ -47,6 +47,7 @@ module Jekyll
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def make_accessible(hash = @config)
|
||||
hash.keys.each do |key|
|
||||
hash[key.to_sym] = hash[key]
|
||||
@@ -59,8 +60,6 @@ module Jekyll
|
||||
# config[highlighter]
|
||||
# Where `enable_coderay` is now deprecated because Kramdown
|
||||
# supports Rouge now too.
|
||||
|
||||
private
|
||||
def highlighter
|
||||
return @highlighter if @highlighter
|
||||
|
||||
@@ -84,7 +83,6 @@ module Jekyll
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def strip_coderay_prefix(hash)
|
||||
hash.each_with_object({}) do |(key, val), hsh|
|
||||
cleaned_key = key.to_s.gsub(%r!\Acoderay_!, "")
|
||||
@@ -102,8 +100,6 @@ module Jekyll
|
||||
# If our highlighter is CodeRay we go in to merge the CodeRay defaults
|
||||
# with your "coderay" key if it's there, deprecating it in the
|
||||
# process of you using it.
|
||||
|
||||
private
|
||||
def modernize_coderay_config
|
||||
unless @config["coderay"].empty?
|
||||
Jekyll::Deprecator.deprecation_message(
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
module Converters
|
||||
class Markdown
|
||||
class RDiscountParser
|
||||
def initialize(config)
|
||||
unless defined?(RDiscount)
|
||||
Jekyll::External.require_with_graceful_fail "rdiscount"
|
||||
end
|
||||
@config = config
|
||||
@rdiscount_extensions = @config["rdiscount"]["extensions"].map(&:to_sym)
|
||||
end
|
||||
|
||||
def convert(content)
|
||||
rd = RDiscount.new(content, *@rdiscount_extensions)
|
||||
html = rd.to_html
|
||||
if @config["rdiscount"]["toc_token"]
|
||||
html = replace_generated_toc(rd, html, @config["rdiscount"]["toc_token"])
|
||||
end
|
||||
html
|
||||
end
|
||||
|
||||
private
|
||||
def replace_generated_toc(rd_instance, html, toc_token)
|
||||
if rd_instance.generate_toc && html.include?(toc_token)
|
||||
utf8_toc = rd_instance.toc_content
|
||||
utf8_toc.force_encoding("utf-8") if utf8_toc.respond_to?(:force_encoding)
|
||||
html.gsub(toc_token, utf8_toc)
|
||||
else
|
||||
html
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,112 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class Jekyll::Converters::Markdown::RedcarpetParser
|
||||
module CommonMethods
|
||||
def add_code_tags(code, lang)
|
||||
code = code.to_s
|
||||
code = code.sub(
|
||||
%r!<pre>!,
|
||||
"<pre><code class=\"language-#{lang}\" data-lang=\"#{lang}\">"
|
||||
)
|
||||
code = code.sub(%r!</pre>!, "</code></pre>")
|
||||
code
|
||||
end
|
||||
end
|
||||
|
||||
module WithPygments
|
||||
include CommonMethods
|
||||
def block_code(code, lang)
|
||||
unless defined?(Pygments)
|
||||
Jekyll::External.require_with_graceful_fail("pygments")
|
||||
end
|
||||
lang = lang && lang.split.first || "text"
|
||||
add_code_tags(
|
||||
Pygments.highlight(
|
||||
code,
|
||||
{
|
||||
:lexer => lang,
|
||||
:options => { :encoding => "utf-8" },
|
||||
}
|
||||
),
|
||||
lang
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
module WithoutHighlighting
|
||||
require "cgi"
|
||||
|
||||
include CommonMethods
|
||||
|
||||
def code_wrap(code)
|
||||
"<figure class=\"highlight\"><pre>#{CGI.escapeHTML(code)}</pre></figure>"
|
||||
end
|
||||
|
||||
def block_code(code, lang)
|
||||
lang = lang && lang.split.first || "text"
|
||||
add_code_tags(code_wrap(code), lang)
|
||||
end
|
||||
end
|
||||
|
||||
module WithRouge
|
||||
def block_code(_code, lang)
|
||||
code = "<pre>#{super}</pre>"
|
||||
|
||||
"<div class=\"highlight\">#{add_code_tags(code, lang)}</div>"
|
||||
end
|
||||
|
||||
protected
|
||||
def rouge_formatter(_lexer)
|
||||
Jekyll::Utils::Rouge.html_formatter(:wrap => false)
|
||||
end
|
||||
end
|
||||
|
||||
def initialize(config)
|
||||
unless defined?(Redcarpet)
|
||||
Jekyll::External.require_with_graceful_fail("redcarpet")
|
||||
end
|
||||
@config = config
|
||||
@redcarpet_extensions = {}
|
||||
@config["redcarpet"]["extensions"].each do |e|
|
||||
@redcarpet_extensions[e.to_sym] = true
|
||||
end
|
||||
|
||||
@renderer ||= class_with_proper_highlighter(@config["highlighter"])
|
||||
end
|
||||
|
||||
def class_with_proper_highlighter(highlighter)
|
||||
Class.new(Redcarpet::Render::HTML) do
|
||||
case highlighter
|
||||
when "pygments"
|
||||
include WithPygments
|
||||
when "rouge"
|
||||
Jekyll::External.require_with_graceful_fail(%w(
|
||||
rouge rouge/plugins/redcarpet
|
||||
))
|
||||
|
||||
unless Gem::Version.new(Rouge.version) > Gem::Version.new("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
|
||||
else
|
||||
include WithoutHighlighting
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def convert(content)
|
||||
@redcarpet_extensions[:fenced_code_blocks] = \
|
||||
!@redcarpet_extensions[:no_fenced_code_blocks]
|
||||
if @redcarpet_extensions[:smart]
|
||||
@renderer.send :include, Redcarpet::Render::SmartyPants
|
||||
end
|
||||
markdown = Redcarpet::Markdown.new(
|
||||
@renderer.new(@redcarpet_extensions),
|
||||
@redcarpet_extensions
|
||||
)
|
||||
markdown.render(content)
|
||||
end
|
||||
end
|
||||
@@ -1,16 +1,20 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class Kramdown::Parser::SmartyPants < Kramdown::Parser::Kramdown
|
||||
def initialize(source, options)
|
||||
super
|
||||
@block_parsers = [:block_html, :content]
|
||||
@span_parsers = [:smart_quotes, :html_entity, :typographic_syms, :span_html]
|
||||
end
|
||||
module Kramdown
|
||||
module Parser
|
||||
class SmartyPants < Kramdown::Parser::Kramdown
|
||||
def initialize(source, options)
|
||||
super
|
||||
@block_parsers = [:block_html, :content]
|
||||
@span_parsers = [:smart_quotes, :html_entity, :typographic_syms, :span_html]
|
||||
end
|
||||
|
||||
def parse_content
|
||||
add_text @src.scan(%r!\A.*\n!)
|
||||
def parse_content
|
||||
add_text @src.scan(%r!\A.*\n!)
|
||||
end
|
||||
define_parser(:content, %r!\A!)
|
||||
end
|
||||
end
|
||||
define_parser(:content, %r!\A!)
|
||||
end
|
||||
|
||||
module Jekyll
|
||||
@@ -20,9 +24,7 @@ module Jekyll
|
||||
priority :low
|
||||
|
||||
def initialize(config)
|
||||
unless defined?(Kramdown)
|
||||
Jekyll::External.require_with_graceful_fail "kramdown"
|
||||
end
|
||||
Jekyll::External.require_with_graceful_fail "kramdown" unless defined?(Kramdown)
|
||||
@config = config["kramdown"].dup || {}
|
||||
@config[:input] = :SmartyPants
|
||||
end
|
||||
|
||||
@@ -46,10 +46,10 @@ module Jekyll
|
||||
end
|
||||
rescue Psych::SyntaxError => e
|
||||
Jekyll.logger.warn "YAML Exception reading #{filename}: #{e.message}"
|
||||
raise e if self.site.config["strict_front_matter"]
|
||||
raise e if site.config["strict_front_matter"]
|
||||
rescue StandardError => e
|
||||
Jekyll.logger.warn "Error reading file #{filename}: #{e.message}"
|
||||
raise e if self.site.config["strict_front_matter"]
|
||||
raise e if site.config["strict_front_matter"]
|
||||
end
|
||||
|
||||
self.data ||= {}
|
||||
@@ -64,12 +64,12 @@ module Jekyll
|
||||
def validate_data!(filename)
|
||||
unless self.data.is_a?(Hash)
|
||||
raise Errors::InvalidYAMLFrontMatterError,
|
||||
"Invalid YAML front matter in #{filename}"
|
||||
"Invalid YAML front matter in #{filename}"
|
||||
end
|
||||
end
|
||||
|
||||
def validate_permalink!(filename)
|
||||
if self.data["permalink"] && self.data["permalink"].to_s.empty?
|
||||
if self.data["permalink"]&.to_s&.empty?
|
||||
raise Errors::InvalidPermalinkError, "Invalid permalink in #{filename}"
|
||||
end
|
||||
end
|
||||
@@ -125,16 +125,12 @@ module Jekyll
|
||||
#
|
||||
# Returns the type of self.
|
||||
def type
|
||||
if is_a?(Page)
|
||||
:pages
|
||||
end
|
||||
:pages if is_a?(Page)
|
||||
end
|
||||
|
||||
# returns the owner symbol for hook triggering
|
||||
def hook_owner
|
||||
if is_a?(Page)
|
||||
:pages
|
||||
end
|
||||
:pages if is_a?(Page)
|
||||
end
|
||||
|
||||
# Determine whether the document is an asset file.
|
||||
@@ -181,7 +177,7 @@ module Jekyll
|
||||
#
|
||||
# Returns true if the layout is invalid, false if otherwise
|
||||
def invalid_layout?(layout)
|
||||
!data["layout"].nil? && layout.nil? && !(self.is_a? Jekyll::Excerpt)
|
||||
!data["layout"].nil? && layout.nil? && !(is_a? Jekyll::Excerpt)
|
||||
end
|
||||
|
||||
# Recursively render layouts
|
||||
@@ -210,7 +206,7 @@ module Jekyll
|
||||
renderer.payload = payload
|
||||
end.run
|
||||
|
||||
Jekyll.logger.debug "Post-Render Hooks:", self.relative_path
|
||||
Jekyll.logger.debug "Post-Render Hooks:", relative_path
|
||||
Jekyll::Hooks.trigger hook_owner, :post_render, self
|
||||
ensure
|
||||
@_renderer = nil # this will allow the modifications above to disappear
|
||||
|
||||
@@ -34,9 +34,7 @@ module Jekyll
|
||||
end
|
||||
|
||||
def arg_is_present?(args, deprecated_argument, message)
|
||||
if args.include?(deprecated_argument)
|
||||
deprecation_message(message)
|
||||
end
|
||||
deprecation_message(message) if args.include?(deprecated_argument)
|
||||
end
|
||||
|
||||
def deprecation_message(message)
|
||||
|
||||
@@ -5,15 +5,28 @@ module Jekyll
|
||||
include Comparable
|
||||
extend Forwardable
|
||||
|
||||
attr_reader :path, :site, :extname, :collection
|
||||
attr_reader :site, :extname, :collection
|
||||
attr_accessor :content, :output
|
||||
|
||||
# In order to retain backwards compatability, @path is the absolute path
|
||||
# in Documents, but the relative path in Pages. If you need the Document's
|
||||
# path, it's better to use #absolute_path and #relative_path
|
||||
attr_reader :path
|
||||
|
||||
def_delegator :self, :read_post_data, :post_read
|
||||
|
||||
YAML_FRONT_MATTER_REGEXP = %r!\A(---\s*\n.*?\n?)^((---|\.\.\.)\s*$\n?)!m
|
||||
DATELESS_FILENAME_MATCHER = %r!^(?:.+/)*(.*)(\.[^.]+)$!
|
||||
DATE_FILENAME_MATCHER = %r!^(?:.+/)*(\d{2,4}-\d{1,2}-\d{1,2})-(.*)(\.[^.]+)$!
|
||||
|
||||
# A set of extensions that are considered HTML or HTML-like so we
|
||||
# should not alter them, this includes .xhtml through XHTM5.
|
||||
HTML_EXTENSIONS = %w(
|
||||
.html
|
||||
.xhtml
|
||||
.htm
|
||||
).freeze
|
||||
|
||||
# Create a new Document.
|
||||
#
|
||||
# path - the path to the file
|
||||
@@ -83,7 +96,23 @@ module Jekyll
|
||||
# Returns a String path which represents the relative path from the collections_dir
|
||||
# to this document.
|
||||
def relative_path
|
||||
@relative_path ||= path.sub("#{site.collections_path}/", "")
|
||||
@relative_path ||= Pathname.new(absolute_path)
|
||||
.relative_path_from(Pathname.new(site.source)).to_s
|
||||
end
|
||||
|
||||
# The path to the document's containing directory, relative to the site source
|
||||
#
|
||||
# Returns a String path which represents the relative path
|
||||
# from the site source to this document's containing directory
|
||||
def relative_path_without_basename
|
||||
@relative_path_without_basename = relative_path.sub(%r!#{basename}\z!, "")
|
||||
end
|
||||
|
||||
# The absolute path to the document
|
||||
#
|
||||
# Returns a String path which represents the absolute pat to this document
|
||||
def absolute_path
|
||||
Pathname.new(@path).to_s
|
||||
end
|
||||
|
||||
# The output extension of the document.
|
||||
@@ -97,14 +126,14 @@ module Jekyll
|
||||
#
|
||||
# Returns the basename without the file extname.
|
||||
def basename_without_ext
|
||||
@basename_without_ext ||= File.basename(path, ".*")
|
||||
@basename_without_ext ||= File.basename(absolute_path, ".*")
|
||||
end
|
||||
|
||||
# The base filename of the document.
|
||||
#
|
||||
# Returns the base filename of the document.
|
||||
def basename
|
||||
@basename ||= File.basename(path)
|
||||
@basename ||= File.basename(absolute_path)
|
||||
end
|
||||
|
||||
# Produces a "cleaned" relative path.
|
||||
@@ -159,7 +188,7 @@ module Jekyll
|
||||
# or if the document doesn't contain any Liquid Tags or Variables,
|
||||
# true otherwise.
|
||||
def render_with_liquid?
|
||||
!(coffeescript_file? || yaml_file? || !Utils.has_liquid_construct?(content))
|
||||
!(yaml_file? || !Utils.has_liquid_construct?(content))
|
||||
end
|
||||
|
||||
# Determine whether the file should be rendered with a layout.
|
||||
@@ -177,6 +206,16 @@ module Jekyll
|
||||
!(asset_file? || yaml_file? || no_layout?)
|
||||
end
|
||||
|
||||
# Returns the Boolean of whether this Page is HTML or not.
|
||||
def html?
|
||||
HTML_EXTENSIONS.include?(output_ext)
|
||||
end
|
||||
|
||||
# Returns the Boolean of whether this Page is an index file or not.
|
||||
def index?
|
||||
basename_without_ext == "index"
|
||||
end
|
||||
|
||||
# The URL template where the document would be accessible.
|
||||
#
|
||||
# Returns the URL template for the document.
|
||||
@@ -204,11 +243,11 @@ 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,
|
||||
}).to_s
|
||||
:permalink => permalink
|
||||
).to_s
|
||||
end
|
||||
|
||||
def [](key)
|
||||
@@ -224,7 +263,7 @@ module Jekyll
|
||||
dest = site.in_dest_dir(base_directory)
|
||||
path = site.in_dest_dir(dest, URL.unescape_path(url))
|
||||
if url.end_with? "/"
|
||||
path = File.join(path, "index.html")
|
||||
path = File.join(path, "index#{output_ext}")
|
||||
else
|
||||
path << output_ext unless path.end_with? output_ext
|
||||
end
|
||||
@@ -262,7 +301,7 @@ module Jekyll
|
||||
Jekyll.logger.debug "Reading:", relative_path
|
||||
|
||||
if yaml_file?
|
||||
@data = SafeYAML.load_file(path)
|
||||
@data = SafeYAML.load_file(absolute_path)
|
||||
else
|
||||
begin
|
||||
merge_defaults
|
||||
@@ -304,7 +343,7 @@ module Jekyll
|
||||
def <=>(other)
|
||||
return nil unless other.respond_to?(:data)
|
||||
cmp = data["date"] <=> other.data["date"]
|
||||
cmp = path <=> other.path if cmp.nil? || cmp.zero?
|
||||
cmp = relative_path <=> other.relative_path if cmp.nil? || cmp.zero?
|
||||
cmp
|
||||
end
|
||||
|
||||
@@ -315,7 +354,7 @@ module Jekyll
|
||||
# method returns true, and if the site's Publisher will publish the document.
|
||||
# False otherwise.
|
||||
def write?
|
||||
collection && collection.write? && site.publisher.publish?(self)
|
||||
collection&.write? && site.publisher.publish?(self)
|
||||
end
|
||||
|
||||
# The Document excerpt_separator, from the YAML Front-Matter or site
|
||||
@@ -335,16 +374,12 @@ module Jekyll
|
||||
|
||||
def next_doc
|
||||
pos = collection.docs.index { |post| post.equal?(self) }
|
||||
if pos && pos < collection.docs.length - 1
|
||||
collection.docs[pos + 1]
|
||||
end
|
||||
collection.docs[pos + 1] if pos && pos < collection.docs.length - 1
|
||||
end
|
||||
|
||||
def previous_doc
|
||||
pos = collection.docs.index { |post| post.equal?(self) }
|
||||
if pos && pos > 0
|
||||
collection.docs[pos - 1]
|
||||
end
|
||||
collection.docs[pos - 1] if pos && pos.positive?
|
||||
end
|
||||
|
||||
def trigger_hooks(hook_name, *args)
|
||||
@@ -400,32 +435,30 @@ module Jekyll
|
||||
end
|
||||
|
||||
def populate_categories
|
||||
merge_data!({
|
||||
merge_data!(
|
||||
"categories" => (
|
||||
Array(data["categories"]) + Utils.pluralized_array_from_hash(
|
||||
data, "category", "categories"
|
||||
)
|
||||
).map(&:to_s).flatten.uniq,
|
||||
})
|
||||
).map(&:to_s).flatten.uniq
|
||||
)
|
||||
end
|
||||
|
||||
def populate_tags
|
||||
merge_data!({
|
||||
"tags" => Utils.pluralized_array_from_hash(data, "tag", "tags").flatten,
|
||||
})
|
||||
merge_data!(
|
||||
"tags" => Utils.pluralized_array_from_hash(data, "tag", "tags").flatten
|
||||
)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def merge_categories!(other)
|
||||
if other.key?("categories") && !other["categories"].nil?
|
||||
if other["categories"].is_a?(String)
|
||||
other["categories"] = other["categories"].split
|
||||
end
|
||||
other["categories"] = other["categories"].split if other["categories"].is_a?(String)
|
||||
other["categories"] = (data["categories"] || []) | other["categories"]
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def merge_date!(source)
|
||||
if data.key?("date")
|
||||
data["date"] = Utils.parse_date(
|
||||
@@ -435,7 +468,6 @@ module Jekyll
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def merge_defaults
|
||||
defaults = @site.frontmatter_defaults.all(
|
||||
relative_path,
|
||||
@@ -444,9 +476,8 @@ module Jekyll
|
||||
merge_data!(defaults, :source => "front matter defaults") unless defaults.empty?
|
||||
end
|
||||
|
||||
private
|
||||
def read_content(opts)
|
||||
self.content = File.read(path, Utils.merged_file_read_opts(site, opts))
|
||||
self.content = File.read(absolute_path, Utils.merged_file_read_opts(site, opts))
|
||||
if content =~ YAML_FRONT_MATTER_REGEXP
|
||||
self.content = $POSTMATCH
|
||||
data_file = SafeYAML.load(Regexp.last_match(1))
|
||||
@@ -454,7 +485,6 @@ module Jekyll
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def read_post_data
|
||||
populate_title
|
||||
populate_categories
|
||||
@@ -462,12 +492,11 @@ module Jekyll
|
||||
generate_excerpt
|
||||
end
|
||||
|
||||
private
|
||||
def handle_read_error(error)
|
||||
if error.is_a? Psych::SyntaxError
|
||||
Jekyll.logger.error "Error:", "YAML Exception reading #{path}: #{error.message}"
|
||||
Jekyll.logger.error "Error:", "YAML Exception reading #{relative_path}: #{error.message}"
|
||||
else
|
||||
Jekyll.logger.error "Error:", "could not read file #{path}: #{error.message}"
|
||||
Jekyll.logger.error "Error:", "could not read file #{relative_path}: #{error.message}"
|
||||
end
|
||||
|
||||
if site.config["strict_front_matter"] || error.is_a?(Jekyll::Errors::FatalException)
|
||||
@@ -475,7 +504,6 @@ module Jekyll
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def populate_title
|
||||
if relative_path =~ DATE_FILENAME_MATCHER
|
||||
date, slug, ext = Regexp.last_match.captures
|
||||
@@ -491,18 +519,14 @@ module Jekyll
|
||||
data["ext"] ||= ext
|
||||
end
|
||||
|
||||
private
|
||||
def modify_date(date)
|
||||
if !data["date"] || data["date"].to_i == site.time.to_i
|
||||
merge_data!({ "date" => date }, :source => "filename")
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def generate_excerpt
|
||||
if generate_excerpt?
|
||||
data["excerpt"] ||= Jekyll::Excerpt.new(self)
|
||||
end
|
||||
data["excerpt"] ||= Jekyll::Excerpt.new(self) if generate_excerpt?
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -7,9 +7,8 @@ module Jekyll
|
||||
|
||||
mutable false
|
||||
|
||||
def_delegator :@obj, :write?, :output
|
||||
def_delegators :@obj, :label, :docs, :files, :directory,
|
||||
:relative_directory
|
||||
def_delegator :@obj, :write?, :output
|
||||
def_delegators :@obj, :label, :docs, :files, :directory, :relative_directory
|
||||
|
||||
private def_delegator :@obj, :metadata, :fallback_data
|
||||
|
||||
|
||||
@@ -15,11 +15,7 @@ module Jekyll
|
||||
#
|
||||
# Returns the mutability of the class
|
||||
def self.mutable(is_mutable = nil)
|
||||
@is_mutable = if is_mutable
|
||||
is_mutable
|
||||
else
|
||||
false
|
||||
end
|
||||
@is_mutable = is_mutable || false
|
||||
end
|
||||
|
||||
def self.mutable?
|
||||
@@ -173,7 +169,7 @@ module Jekyll
|
||||
end
|
||||
|
||||
def merge(other, &block)
|
||||
self.dup.tap do |me|
|
||||
dup.tap do |me|
|
||||
if block.nil?
|
||||
me.merge!(other)
|
||||
else
|
||||
|
||||
@@ -8,8 +8,7 @@ module Jekyll
|
||||
mutable false
|
||||
|
||||
def_delegator :@obj, :site_data, :data
|
||||
def_delegators :@obj, :time, :pages, :static_files, :documents,
|
||||
:tags, :categories
|
||||
def_delegators :@obj, :time, :pages, :static_files, :documents, :tags, :categories
|
||||
|
||||
private def_delegator :@obj, :config, :fallback_data
|
||||
|
||||
@@ -30,7 +29,7 @@ module Jekyll
|
||||
end
|
||||
|
||||
def html_pages
|
||||
@site_html_pages ||= @obj.pages.select do |page|
|
||||
@site_html_pages ||= @obj.pages.docs.select do |page|
|
||||
page.html? || page.url.end_with?("/")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -17,6 +17,7 @@ module Jekyll
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def fallback_data
|
||||
@fallback_data ||= {}
|
||||
end
|
||||
|
||||
@@ -9,6 +9,7 @@ module Jekyll
|
||||
|
||||
def_delegator :@obj, :cleaned_relative_path, :path
|
||||
def_delegator :@obj, :output_ext, :output_ext
|
||||
def_delegator :@obj, :relative_path_without_basename
|
||||
|
||||
def collection
|
||||
@obj.collection.label
|
||||
@@ -80,6 +81,7 @@ module Jekyll
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def fallback_data
|
||||
{}
|
||||
end
|
||||
|
||||
@@ -31,9 +31,7 @@ module Jekyll
|
||||
|
||||
def filter(entries)
|
||||
entries.reject do |e|
|
||||
unless included?(e)
|
||||
special?(e) || backup?(e) || excluded?(e) || symlink?(e)
|
||||
end
|
||||
special?(e) || backup?(e) || excluded?(e) || symlink?(e) unless included?(e)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -8,10 +8,11 @@ module Jekyll
|
||||
attr_accessor :content, :ext
|
||||
attr_writer :output
|
||||
|
||||
def_delegators :@doc, :site, :name, :ext, :extname,
|
||||
:collection, :related_posts,
|
||||
:coffeescript_file?, :yaml_file?,
|
||||
:url, :next_doc, :previous_doc
|
||||
def_delegators :@doc,
|
||||
:site, :name, :ext, :extname,
|
||||
:collection, :related_posts,
|
||||
:coffeescript_file?, :yaml_file?,
|
||||
:url, :next_doc, :previous_doc
|
||||
|
||||
private :coffeescript_file?, :yaml_file?
|
||||
|
||||
@@ -48,14 +49,14 @@ module Jekyll
|
||||
#
|
||||
# Returns the relative_path for the doc this excerpt belongs to with #excerpt appended
|
||||
def relative_path
|
||||
File.join(doc.relative_path, "#excerpt")
|
||||
@relative_path ||= File.join(doc.relative_path, "#excerpt")
|
||||
end
|
||||
|
||||
# Check if excerpt includes a string
|
||||
#
|
||||
# Returns true if the string passed in
|
||||
def include?(something)
|
||||
(output && output.include?(something)) || content.include?(something)
|
||||
(output&.include?(something)) || content.include?(something)
|
||||
end
|
||||
|
||||
# The UID for this doc (useful in feeds).
|
||||
@@ -76,7 +77,7 @@ module Jekyll
|
||||
|
||||
# Returns the shorthand String identifier of this doc.
|
||||
def inspect
|
||||
"<Excerpt: #{self.id}>"
|
||||
"<Excerpt: #{id}>"
|
||||
end
|
||||
|
||||
def output
|
||||
@@ -160,19 +161,18 @@ module Jekyll
|
||||
Liquid::Template.tags[tag_name].superclass == Liquid::Block
|
||||
rescue NoMethodError
|
||||
Jekyll.logger.error "Error:",
|
||||
"A Liquid tag in the excerpt of #{doc.relative_path} couldn't be " \
|
||||
"parsed."
|
||||
"A Liquid tag in the excerpt of #{doc.relative_path} couldn't be parsed."
|
||||
raise
|
||||
end
|
||||
|
||||
def print_build_warning
|
||||
Jekyll.logger.warn "Warning:", "Excerpt modified in #{doc.relative_path}!"
|
||||
Jekyll.logger.warn "",
|
||||
"Found a Liquid block containing separator '#{doc.excerpt_separator}' and has " \
|
||||
"been modified with the appropriate closing tag."
|
||||
"Found a Liquid block containing separator '#{doc.excerpt_separator}'" \
|
||||
" and has been modified with the appropriate closing tag."
|
||||
Jekyll.logger.warn "",
|
||||
"Feel free to define a custom excerpt or excerpt_separator in the document's " \
|
||||
"Front Matter if the generated excerpt is unsatisfactory."
|
||||
"Feel free to define a custom excerpt or excerpt_separator in the" \
|
||||
" document's Front Matter if the generated excerpt is unsatisfactory."
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -9,6 +9,7 @@ module Jekyll
|
||||
#
|
||||
def blessed_gems
|
||||
%w(
|
||||
jekyll-compose
|
||||
jekyll-docs
|
||||
jekyll-import
|
||||
)
|
||||
@@ -57,13 +58,13 @@ module Jekyll
|
||||
Jekyll.logger.debug "Requiring:", name.to_s
|
||||
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 configured, you'll need to install this gem.
|
||||
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 configured, you'll need to install this gem.
|
||||
|
||||
The full error message from Ruby is: '#{e.message}'
|
||||
The full error message from Ruby is: '#{e.message}'
|
||||
|
||||
If you run into trouble, you can find helpful resources at https://jekyllrb.com/help/!
|
||||
If you run into trouble, you can find helpful resources at https://jekyllrb.com/help/!
|
||||
MSG
|
||||
raise Jekyll::Errors::MissingDependencyException, name
|
||||
end
|
||||
|
||||
@@ -225,9 +225,7 @@ module Jekyll
|
||||
#
|
||||
# Returns the filtered array of objects
|
||||
def sort(input, property = nil, nils = "first")
|
||||
if input.nil?
|
||||
raise ArgumentError, "Cannot sort a null object."
|
||||
end
|
||||
raise ArgumentError, "Cannot sort a null object." if input.nil?
|
||||
if property.nil?
|
||||
input.sort
|
||||
else
|
||||
@@ -316,7 +314,6 @@ module Jekyll
|
||||
.map!(&:last)
|
||||
end
|
||||
|
||||
private
|
||||
def item_property(item, property)
|
||||
if item.respond_to?(:to_liquid)
|
||||
property.to_s.split(".").reduce(item.to_liquid) do |subvalue, attribute|
|
||||
@@ -329,7 +326,6 @@ module Jekyll
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def as_liquid(item)
|
||||
case item
|
||||
when Hash
|
||||
@@ -353,7 +349,6 @@ module Jekyll
|
||||
end
|
||||
|
||||
# Parse a string to a Liquid Condition
|
||||
private
|
||||
def parse_condition(exp)
|
||||
parser = Liquid::Parser.new(exp)
|
||||
left_expr = parser.expression
|
||||
@@ -370,7 +365,6 @@ module Jekyll
|
||||
|
||||
condition
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -64,6 +64,7 @@ module Jekyll
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# month_type: Notations that evaluate to 'Month' via `Time#strftime` ("%b", "%B")
|
||||
# type: nil (default) or "ordinal"
|
||||
# style: nil (default) or "US"
|
||||
@@ -81,7 +82,6 @@ module Jekyll
|
||||
time.strftime("%d #{month_type} %Y")
|
||||
end
|
||||
|
||||
private
|
||||
def ordinal(number)
|
||||
return "th" if (11..13).cover?(number)
|
||||
|
||||
@@ -93,12 +93,11 @@ module Jekyll
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def time(input)
|
||||
date = Liquid::Utils.to_date(input)
|
||||
unless date.respond_to?(:to_time)
|
||||
raise Errors::InvalidDateError,
|
||||
"Invalid Date: '#{input.inspect}' is not a valid datetime."
|
||||
"Invalid Date: '#{input.inspect}' is not a valid datetime."
|
||||
end
|
||||
date.to_time.dup.localtime
|
||||
end
|
||||
|
||||
@@ -41,16 +41,15 @@ module Jekyll
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def parse_expression(str)
|
||||
Liquid::Variable.new(str, Liquid::ParseContext.new)
|
||||
end
|
||||
|
||||
private
|
||||
def groupable?(element)
|
||||
element.respond_to?(:group_by)
|
||||
end
|
||||
|
||||
private
|
||||
def grouped_array(groups)
|
||||
groups.each_with_object([]) do |item, array|
|
||||
array << {
|
||||
|
||||
@@ -57,7 +57,6 @@ module Jekyll
|
||||
return input if input.nil? || input.empty? || input.start_with?("/")
|
||||
"/#{input}"
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -122,9 +122,7 @@ module Jekyll
|
||||
|
||||
def path_is_subpath?(path, parent_path)
|
||||
path.ascend do |ascended_path|
|
||||
if ascended_path.to_s == parent_path.to_s
|
||||
return true
|
||||
end
|
||||
return true if ascended_path.to_s == parent_path.to_s
|
||||
end
|
||||
|
||||
false
|
||||
|
||||
@@ -77,9 +77,7 @@ module Jekyll
|
||||
"following hooks #{@registry[owner].keys.inspect}"
|
||||
end
|
||||
|
||||
unless block.respond_to? :call
|
||||
raise Uncallable, "Hooks must respond to :call"
|
||||
end
|
||||
raise Uncallable, "Hooks must respond to :call" unless block.respond_to? :call
|
||||
|
||||
insert_hook owner, event, priority, &block
|
||||
end
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
module Jekyll
|
||||
module LiquidExtensions
|
||||
|
||||
# Lookup a Liquid variable in the given context.
|
||||
#
|
||||
# context - the Liquid context in question.
|
||||
@@ -19,6 +18,5 @@ module Jekyll
|
||||
|
||||
lookup || variable
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,96 +1,98 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
class LiquidRenderer::Table
|
||||
def initialize(stats)
|
||||
@stats = stats
|
||||
end
|
||||
|
||||
def to_s(num_of_rows = 50)
|
||||
data = data_for_table(num_of_rows)
|
||||
widths = table_widths(data)
|
||||
generate_table(data, widths)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def generate_table(data, widths)
|
||||
str = String.new("\n")
|
||||
|
||||
table_head = data.shift
|
||||
str << generate_row(table_head, widths)
|
||||
str << generate_table_head_border(table_head, widths)
|
||||
|
||||
data.each do |row_data|
|
||||
str << generate_row(row_data, widths)
|
||||
class LiquidRenderer
|
||||
class Table
|
||||
def initialize(stats)
|
||||
@stats = stats
|
||||
end
|
||||
|
||||
str << "\n"
|
||||
str
|
||||
end
|
||||
|
||||
def generate_table_head_border(row_data, widths)
|
||||
str = String.new("")
|
||||
|
||||
row_data.each_index do |cell_index|
|
||||
str << "-" * widths[cell_index]
|
||||
str << "-+-" unless cell_index == row_data.length - 1
|
||||
def to_s(num_of_rows = 50)
|
||||
data = data_for_table(num_of_rows)
|
||||
widths = table_widths(data)
|
||||
generate_table(data, widths)
|
||||
end
|
||||
|
||||
str << "\n"
|
||||
str
|
||||
end
|
||||
private
|
||||
|
||||
def generate_row(row_data, widths)
|
||||
str = String.new("")
|
||||
def generate_table(data, widths)
|
||||
str = +"\n"
|
||||
|
||||
row_data.each_with_index do |cell_data, cell_index|
|
||||
str << if cell_index.zero?
|
||||
cell_data.ljust(widths[cell_index], " ")
|
||||
else
|
||||
cell_data.rjust(widths[cell_index], " ")
|
||||
end
|
||||
table_head = data.shift
|
||||
str << generate_row(table_head, widths)
|
||||
str << generate_table_head_border(table_head, widths)
|
||||
|
||||
str << " | " unless cell_index == row_data.length - 1
|
||||
end
|
||||
|
||||
str << "\n"
|
||||
str
|
||||
end
|
||||
|
||||
def table_widths(data)
|
||||
widths = []
|
||||
|
||||
data.each do |row|
|
||||
row.each_with_index do |cell, index|
|
||||
widths[index] = [cell.length, widths[index]].compact.max
|
||||
data.each do |row_data|
|
||||
str << generate_row(row_data, widths)
|
||||
end
|
||||
|
||||
str << "\n"
|
||||
str
|
||||
end
|
||||
|
||||
widths
|
||||
end
|
||||
def generate_table_head_border(row_data, widths)
|
||||
str = +""
|
||||
|
||||
def data_for_table(num_of_rows)
|
||||
sorted = @stats.sort_by { |_, file_stats| -file_stats[:time] }
|
||||
sorted = sorted.slice(0, num_of_rows)
|
||||
row_data.each_index do |cell_index|
|
||||
str << "-" * widths[cell_index]
|
||||
str << "-+-" unless cell_index == row_data.length - 1
|
||||
end
|
||||
|
||||
table = [%w(Filename Count Bytes Time)]
|
||||
|
||||
sorted.each do |filename, file_stats|
|
||||
row = []
|
||||
row << filename
|
||||
row << file_stats[:count].to_s
|
||||
row << format_bytes(file_stats[:bytes])
|
||||
row << format("%.3f", file_stats[:time])
|
||||
table << row
|
||||
str << "\n"
|
||||
str
|
||||
end
|
||||
|
||||
table
|
||||
end
|
||||
def generate_row(row_data, widths)
|
||||
str = +""
|
||||
|
||||
def format_bytes(bytes)
|
||||
bytes /= 1024.0
|
||||
format("%.2fK", bytes)
|
||||
row_data.each_with_index do |cell_data, cell_index|
|
||||
str << if cell_index.zero?
|
||||
cell_data.ljust(widths[cell_index], " ")
|
||||
else
|
||||
cell_data.rjust(widths[cell_index], " ")
|
||||
end
|
||||
|
||||
str << " | " unless cell_index == row_data.length - 1
|
||||
end
|
||||
|
||||
str << "\n"
|
||||
str
|
||||
end
|
||||
|
||||
def table_widths(data)
|
||||
widths = []
|
||||
|
||||
data.each do |row|
|
||||
row.each_with_index do |cell, index|
|
||||
widths[index] = [cell.length, widths[index]].compact.max
|
||||
end
|
||||
end
|
||||
|
||||
widths
|
||||
end
|
||||
|
||||
def data_for_table(num_of_rows)
|
||||
sorted = @stats.sort_by { |_, file_stats| -file_stats[:time] }
|
||||
sorted = sorted.slice(0, num_of_rows)
|
||||
|
||||
table = [%w(Filename Count Bytes Time)]
|
||||
|
||||
sorted.each do |filename, file_stats|
|
||||
row = []
|
||||
row << filename
|
||||
row << file_stats[:count].to_s
|
||||
row << format_bytes(file_stats[:bytes])
|
||||
row << format("%.3f", file_stats[:time])
|
||||
table << row
|
||||
end
|
||||
|
||||
table
|
||||
end
|
||||
|
||||
def format_bytes(bytes)
|
||||
bytes /= 1024.0
|
||||
format("%.2fK", bytes)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -29,7 +29,9 @@ module Jekyll
|
||||
#
|
||||
# Returns nothing
|
||||
def log_level=(level)
|
||||
writer.level = LOG_LEVELS.fetch(level)
|
||||
writer.level = level if level.is_a?(Integer) && level.between?(0, 3)
|
||||
writer.level = LOG_LEVELS[level] ||
|
||||
raise(ArgumentError, "unknown log level")
|
||||
@level = level
|
||||
end
|
||||
|
||||
|
||||
@@ -1,17 +1,13 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
class Page
|
||||
include Convertible
|
||||
|
||||
class Page < Document
|
||||
attr_writer :dir
|
||||
attr_accessor :site, :pager
|
||||
attr_accessor :name, :ext, :basename
|
||||
attr_accessor :data, :content, :output
|
||||
attr_accessor :pager
|
||||
|
||||
alias_method :extname, :ext
|
||||
|
||||
FORWARD_SLASH = "/".freeze
|
||||
alias_method :ext, :extname
|
||||
alias_method :name, :basename
|
||||
alias_method :process, :read
|
||||
|
||||
# Attributes for Liquid templates
|
||||
ATTRIBUTES_FOR_LIQUID = %w(
|
||||
@@ -22,166 +18,87 @@ module Jekyll
|
||||
url
|
||||
).freeze
|
||||
|
||||
# A set of extensions that are considered HTML or HTML-like so we
|
||||
# should not alter them, this includes .xhtml through XHTM5.
|
||||
|
||||
HTML_EXTENSIONS = %w(
|
||||
.html
|
||||
.xhtml
|
||||
.htm
|
||||
).freeze
|
||||
|
||||
# rubocop:disable Metrics/AbcSize
|
||||
# Initialize a new Page.
|
||||
#
|
||||
# site - The Site object.
|
||||
# base - The String path to the source.
|
||||
# dir - The String path between the source and the file.
|
||||
# name - The String filename of the file.
|
||||
def initialize(site, base, dir, name)
|
||||
@site = site
|
||||
@base = base
|
||||
@dir = dir
|
||||
@name = name
|
||||
@path = if site.in_theme_dir(base) == base # we're in a theme
|
||||
site.in_theme_dir(base, dir, name)
|
||||
else
|
||||
site.in_source_dir(base, dir, name)
|
||||
end
|
||||
|
||||
process(name)
|
||||
read_yaml(File.join(base, dir), name)
|
||||
|
||||
data.default_proc = proc do |_, key|
|
||||
site.frontmatter_defaults.find(File.join(dir, name), type, key)
|
||||
def initialize(*args)
|
||||
if args.size == 2 # Initialized as Document
|
||||
super
|
||||
elsif args.size == 4 # Legacy Page support
|
||||
Jekyll::Deprecator.deprecation_message "Pages are now Documents."
|
||||
Jekyll::Deprecator.deprecation_message "Called by #{caller(1..1).first}."
|
||||
@site, @base, @dir, @name = args
|
||||
@path = if site.in_theme_dir(@base) == @base # we're in a theme
|
||||
site.in_theme_dir(@base, @dir, @name)
|
||||
else
|
||||
site.in_source_dir(@base, @dir, @name)
|
||||
end
|
||||
@relative_path = File.join(*[@dir, @name].map(&:to_s).reject(&:empty?)).sub(%r!\A\/!, "")
|
||||
super(@path, :collection => site.pages, :site => @site)
|
||||
read
|
||||
backwards_compatibilize
|
||||
else
|
||||
raise ArugmentError, "Expected 2 or 4 arguments, #{args.size} given"
|
||||
end
|
||||
|
||||
Jekyll::Hooks.trigger :pages, :post_init, self
|
||||
end
|
||||
|
||||
# The generated directory into which the page will be placed
|
||||
# upon generation. This is derived from the permalink or, if
|
||||
# permalink is absent, will be '/'
|
||||
#
|
||||
# Returns the String destination directory.
|
||||
# rubocop:enable Metrics/AbcSize
|
||||
|
||||
# Backwards compatible shim to return the generated directory into which
|
||||
# the page will be placed upon generation. This is derived from the
|
||||
# permalink or, if permalink is absent, will be '/'
|
||||
def dir
|
||||
if url.end_with?(FORWARD_SLASH)
|
||||
if url.end_with?("/")
|
||||
url
|
||||
else
|
||||
url_dir = File.dirname(url)
|
||||
url_dir.end_with?(FORWARD_SLASH) ? url_dir : "#{url_dir}/"
|
||||
url_dir.end_with?("/") ? url_dir : "#{url_dir}/"
|
||||
end
|
||||
end
|
||||
|
||||
# The full path and filename of the post. Defined in the YAML of the post
|
||||
# body.
|
||||
#
|
||||
# Returns the String permalink or nil if none has been set.
|
||||
def permalink
|
||||
data.nil? ? nil : data["permalink"]
|
||||
end
|
||||
|
||||
# The template of the permalink.
|
||||
#
|
||||
# Returns the template String.
|
||||
def template
|
||||
def url_template
|
||||
if !html?
|
||||
"/:path/:basename:output_ext"
|
||||
"/:path:output_ext"
|
||||
elsif index?
|
||||
"/:path/"
|
||||
"/:relative_path_without_basename/"
|
||||
else
|
||||
Utils.add_permalink_suffix("/:path/:basename", site.permalink_style)
|
||||
Utils.add_permalink_suffix("/:path", site.permalink_style)
|
||||
end
|
||||
end
|
||||
alias_method :template, :url_template
|
||||
|
||||
# The generated relative url of this page. e.g. /about.html.
|
||||
#
|
||||
# Returns the String url.
|
||||
def url
|
||||
@url ||= URL.new({
|
||||
:template => template,
|
||||
:placeholders => url_placeholders,
|
||||
:permalink => permalink,
|
||||
}).to_s
|
||||
end
|
||||
|
||||
# Returns a hash of URL placeholder names (as symbols) mapping to the
|
||||
# desired placeholder replacements. For details see "url.rb"
|
||||
def url_placeholders
|
||||
{
|
||||
:path => @dir,
|
||||
:basename => basename,
|
||||
:output_ext => output_ext,
|
||||
}
|
||||
end
|
||||
|
||||
# Extract information from the page filename.
|
||||
#
|
||||
# name - The String filename of the page file.
|
||||
#
|
||||
# Returns nothing.
|
||||
def process(name)
|
||||
self.ext = File.extname(name)
|
||||
self.basename = name[0..-ext.length - 1]
|
||||
end
|
||||
|
||||
# Add any necessary layouts to this post
|
||||
# Backwards compatible shim to add any necessary layouts to this post
|
||||
#
|
||||
# layouts - The Hash of {"name" => "layout"}.
|
||||
# site_payload - The site payload Hash.
|
||||
#
|
||||
# Returns String rendered page.
|
||||
def render(layouts, site_payload)
|
||||
site_payload["page"] = to_liquid
|
||||
site_payload["paginator"] = pager.to_liquid
|
||||
|
||||
do_layout(site_payload, layouts)
|
||||
def render(_, site_payload = nil)
|
||||
Jekyll::Renderer.new(site, self, site_payload).run
|
||||
end
|
||||
|
||||
# The path to the source file
|
||||
#
|
||||
# Returns the path to the source file
|
||||
# To maintain backwards compataiblity, path is relative for Pages
|
||||
# but absolute for documents. Use #absolute_path to get the absolute path
|
||||
def path
|
||||
data.fetch("path") { relative_path }
|
||||
Jekyll::Deprecator.deprecation_message "Page#path is now Page#relative_path."
|
||||
Jekyll::Deprecator.deprecation_message "Called by #{caller(1..1).first}."
|
||||
relative_path
|
||||
end
|
||||
|
||||
# The path to the page source file, relative to the site source
|
||||
def relative_path
|
||||
File.join(*[@dir, @name].map(&:to_s).reject(&:empty?)).sub(%r!\A\/!, "")
|
||||
end
|
||||
private
|
||||
|
||||
# Obtain destination path.
|
||||
#
|
||||
# dest - The String path to the destination dir.
|
||||
#
|
||||
# Returns the destination file path String.
|
||||
def destination(dest)
|
||||
path = site.in_dest_dir(dest, URL.unescape_path(url))
|
||||
path = File.join(path, "index") if url.end_with?("/")
|
||||
path << output_ext unless path.end_with? output_ext
|
||||
path
|
||||
end
|
||||
|
||||
# Returns the object as a debug String.
|
||||
def inspect
|
||||
"#<Jekyll::Page @name=#{name.inspect}>"
|
||||
end
|
||||
|
||||
# Returns the Boolean of whether this Page is HTML or not.
|
||||
def html?
|
||||
HTML_EXTENSIONS.include?(output_ext)
|
||||
end
|
||||
|
||||
# Returns the Boolean of whether this Page is an index file or not.
|
||||
def index?
|
||||
basename == "index"
|
||||
end
|
||||
|
||||
def trigger_hooks(hook_name, *args)
|
||||
Jekyll::Hooks.trigger :pages, hook_name, self, *args
|
||||
end
|
||||
|
||||
def write?
|
||||
true
|
||||
def backwards_compatibilize
|
||||
ATTRIBUTES_FOR_LIQUID.each do |key|
|
||||
data[key] = public_send(key.to_sym)
|
||||
end
|
||||
@url = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -14,5 +14,21 @@ module Jekyll
|
||||
def inspect
|
||||
"#<Jekyll:PageWithoutAFile @name=#{name.inspect}>"
|
||||
end
|
||||
|
||||
def draft?
|
||||
!!data["draft"]
|
||||
end
|
||||
|
||||
def do_nothing(*)
|
||||
nil
|
||||
end
|
||||
alias_method :process, :do_nothing
|
||||
alias_method :read, :do_nothing
|
||||
alias_method :read_content, :do_nothing
|
||||
alias_method :read_post_data, :do_nothing
|
||||
alias_method :categories_from_path, :do_nothing
|
||||
alias_method :populate_categories, :do_nothing
|
||||
alias_method :populate_tags, :do_nothing
|
||||
alias_method :backwards_compatibilize, :do_nothing
|
||||
end
|
||||
end
|
||||
|
||||
@@ -13,7 +13,7 @@ module Jekyll
|
||||
#
|
||||
|
||||
def self.inherited(const)
|
||||
return catch_inheritance(const) do |const_|
|
||||
catch_inheritance(const) do |const_|
|
||||
catch_inheritance(const_)
|
||||
end
|
||||
end
|
||||
@@ -23,9 +23,7 @@ module Jekyll
|
||||
def self.catch_inheritance(const)
|
||||
const.define_singleton_method :inherited do |const_|
|
||||
(@children ||= Set.new).add const_
|
||||
if block_given?
|
||||
yield const_
|
||||
end
|
||||
yield const_ if block_given?
|
||||
end
|
||||
end
|
||||
|
||||
@@ -48,9 +46,7 @@ module Jekyll
|
||||
# Returns the Symbol priority.
|
||||
def self.priority(priority = nil)
|
||||
@priority ||= nil
|
||||
if priority && PRIORITIES.key?(priority)
|
||||
@priority = priority
|
||||
end
|
||||
@priority = priority if priority && PRIORITIES.key?(priority)
|
||||
@priority || :normal
|
||||
end
|
||||
|
||||
@@ -62,9 +58,7 @@ module Jekyll
|
||||
#
|
||||
# Returns the safety Boolean.
|
||||
def self.safe(safe = nil)
|
||||
unless defined?(@safe) && safe.nil?
|
||||
@safe = safe
|
||||
end
|
||||
@safe = safe unless defined?(@safe) && safe.nil?
|
||||
@safe || false
|
||||
end
|
||||
|
||||
@@ -74,7 +68,7 @@ module Jekyll
|
||||
#
|
||||
# Returns -1, 0, 1.
|
||||
def self.<=>(other)
|
||||
PRIORITIES[other.priority] <=> PRIORITIES[self.priority]
|
||||
PRIORITIES[other.priority] <=> PRIORITIES[priority]
|
||||
end
|
||||
|
||||
# Spaceship is priority [higher -> lower]
|
||||
|
||||
@@ -23,7 +23,6 @@ module Jekyll
|
||||
# Sorts posts, pages, and static files.
|
||||
def sort_files!
|
||||
site.collections.each_value { |c| c.docs.sort! }
|
||||
site.pages.sort_by!(&:name)
|
||||
site.static_files.sort_by!(&:relative_path)
|
||||
end
|
||||
|
||||
@@ -76,9 +75,7 @@ module Jekyll
|
||||
dot_dirs.each do |file|
|
||||
dir_path = site.in_source_dir(dir, file)
|
||||
rel_path = File.join(dir, file)
|
||||
unless @site.dest.chomp("/") == dir_path
|
||||
@site.reader.read_directories(rel_path)
|
||||
end
|
||||
@site.reader.read_directories(rel_path) unless @site.dest.chomp("/") == dir_path
|
||||
end
|
||||
end
|
||||
|
||||
@@ -90,7 +87,7 @@ module Jekyll
|
||||
#
|
||||
# Returns nothing.
|
||||
def retrieve_pages(dir, dot_pages)
|
||||
site.pages.concat(PageReader.new(site, dir).read(dot_pages))
|
||||
site.pages.docs.concat(PageReader.new(site, dir).read(dot_pages))
|
||||
end
|
||||
|
||||
# Retrieve all the static files from the current directory,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
module Jekyll
|
||||
class CollectionReader
|
||||
SPECIAL_COLLECTIONS = %w(posts data).freeze
|
||||
SPECIAL_COLLECTIONS = %w(posts data pages).freeze
|
||||
|
||||
attr_reader :site, :content
|
||||
def initialize(site)
|
||||
|
||||
@@ -54,16 +54,14 @@ module Jekyll
|
||||
def read_data_file(path)
|
||||
case File.extname(path).downcase
|
||||
when ".csv"
|
||||
CSV.read(path, {
|
||||
:headers => true,
|
||||
:encoding => site.config["encoding"],
|
||||
}).map(&:to_hash)
|
||||
CSV.read(path,
|
||||
:headers => true,
|
||||
:encoding => site.config["encoding"]).map(&:to_hash)
|
||||
when ".tsv"
|
||||
CSV.read(path, {
|
||||
:col_sep => "\t",
|
||||
:headers => true,
|
||||
:encoding => site.config["encoding"],
|
||||
}).map(&:to_hash)
|
||||
CSV.read(path,
|
||||
:col_sep => "\t",
|
||||
:headers => true,
|
||||
:encoding => site.config["encoding"]).map(&:to_hash)
|
||||
else
|
||||
SafeYAML.load_file(path)
|
||||
end
|
||||
|
||||
@@ -63,9 +63,7 @@ module Jekyll
|
||||
|
||||
def layout_directory_in_cwd
|
||||
dir = Jekyll.sanitized_path(Dir.pwd, site.config["layouts_dir"])
|
||||
if File.directory?(dir) && !site.safe
|
||||
dir
|
||||
end
|
||||
dir if File.directory?(dir) && !site.safe
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -17,9 +17,11 @@ module Jekyll
|
||||
# Returns an array of static pages.
|
||||
def read(files)
|
||||
files.map do |page|
|
||||
@unfiltered_content << Page.new(@site, @site.source, @dir, page)
|
||||
end
|
||||
@unfiltered_content.select { |page| site.publisher.publish?(page) }
|
||||
path = File.join @site.source, @dir, page
|
||||
doc = Page.new(path, :collection => site.pages, :site => site)
|
||||
doc.read
|
||||
doc if site.publisher.publish?(doc)
|
||||
end.compact
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -62,10 +62,9 @@ module Jekyll
|
||||
@site.reader.get_entries(dir, magic_dir).map do |entry|
|
||||
next unless entry =~ matcher
|
||||
path = @site.in_source_dir(File.join(dir, magic_dir, entry))
|
||||
Document.new(path, {
|
||||
:site => @site,
|
||||
:collection => @site.posts,
|
||||
})
|
||||
Document.new(path,
|
||||
:site => @site,
|
||||
:collection => @site.posts)
|
||||
end.reject(&:nil?)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -8,7 +8,7 @@ module Jekyll
|
||||
end
|
||||
|
||||
def read
|
||||
return unless site.theme && site.theme.assets_path
|
||||
return unless site.theme&.assets_path
|
||||
|
||||
Find.find(site.theme.assets_path) do |path|
|
||||
next if File.directory?(path)
|
||||
@@ -21,6 +21,7 @@ module Jekyll
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def read_theme_asset(path)
|
||||
base = site.theme.root
|
||||
dir = File.dirname(path.sub("#{site.theme.root}/", ""))
|
||||
@@ -28,18 +29,18 @@ module Jekyll
|
||||
|
||||
if Utils.has_yaml_header?(path)
|
||||
append_unless_exists site.pages,
|
||||
Jekyll::Page.new(site, base, dir, name)
|
||||
Jekyll::Page.new(site, base, dir, name)
|
||||
else
|
||||
append_unless_exists site.static_files,
|
||||
Jekyll::StaticFile.new(site, base, "/#{dir}", name)
|
||||
Jekyll::StaticFile.new(site, base, "/#{dir}", name)
|
||||
end
|
||||
end
|
||||
|
||||
def append_unless_exists(haystack, new_item)
|
||||
if haystack.any? { |file| file.relative_path == new_item.relative_path }
|
||||
Jekyll.logger.debug "Theme:",
|
||||
"Ignoring #{new_item.relative_path} in theme due to existing file " \
|
||||
"with that path in site."
|
||||
"Ignoring #{new_item.relative_path} in theme due to existing file " \
|
||||
"with that path in site."
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
@@ -28,9 +28,7 @@ module Jekyll
|
||||
regenerate_document?(document)
|
||||
else
|
||||
source_path = document.respond_to?(:path) ? document.path : nil
|
||||
dest_path = if document.respond_to?(:destination)
|
||||
document.destination(@site.dest)
|
||||
end
|
||||
dest_path = document.destination(@site.dest) if document.respond_to?(:destination)
|
||||
source_modified_or_dest_missing?(source_path, dest_path)
|
||||
end
|
||||
end
|
||||
@@ -89,9 +87,7 @@ module Jekyll
|
||||
return true if path.nil?
|
||||
|
||||
# Check for path in cache
|
||||
if cache.key? path
|
||||
return cache[path]
|
||||
end
|
||||
return cache[path] if cache.key? path
|
||||
|
||||
if metadata[path]
|
||||
# If we have seen this file before,
|
||||
@@ -165,30 +161,25 @@ module Jekyll
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def regenerate_page?(document)
|
||||
document.asset_file? || document.data["regenerate"] ||
|
||||
source_modified_or_dest_missing?(
|
||||
site.in_source_dir(document.relative_path), document.destination(@site.dest)
|
||||
document.absolute_path, document.destination(@site.dest)
|
||||
)
|
||||
end
|
||||
|
||||
private
|
||||
def regenerate_document?(document)
|
||||
!document.write? || document.data["regenerate"] ||
|
||||
source_modified_or_dest_missing?(
|
||||
document.path, document.destination(@site.dest)
|
||||
document.absolute_path, document.destination(@site.dest)
|
||||
)
|
||||
end
|
||||
|
||||
private
|
||||
def existing_file_modified?(path)
|
||||
# If one of this file dependencies have been modified,
|
||||
# set the regeneration bit for both the dependency and the file to true
|
||||
metadata[path]["deps"].each do |dependency|
|
||||
if modified?(dependency)
|
||||
return cache[dependency] = cache[path] = true
|
||||
end
|
||||
return cache[dependency] = cache[path] = true if modified?(dependency)
|
||||
end
|
||||
|
||||
if File.exist?(path) && metadata[path]["mtime"].eql?(File.mtime(path))
|
||||
|
||||
@@ -76,7 +76,7 @@ module Jekyll
|
||||
output = document.content
|
||||
if document.render_with_liquid?
|
||||
Jekyll.logger.debug "Rendering Liquid:", document.relative_path
|
||||
output = render_liquid(output, payload, info, document.path)
|
||||
output = render_liquid(output, payload, info, document.relative_path)
|
||||
end
|
||||
|
||||
Jekyll.logger.debug "Rendering Markup:", document.relative_path
|
||||
@@ -101,8 +101,8 @@ module Jekyll
|
||||
converter.convert output
|
||||
rescue StandardError => e
|
||||
Jekyll.logger.error "Conversion error:",
|
||||
"#{converter.class} encountered an error while "\
|
||||
"converting '#{document.relative_path}':"
|
||||
"#{converter.class} encountered an error while "\
|
||||
"converting '#{document.relative_path}':"
|
||||
Jekyll.logger.error("", e.to_s)
|
||||
raise e
|
||||
end
|
||||
@@ -121,13 +121,13 @@ module Jekyll
|
||||
template = site.liquid_renderer.file(path).parse(content)
|
||||
template.warnings.each do |e|
|
||||
Jekyll.logger.warn "Liquid Warning:",
|
||||
LiquidRenderer.format_error(e, path || document.relative_path)
|
||||
LiquidRenderer.format_error(e, path || document.relative_path)
|
||||
end
|
||||
template.render!(payload, info)
|
||||
# rubocop: disable RescueException
|
||||
rescue Exception => e
|
||||
Jekyll.logger.error "Liquid Exception:",
|
||||
LiquidRenderer.format_error(e, path || document.relative_path)
|
||||
LiquidRenderer.format_error(e, path || document.relative_path)
|
||||
raise e
|
||||
end
|
||||
# rubocop: enable RescueException
|
||||
@@ -166,11 +166,12 @@ module Jekyll
|
||||
output
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# Checks if the layout specified in the document actually exists
|
||||
#
|
||||
# layout - the layout to check
|
||||
# Returns nothing
|
||||
private
|
||||
def validate_layout(layout)
|
||||
if invalid_layout?(layout)
|
||||
Jekyll.logger.warn(
|
||||
@@ -187,7 +188,6 @@ module Jekyll
|
||||
# Render layout content into document.output
|
||||
#
|
||||
# Returns String rendered content
|
||||
private
|
||||
def render_layout(output, layout, info)
|
||||
payload["content"] = output
|
||||
payload["layout"] = Utils.deep_merge_hashes(layout.data, payload["layout"] || {})
|
||||
@@ -200,11 +200,10 @@ module Jekyll
|
||||
)
|
||||
end
|
||||
|
||||
private
|
||||
def add_regenerator_dependencies(layout)
|
||||
return unless document.write?
|
||||
site.regenerator.add_dependency(
|
||||
site.in_source_dir(document.path),
|
||||
site.in_source_dir(document.relative_path),
|
||||
layout.path
|
||||
)
|
||||
end
|
||||
@@ -212,18 +211,14 @@ module Jekyll
|
||||
# Set page content to payload and assign pager if document has one.
|
||||
#
|
||||
# Returns nothing
|
||||
private
|
||||
def assign_pages!
|
||||
payload["page"] = document.to_liquid
|
||||
payload["paginator"] = if document.respond_to?(:pager)
|
||||
document.pager.to_liquid
|
||||
end
|
||||
payload["paginator"] = (document.pager.to_liquid if document.respond_to?(:pager))
|
||||
end
|
||||
|
||||
# Set related posts to payload if document is a post.
|
||||
#
|
||||
# Returns nothing
|
||||
private
|
||||
def assign_current_document!
|
||||
payload["site"].current_document = document
|
||||
end
|
||||
@@ -231,21 +226,16 @@ module Jekyll
|
||||
# Set highlighter prefix and suffix
|
||||
#
|
||||
# Returns nothing
|
||||
private
|
||||
def assign_highlighter_options!
|
||||
payload["highlighter_prefix"] = converters.first.highlighter_prefix
|
||||
payload["highlighter_suffix"] = converters.first.highlighter_suffix
|
||||
end
|
||||
|
||||
private
|
||||
def assign_layout_data!
|
||||
layout = layouts[document.data["layout"]]
|
||||
if layout
|
||||
payload["layout"] = Utils.deep_merge_hashes(layout.data, payload["layout"] || {})
|
||||
end
|
||||
payload["layout"] = Utils.deep_merge_hashes(layout.data, payload["layout"] || {}) if layout
|
||||
end
|
||||
|
||||
private
|
||||
def permalink_ext
|
||||
document_permalink = document.permalink
|
||||
if document_permalink && !document_permalink.end_with?("/")
|
||||
@@ -254,7 +244,6 @@ module Jekyll
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def converter_output_ext
|
||||
if output_exts.size == 1
|
||||
output_exts.last
|
||||
@@ -263,14 +252,12 @@ module Jekyll
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def output_exts
|
||||
@output_exts ||= converters.map do |c|
|
||||
c.output_ext(document.extname)
|
||||
end.compact
|
||||
end
|
||||
|
||||
private
|
||||
def liquid_options
|
||||
@liquid_options ||= site.config["liquid"]
|
||||
end
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
module Jekyll
|
||||
class Site
|
||||
attr_reader :source, :dest, :config
|
||||
attr_accessor :layouts, :pages, :static_files, :drafts,
|
||||
attr_accessor :layouts, :static_files, :drafts,
|
||||
:exclude, :include, :lsi, :highlighter, :permalink_style,
|
||||
:time, :future, :unpublished, :safe, :plugins, :limit_posts,
|
||||
:show_drafts, :keep_files, :baseurl, :data, :file_read_opts,
|
||||
@@ -44,8 +44,8 @@ module Jekyll
|
||||
@config = config.clone
|
||||
|
||||
%w(safe lsi highlighter baseurl exclude include future unpublished
|
||||
show_drafts limit_posts keep_files).each do |opt|
|
||||
self.send("#{opt}=", config[opt])
|
||||
show_drafts limit_posts keep_files).each do |opt|
|
||||
send("#{opt}=", config[opt])
|
||||
end
|
||||
|
||||
# keep using `gems` to avoid breaking change
|
||||
@@ -88,7 +88,6 @@ module Jekyll
|
||||
Time.now
|
||||
end
|
||||
self.layouts = {}
|
||||
self.pages = []
|
||||
self.static_files = []
|
||||
self.data = {}
|
||||
@site_data = nil
|
||||
@@ -98,9 +97,7 @@ module Jekyll
|
||||
@liquid_renderer.reset
|
||||
@site_cleaner = nil
|
||||
|
||||
if limit_posts < 0
|
||||
raise ArgumentError, "limit_posts must be a non-negative number"
|
||||
end
|
||||
raise ArgumentError, "limit_posts must be a non-negative number" if limit_posts.negative?
|
||||
|
||||
Jekyll::Hooks.trigger :site, :after_reset, self
|
||||
end
|
||||
@@ -124,7 +121,7 @@ module Jekyll
|
||||
Pathname.new(source).ascend do |path|
|
||||
if path == dest_pathname
|
||||
raise Errors::FatalException,
|
||||
"Destination directory cannot be or contain the Source directory."
|
||||
"Destination directory cannot be or contain the Source directory."
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -133,11 +130,18 @@ module Jekyll
|
||||
# If config['collections'] is set, a new instance is created
|
||||
# for each item in the collection, a new hash is returned otherwise.
|
||||
#
|
||||
# Note: For backwards compatibility, we want Pages to be the last
|
||||
# collection to render so other documents have output at render time
|
||||
#
|
||||
# Returns a Hash containing collection name-to-instance pairs.
|
||||
def collections
|
||||
@collections ||= Hash[collection_names.map do |coll|
|
||||
[coll, Jekyll::Collection.new(self, coll)]
|
||||
end]
|
||||
@collections ||= begin
|
||||
collections = Hash[collection_names.map do |coll|
|
||||
[coll, Jekyll::Collection.new(self, coll)]
|
||||
end]
|
||||
collections["pages"] = collections.delete("pages")
|
||||
collections
|
||||
end
|
||||
end
|
||||
|
||||
# The list of collection names.
|
||||
@@ -174,7 +178,7 @@ module Jekyll
|
||||
start = Time.now
|
||||
generator.generate(self)
|
||||
Jekyll.logger.debug "Generating:",
|
||||
"#{generator.class} finished in #{Time.now - start} seconds."
|
||||
"#{generator.class} finished in #{Time.now - start} seconds."
|
||||
end
|
||||
end
|
||||
|
||||
@@ -189,7 +193,6 @@ module Jekyll
|
||||
Jekyll::Hooks.trigger :site, :pre_render, self, payload
|
||||
|
||||
render_docs(payload)
|
||||
render_pages(payload)
|
||||
|
||||
Jekyll::Hooks.trigger :site, :post_render, self, payload
|
||||
end
|
||||
@@ -216,6 +219,10 @@ module Jekyll
|
||||
collections["posts"] ||= Collection.new(self, "posts")
|
||||
end
|
||||
|
||||
def pages
|
||||
collections["pages"] ||= Collection.new(self, "pages")
|
||||
end
|
||||
|
||||
# Construct a Hash of Posts indexed by the specified Post attribute.
|
||||
#
|
||||
# post_attr - The String name of the Post attribute.
|
||||
@@ -234,7 +241,7 @@ module Jekyll
|
||||
# array of posts ) then sort each array in reverse order.
|
||||
hash = Hash.new { |h, key| h[key] = [] }
|
||||
posts.docs.each do |p|
|
||||
p.data[post_attr].each { |t| hash[t] << p } if p.data[post_attr]
|
||||
p.data[post_attr]&.each { |t| hash[t] << p }
|
||||
end
|
||||
hash.each_value { |posts| posts.sort!.reverse! }
|
||||
hash
|
||||
@@ -303,10 +310,10 @@ module Jekyll
|
||||
def relative_permalinks_are_deprecated
|
||||
if config["relative_permalinks"]
|
||||
Jekyll.logger.abort_with "Since v3.0, permalinks for pages" \
|
||||
" in subfolders must be relative to the" \
|
||||
" site source directory, not the parent" \
|
||||
" directory. Check https://jekyllrb.com/docs/upgrading/"\
|
||||
" for more info."
|
||||
" in subfolders must be relative to the" \
|
||||
" site source directory, not the parent" \
|
||||
" directory. Check https://jekyllrb.com/docs/upgrading/"\
|
||||
" for more info."
|
||||
end
|
||||
end
|
||||
|
||||
@@ -327,7 +334,7 @@ module Jekyll
|
||||
end
|
||||
|
||||
def each_site_file
|
||||
%w(pages static_files docs_to_write).each do |type|
|
||||
%w(static_files docs_to_write).each do |type|
|
||||
send(type).each do |item|
|
||||
yield item
|
||||
end
|
||||
@@ -403,14 +410,15 @@ module Jekyll
|
||||
@collections_path ||= dir_str.empty? ? source : in_source_dir(dir_str)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# Limits the current posts; removes the posts which exceed the limit_posts
|
||||
#
|
||||
# Returns nothing
|
||||
private
|
||||
def limit_posts!
|
||||
if limit_posts > 0
|
||||
if limit_posts.positive?
|
||||
limit = posts.docs.length < limit_posts ? posts.docs.length : limit_posts
|
||||
self.posts.docs = posts.docs[-limit, limit]
|
||||
posts.docs = posts.docs[-limit, limit]
|
||||
end
|
||||
end
|
||||
|
||||
@@ -418,18 +426,15 @@ module Jekyll
|
||||
# already exist.
|
||||
#
|
||||
# Returns The Cleaner
|
||||
private
|
||||
def site_cleaner
|
||||
@site_cleaner ||= Cleaner.new(self)
|
||||
end
|
||||
|
||||
private
|
||||
def configure_plugins
|
||||
self.plugin_manager = Jekyll::PluginManager.new(self)
|
||||
self.plugins = plugin_manager.plugins_path
|
||||
end
|
||||
|
||||
private
|
||||
def configure_theme
|
||||
self.theme = nil
|
||||
return if config["theme"].nil?
|
||||
@@ -444,20 +449,17 @@ module Jekyll
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def configure_include_paths
|
||||
@includes_load_paths = Array(in_source_dir(config["includes_dir"].to_s))
|
||||
@includes_load_paths << theme.includes_path if theme && theme.includes_path
|
||||
@includes_load_paths << theme.includes_path if theme&.includes_path
|
||||
end
|
||||
|
||||
private
|
||||
def configure_file_read_opts
|
||||
self.file_read_opts = {}
|
||||
self.file_read_opts[:encoding] = config["encoding"] if config["encoding"]
|
||||
file_read_opts[:encoding] = config["encoding"] if config["encoding"]
|
||||
self.file_read_opts = Jekyll::Utils.merged_file_read_opts(self, {})
|
||||
end
|
||||
|
||||
private
|
||||
def render_docs(payload)
|
||||
collections.each_value do |collection|
|
||||
collection.docs.each do |document|
|
||||
@@ -466,14 +468,6 @@ module Jekyll
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def render_pages(payload)
|
||||
pages.flatten.each do |page|
|
||||
render_regenerated(page, payload)
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def render_regenerated(document, payload)
|
||||
return unless regenerator.regenerate?(document)
|
||||
document.output = Jekyll::Renderer.new(self, document, payload).run
|
||||
|
||||
@@ -133,10 +133,10 @@ module Jekyll
|
||||
@url ||= if @collection.nil?
|
||||
relative_path
|
||||
else
|
||||
::Jekyll::URL.new({
|
||||
::Jekyll::URL.new(
|
||||
:template => @collection.url_template,
|
||||
:placeholders => placeholders,
|
||||
})
|
||||
:placeholders => placeholders
|
||||
)
|
||||
end.to_s.chomp("/")
|
||||
end
|
||||
|
||||
@@ -152,6 +152,7 @@ module Jekyll
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def copy_file(dest_path)
|
||||
if @site.safe || Jekyll.env == "production"
|
||||
FileUtils.cp(path, dest_path)
|
||||
|
||||
@@ -16,9 +16,7 @@ module Jekyll
|
||||
severity ||= UNKNOWN
|
||||
@logdev = logdevice(severity)
|
||||
|
||||
if @logdev.nil? || severity < @level
|
||||
return true
|
||||
end
|
||||
return true if @logdev.nil? || severity < @level
|
||||
progname ||= @progname
|
||||
if message.nil?
|
||||
if block_given?
|
||||
|
||||
@@ -18,13 +18,13 @@ module Jekyll
|
||||
@lang = Regexp.last_match(1).downcase
|
||||
@highlight_options = parse_options(Regexp.last_match(2))
|
||||
else
|
||||
raise SyntaxError, <<-MSG
|
||||
Syntax Error in tag 'highlight' while parsing the following markup:
|
||||
raise SyntaxError, <<~MSG
|
||||
Syntax Error in tag 'highlight' while parsing the following markup:
|
||||
|
||||
#{markup}
|
||||
#{markup}
|
||||
|
||||
Valid syntax: highlight <lang> [linenos]
|
||||
MSG
|
||||
Valid syntax: highlight <lang> [linenos]
|
||||
MSG
|
||||
end
|
||||
end
|
||||
|
||||
@@ -75,7 +75,7 @@ MSG
|
||||
input.scan(OPTIONS_REGEX) do |opt|
|
||||
key, value = opt.split("=")
|
||||
# If a quoted list, convert to array
|
||||
if value && value.include?('"')
|
||||
if value&.include?('"')
|
||||
value.delete!('"')
|
||||
value = value.split
|
||||
end
|
||||
@@ -96,14 +96,14 @@ MSG
|
||||
)
|
||||
|
||||
if highlighted_code.nil?
|
||||
Jekyll.logger.error <<-MSG
|
||||
There was an error highlighting your code:
|
||||
Jekyll.logger.error <<~MSG
|
||||
There was an error highlighting your code:
|
||||
|
||||
#{code}
|
||||
#{code}
|
||||
|
||||
While attempting to convert the above code, Pygments.rb returned an unacceptable value.
|
||||
This is usually a timeout problem solved by running `jekyll build` again.
|
||||
MSG
|
||||
While attempting to convert the above code, Pygments.rb returned an unacceptable value.
|
||||
This is usually a timeout problem solved by running `jekyll build` again.
|
||||
MSG
|
||||
raise ArgumentError, "Pygments.rb returned an unacceptable value "\
|
||||
"when attempting to highlight some code."
|
||||
end
|
||||
@@ -112,7 +112,8 @@ MSG
|
||||
end
|
||||
|
||||
def render_rouge(code)
|
||||
formatter = Jekyll::Utils::Rouge.html_formatter(
|
||||
require "rouge"
|
||||
formatter = ::Rouge::Formatters::HTMLLegacy.new(
|
||||
:line_numbers => @highlight_options[:linenos],
|
||||
:wrap => false,
|
||||
:css_class => "highlight",
|
||||
|
||||
@@ -2,15 +2,6 @@
|
||||
|
||||
module Jekyll
|
||||
module Tags
|
||||
class IncludeTagError < StandardError
|
||||
attr_accessor :path
|
||||
|
||||
def initialize(msg, path)
|
||||
super(msg)
|
||||
@path = path
|
||||
end
|
||||
end
|
||||
|
||||
class IncludeTag < Liquid::Tag
|
||||
VALID_SYNTAX = %r!
|
||||
([\w-]+)\s*=\s*
|
||||
@@ -64,31 +55,31 @@ module Jekyll
|
||||
|
||||
def validate_file_name(file)
|
||||
if file =~ INVALID_SEQUENCES || file !~ VALID_FILENAME_CHARS
|
||||
raise ArgumentError, <<-MSG
|
||||
Invalid syntax for include tag. File contains invalid characters or sequences:
|
||||
raise ArgumentError, <<~MSG
|
||||
Invalid syntax for include tag. File contains invalid characters or sequences:
|
||||
|
||||
#{file}
|
||||
#{file}
|
||||
|
||||
Valid syntax:
|
||||
Valid syntax:
|
||||
|
||||
#{syntax_example}
|
||||
#{syntax_example}
|
||||
|
||||
MSG
|
||||
MSG
|
||||
end
|
||||
end
|
||||
|
||||
def validate_params
|
||||
unless @params =~ FULL_VALID_SYNTAX
|
||||
raise ArgumentError, <<-MSG
|
||||
Invalid syntax for include tag:
|
||||
raise ArgumentError, <<~MSG
|
||||
Invalid syntax for include tag:
|
||||
|
||||
#{@params}
|
||||
#{@params}
|
||||
|
||||
Valid syntax:
|
||||
Valid syntax:
|
||||
|
||||
#{syntax_example}
|
||||
#{syntax_example}
|
||||
|
||||
MSG
|
||||
MSG
|
||||
end
|
||||
end
|
||||
|
||||
@@ -147,7 +138,7 @@ MSG
|
||||
end
|
||||
|
||||
def add_include_to_dependency(site, path, context)
|
||||
if context.registers[:page] && context.registers[:page].key?("path")
|
||||
if context.registers[:page]&.key?("path")
|
||||
site.regenerator.add_dependency(
|
||||
site.in_source_dir(context.registers[:page]["path"]),
|
||||
path
|
||||
|
||||
@@ -5,7 +5,7 @@ module Jekyll
|
||||
class Link < Liquid::Tag
|
||||
class << self
|
||||
def tag_name
|
||||
self.name.split("::").last.downcase
|
||||
name.split("::").last.downcase
|
||||
end
|
||||
end
|
||||
|
||||
@@ -18,17 +18,20 @@ module Jekyll
|
||||
def render(context)
|
||||
site = context.registers[:site]
|
||||
|
||||
liquid = site.liquid_renderer.file("(jekyll:link)")
|
||||
relative_path = liquid.parse(@relative_path).render(context)
|
||||
|
||||
site.each_site_file do |item|
|
||||
return item.url if item.relative_path == @relative_path
|
||||
return item.url if item.relative_path == relative_path
|
||||
# This takes care of the case for static files that have a leading /
|
||||
return item.url if item.relative_path == "/#{@relative_path}"
|
||||
return item.url if item.relative_path == "/#{relative_path}"
|
||||
end
|
||||
|
||||
raise ArgumentError, <<-MSG
|
||||
Could not find document '#{@relative_path}' in tag '#{self.class.tag_name}'.
|
||||
raise ArgumentError, <<~MSG
|
||||
Could not find document '#{relative_path}' in tag '#{self.class.tag_name}'.
|
||||
|
||||
Make sure the document exists and the path is correct.
|
||||
MSG
|
||||
Make sure the document exists and the path is correct.
|
||||
MSG
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -13,7 +13,7 @@ module Jekyll
|
||||
all, @path, @date, @slug = *name.sub(%r!^/!, "").match(MATCHER)
|
||||
unless all
|
||||
raise Jekyll::Errors::InvalidPostNameError,
|
||||
"'#{name}' does not contain valid date and/or title."
|
||||
"'#{name}' does not contain valid date and/or title."
|
||||
end
|
||||
|
||||
escaped_slug = Regexp.escape(slug)
|
||||
@@ -22,8 +22,10 @@ module Jekyll
|
||||
end
|
||||
|
||||
def post_date
|
||||
@post_date ||= Utils.parse_date(date,
|
||||
"\"#{date}\" does not contain valid date and/or title.")
|
||||
@post_date ||= Utils.parse_date(
|
||||
date,
|
||||
"'#{date}' does not contain valid date and/or title."
|
||||
)
|
||||
end
|
||||
|
||||
def ==(other)
|
||||
@@ -38,6 +40,7 @@ module Jekyll
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# Construct the directory-aware post slug for a Jekyll::Post
|
||||
#
|
||||
# other - the Jekyll::Post
|
||||
@@ -60,13 +63,11 @@ module Jekyll
|
||||
begin
|
||||
@post = PostComparer.new(@orig_post)
|
||||
rescue StandardError => e
|
||||
raise Jekyll::Errors::PostURLError, <<-MSG
|
||||
Could not parse name of post "#{@orig_post}" in tag 'post_url'.
|
||||
|
||||
Make sure the post exists and the name is correct.
|
||||
|
||||
#{e.class}: #{e.message}
|
||||
MSG
|
||||
raise Jekyll::Errors::PostURLError, <<~MSG
|
||||
Could not parse name of post "#{@orig_post}" in tag 'post_url'.
|
||||
Make sure the post exists and the name is correct.
|
||||
#{e.class}: #{e.message}
|
||||
MSG
|
||||
end
|
||||
end
|
||||
|
||||
@@ -90,11 +91,10 @@ MSG
|
||||
return p.url
|
||||
end
|
||||
|
||||
raise Jekyll::Errors::PostURLError, <<-MSG
|
||||
Could not find post "#{@orig_post}" in tag 'post_url'.
|
||||
|
||||
Make sure the post exists and the name is correct.
|
||||
MSG
|
||||
raise Jekyll::Errors::PostURLError, <<~MSG
|
||||
Could not find post "#{@orig_post}" in tag 'post_url'.
|
||||
Make sure the post exists and the name is correct.
|
||||
MSG
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
module Jekyll
|
||||
class Theme
|
||||
extend Forwardable
|
||||
attr_reader :name
|
||||
attr_reader :name
|
||||
def_delegator :gemspec, :version, :version
|
||||
|
||||
def initialize(name)
|
||||
@@ -23,19 +23,19 @@ module Jekyll
|
||||
end
|
||||
|
||||
def includes_path
|
||||
@includes_path ||= path_for "_includes".freeze
|
||||
@includes_path ||= path_for "_includes"
|
||||
end
|
||||
|
||||
def layouts_path
|
||||
@layouts_path ||= path_for "_layouts".freeze
|
||||
@layouts_path ||= path_for "_layouts"
|
||||
end
|
||||
|
||||
def sass_path
|
||||
@sass_path ||= path_for "_sass".freeze
|
||||
@sass_path ||= path_for "_sass"
|
||||
end
|
||||
|
||||
def assets_path
|
||||
@assets_path ||= path_for "assets".freeze
|
||||
@assets_path ||= path_for "assets"
|
||||
end
|
||||
|
||||
def configure_sass
|
||||
@@ -66,7 +66,7 @@ module Jekyll
|
||||
@gemspec ||= Gem::Specification.find_by_name(name)
|
||||
rescue Gem::LoadError
|
||||
raise Jekyll::Errors::MissingDependencyException,
|
||||
"The #{name} theme could not be found."
|
||||
"The #{name} theme could not be found."
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,119 +1,121 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class Jekyll::ThemeBuilder
|
||||
SCAFFOLD_DIRECTORIES = %w(
|
||||
assets _layouts _includes _sass
|
||||
).freeze
|
||||
module Jekyll
|
||||
class ThemeBuilder
|
||||
SCAFFOLD_DIRECTORIES = %w(
|
||||
assets _layouts _includes _sass
|
||||
).freeze
|
||||
|
||||
attr_reader :name, :path, :code_of_conduct
|
||||
attr_reader :name, :path, :code_of_conduct
|
||||
|
||||
def initialize(theme_name, opts)
|
||||
@name = theme_name.to_s.tr(" ", "_").squeeze("_")
|
||||
@path = Pathname.new(File.expand_path(name, Dir.pwd))
|
||||
@code_of_conduct = !!opts["code_of_conduct"]
|
||||
end
|
||||
def initialize(theme_name, opts)
|
||||
@name = theme_name.to_s.tr(" ", "_").squeeze("_")
|
||||
@path = Pathname.new(File.expand_path(name, Dir.pwd))
|
||||
@code_of_conduct = !!opts["code_of_conduct"]
|
||||
end
|
||||
|
||||
def create!
|
||||
create_directories
|
||||
create_starter_files
|
||||
create_gemspec
|
||||
create_accessories
|
||||
initialize_git_repo
|
||||
end
|
||||
def create!
|
||||
create_directories
|
||||
create_starter_files
|
||||
create_gemspec
|
||||
create_accessories
|
||||
initialize_git_repo
|
||||
end
|
||||
|
||||
def user_name
|
||||
@user_name ||= `git config user.name`.chomp
|
||||
end
|
||||
def user_name
|
||||
@user_name ||= `git config user.name`.chomp
|
||||
end
|
||||
|
||||
def user_email
|
||||
@user_email ||= `git config user.email`.chomp
|
||||
end
|
||||
def user_email
|
||||
@user_email ||= `git config user.email`.chomp
|
||||
end
|
||||
|
||||
private
|
||||
private
|
||||
|
||||
def root
|
||||
@root ||= Pathname.new(File.expand_path("../", __dir__))
|
||||
end
|
||||
def root
|
||||
@root ||= Pathname.new(File.expand_path("../", __dir__))
|
||||
end
|
||||
|
||||
def template_file(filename)
|
||||
[
|
||||
root.join("theme_template", "#{filename}.erb"),
|
||||
root.join("theme_template", filename.to_s),
|
||||
].find(&:exist?)
|
||||
end
|
||||
def template_file(filename)
|
||||
[
|
||||
root.join("theme_template", "#{filename}.erb"),
|
||||
root.join("theme_template", filename.to_s),
|
||||
].find(&:exist?)
|
||||
end
|
||||
|
||||
def template(filename)
|
||||
erb.render(template_file(filename).read)
|
||||
end
|
||||
def template(filename)
|
||||
erb.render(template_file(filename).read)
|
||||
end
|
||||
|
||||
def erb
|
||||
@erb ||= ERBRenderer.new(self)
|
||||
end
|
||||
def erb
|
||||
@erb ||= ERBRenderer.new(self)
|
||||
end
|
||||
|
||||
def mkdir_p(directories)
|
||||
Array(directories).each do |directory|
|
||||
full_path = path.join(directory)
|
||||
def mkdir_p(directories)
|
||||
Array(directories).each do |directory|
|
||||
full_path = path.join(directory)
|
||||
Jekyll.logger.info "create", full_path.to_s
|
||||
FileUtils.mkdir_p(full_path)
|
||||
end
|
||||
end
|
||||
|
||||
def write_file(filename, contents)
|
||||
full_path = path.join(filename)
|
||||
Jekyll.logger.info "create", full_path.to_s
|
||||
FileUtils.mkdir_p(full_path)
|
||||
end
|
||||
end
|
||||
|
||||
def write_file(filename, contents)
|
||||
full_path = path.join(filename)
|
||||
Jekyll.logger.info "create", full_path.to_s
|
||||
File.write(full_path, contents)
|
||||
end
|
||||
|
||||
def create_directories
|
||||
mkdir_p(SCAFFOLD_DIRECTORIES)
|
||||
end
|
||||
|
||||
def create_starter_files
|
||||
%w(page post default).each do |layout|
|
||||
write_file("_layouts/#{layout}.html", template("_layouts/#{layout}.html"))
|
||||
end
|
||||
end
|
||||
|
||||
def create_gemspec
|
||||
write_file("Gemfile", template("Gemfile"))
|
||||
write_file("#{name}.gemspec", template("theme.gemspec"))
|
||||
end
|
||||
|
||||
def create_accessories
|
||||
accessories = %w(README.md LICENSE.txt)
|
||||
accessories << "CODE_OF_CONDUCT.md" if code_of_conduct
|
||||
accessories.each do |filename|
|
||||
write_file(filename, template(filename))
|
||||
end
|
||||
end
|
||||
|
||||
def initialize_git_repo
|
||||
Jekyll.logger.info "initialize", path.join(".git").to_s
|
||||
Dir.chdir(path.to_s) { `git init` }
|
||||
write_file(".gitignore", template("gitignore"))
|
||||
end
|
||||
|
||||
class ERBRenderer
|
||||
extend Forwardable
|
||||
|
||||
def_delegator :@theme_builder, :name, :theme_name
|
||||
def_delegator :@theme_builder, :user_name, :user_name
|
||||
def_delegator :@theme_builder, :user_email, :user_email
|
||||
|
||||
def initialize(theme_builder)
|
||||
@theme_builder = theme_builder
|
||||
File.write(full_path, contents)
|
||||
end
|
||||
|
||||
def jekyll_version_with_minor
|
||||
Jekyll::VERSION.split(".").take(2).join(".")
|
||||
def create_directories
|
||||
mkdir_p(SCAFFOLD_DIRECTORIES)
|
||||
end
|
||||
|
||||
def theme_directories
|
||||
SCAFFOLD_DIRECTORIES
|
||||
def create_starter_files
|
||||
%w(page post default).each do |layout|
|
||||
write_file("_layouts/#{layout}.html", template("_layouts/#{layout}.html"))
|
||||
end
|
||||
end
|
||||
|
||||
def render(contents)
|
||||
ERB.new(contents).result binding
|
||||
def create_gemspec
|
||||
write_file("Gemfile", template("Gemfile"))
|
||||
write_file("#{name}.gemspec", template("theme.gemspec"))
|
||||
end
|
||||
|
||||
def create_accessories
|
||||
accessories = %w(README.md LICENSE.txt)
|
||||
accessories << "CODE_OF_CONDUCT.md" if code_of_conduct
|
||||
accessories.each do |filename|
|
||||
write_file(filename, template(filename))
|
||||
end
|
||||
end
|
||||
|
||||
def initialize_git_repo
|
||||
Jekyll.logger.info "initialize", path.join(".git").to_s
|
||||
Dir.chdir(path.to_s) { `git init` }
|
||||
write_file(".gitignore", template("gitignore"))
|
||||
end
|
||||
|
||||
class ERBRenderer
|
||||
extend Forwardable
|
||||
|
||||
def_delegator :@theme_builder, :name, :theme_name
|
||||
def_delegator :@theme_builder, :user_name, :user_name
|
||||
def_delegator :@theme_builder, :user_email, :user_email
|
||||
|
||||
def initialize(theme_builder)
|
||||
@theme_builder = theme_builder
|
||||
end
|
||||
|
||||
def jekyll_version_with_minor
|
||||
Jekyll::VERSION.split(".").take(2).join(".")
|
||||
end
|
||||
|
||||
def theme_directories
|
||||
SCAFFOLD_DIRECTORIES
|
||||
end
|
||||
|
||||
def render(contents)
|
||||
ERB.new(contents).result binding
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -98,8 +98,8 @@ module Jekyll
|
||||
winner = pool.find { |key| @placeholders.key?(key) }
|
||||
if winner.nil?
|
||||
raise NoMethodError,
|
||||
"The URL template doesn't have #{pool.join(" or ")} keys. "\
|
||||
"Check your permalink template!"
|
||||
"The URL template doesn't have #{pool.join(" or ")} keys. "\
|
||||
"Check your permalink template!"
|
||||
end
|
||||
|
||||
value = @placeholders[winner]
|
||||
|
||||
@@ -7,7 +7,6 @@ module Jekyll
|
||||
autoload :Exec, "jekyll/utils/exec"
|
||||
autoload :Internet, "jekyll/utils/internet"
|
||||
autoload :Platforms, "jekyll/utils/platforms"
|
||||
autoload :Rouge, "jekyll/utils/rouge"
|
||||
autoload :ThreadEvent, "jekyll/utils/thread_event"
|
||||
autoload :WinTZ, "jekyll/utils/win_tz"
|
||||
|
||||
@@ -314,6 +313,7 @@ module Jekyll
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def merge_values(target, overwrite)
|
||||
target.merge!(overwrite) do |_key, old_val, new_val|
|
||||
if new_val.nil?
|
||||
@@ -326,14 +326,12 @@ module Jekyll
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def merge_default_proc(target, overwrite)
|
||||
if target.is_a?(Hash) && overwrite.is_a?(Hash) && target.default_proc.nil?
|
||||
target.default_proc = overwrite.default_proc
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def duplicate_frozen_values(target)
|
||||
target.each do |key, val|
|
||||
target[key] = val.dup if val.frozen? && duplicable?(val)
|
||||
@@ -344,7 +342,6 @@ module Jekyll
|
||||
#
|
||||
# See Utils#slugify for a description of the character sequence specified
|
||||
# by each mode.
|
||||
private
|
||||
def replace_character_sequence_with_hyphen(string, mode: "default")
|
||||
replaceable_char =
|
||||
case mode
|
||||
|
||||
@@ -21,7 +21,6 @@ module Jekyll
|
||||
[stdin, stdout, stderr].each(&:close)
|
||||
[process.value, out + err]
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
module Jekyll
|
||||
module Utils
|
||||
module Internet
|
||||
|
||||
# Public: Determine whether the present device has a connection to
|
||||
# the Internet. This allows plugin writers which require the outside
|
||||
# world to have a neat fallback mechanism for offline building.
|
||||
@@ -18,13 +17,13 @@ module Jekyll
|
||||
# end
|
||||
#
|
||||
# Returns true if a DNS call can successfully be made, or false if not.
|
||||
|
||||
module_function
|
||||
|
||||
def connected?
|
||||
!dns("example.com").nil?
|
||||
end
|
||||
|
||||
private
|
||||
module_function
|
||||
def dns(domain)
|
||||
require "resolv"
|
||||
Resolv::DNS.open do |resolver|
|
||||
@@ -33,7 +32,6 @@ module Jekyll
|
||||
rescue Resolv::ResolvError, Resolv::ResolvTimeout
|
||||
nil
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -31,7 +31,7 @@ module Jekyll
|
||||
# --
|
||||
|
||||
alias_method :really_windows?, \
|
||||
:vanilla_windows?
|
||||
:vanilla_windows?
|
||||
|
||||
#
|
||||
|
||||
@@ -68,6 +68,7 @@ module Jekyll
|
||||
#
|
||||
|
||||
private
|
||||
|
||||
def proc_version
|
||||
@proc_version ||= begin
|
||||
Pathutil.new(
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
Jekyll::External.require_with_graceful_fail("rouge")
|
||||
|
||||
module Jekyll
|
||||
module Utils
|
||||
module Rouge
|
||||
|
||||
def self.html_formatter(*args)
|
||||
if old_api?
|
||||
::Rouge::Formatters::HTML.new(*args)
|
||||
else
|
||||
::Rouge::Formatters::HTMLLegacy.new(*args)
|
||||
end
|
||||
end
|
||||
|
||||
def self.old_api?
|
||||
::Rouge.version.to_s < "2"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,7 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "thread"
|
||||
|
||||
module Jekyll
|
||||
module Utils
|
||||
# Based on the pattern and code from
|
||||
@@ -25,9 +23,7 @@ module Jekyll
|
||||
|
||||
def wait
|
||||
@lock.synchronize do
|
||||
unless @flag
|
||||
@cond.wait(@lock)
|
||||
end
|
||||
@cond.wait(@lock) unless @flag
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -21,7 +21,7 @@ module Jekyll
|
||||
# is denoted as:
|
||||
# EST+5 (or) EST+05:00
|
||||
# Reference: http://www.gnu.org/software/libc/manual/html_node/TZ-Variable.html
|
||||
sign = difference < 0 ? "-" : "+"
|
||||
sign = difference.negative? ? "-" : "+"
|
||||
offset = sign == "-" ? "+" : "-" unless difference.zero?
|
||||
#
|
||||
# convert the difference (in seconds) to hours, as a rational number, and perform
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jekyll
|
||||
VERSION = "3.8.3".freeze
|
||||
VERSION = "3.8.3"
|
||||
end
|
||||
|
||||
1
lib/site_template/.gitignore
vendored
1
lib/site_template/.gitignore
vendored
@@ -1,3 +1,4 @@
|
||||
_site
|
||||
.sass-cache
|
||||
.jekyll-metadata
|
||||
vendor
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
#############################################################################
|
||||
#
|
||||
# Packaging tasks for jekyll-docs
|
||||
#
|
||||
#############################################################################
|
||||
|
||||
namespace :docs do
|
||||
desc "Release #{docs_name} v#{version}"
|
||||
task :release => :build do
|
||||
unless `git branch` =~ %r!^\* master$!
|
||||
puts "You must be on the master branch to release!"
|
||||
exit!
|
||||
end
|
||||
sh "gem push pkg/#{docs_name}-#{version}.gem"
|
||||
end
|
||||
|
||||
desc "Build #{docs_name} v#{version} into pkg/"
|
||||
task :build do
|
||||
mkdir_p "pkg"
|
||||
sh "gem build #{docs_name}.gemspec"
|
||||
sh "mv #{docs_name}-#{version}.gem pkg"
|
||||
end
|
||||
end
|
||||
@@ -18,6 +18,8 @@ task :release => :build do
|
||||
sh "git push origin #{current_branch}"
|
||||
sh "git push origin v#{version}"
|
||||
sh "gem push pkg/#{name}-#{version}.gem"
|
||||
puts "Do not forget to build and release the docs gem as well."
|
||||
puts "https://github.com/jekyll/jekyll-docs#releasing"
|
||||
end
|
||||
|
||||
desc "Build #{name} v#{version} into pkg/"
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user