mirror of
https://github.com/jekyll/jekyll.git
synced 2026-04-28 03:01:03 -04:00
Compare commits
1 Commits
max-cache
...
log-cache-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ad61e41bdb |
@@ -14,10 +14,8 @@ matrix:
|
||||
include:
|
||||
- rvm: *ruby1
|
||||
env: TEST_SUITE=fmt
|
||||
name: "🤖️ Code Format"
|
||||
- rvm: *ruby1
|
||||
env: TEST_SUITE=default-site
|
||||
name: "🏠️ Default Site"
|
||||
exclude:
|
||||
- rvm: *jruby
|
||||
env: TEST_SUITE=cucumber
|
||||
@@ -54,4 +52,4 @@ after_success:
|
||||
|
||||
before_install:
|
||||
- gem update --system
|
||||
- gem install bundler --version 1.16.2
|
||||
- gem install bundler
|
||||
|
||||
@@ -34,12 +34,6 @@
|
||||
* add jekyll-xml-source (#7114)
|
||||
* Add the jekyll-firstimage filter plugin (#7127)
|
||||
* Use a real theme in the example (#7125)
|
||||
* Update docs about post creation (#7138)
|
||||
* Add DEV Community's Jekyll tag to community page (#7139)
|
||||
* Initialize upgrading doc for v4.0 (#7140)
|
||||
* Add version badge for date filters with ordinal (#7162)
|
||||
* Add closing tags for <a> (#7163)
|
||||
* Add TSV to list of supported _data files. (#7168)
|
||||
|
||||
### Minor Enhancements
|
||||
|
||||
@@ -61,8 +55,6 @@
|
||||
* Drop support for older versions of Rouge (#6978)
|
||||
* Remove support for Redcarpet (#6987)
|
||||
* Remove support for rdiscount (#6988)
|
||||
* Remove 'cache_dir' during `jekyll clean` (#7158)
|
||||
* Output Jekyll Version while debugging (#7173)
|
||||
|
||||
### Development Fixes
|
||||
|
||||
@@ -80,8 +72,6 @@
|
||||
* Example of CircleCI deployment through CircleCI v2 (#7024)
|
||||
* Fix Rubocop offences in test files (#7128)
|
||||
* fix up refute_equal call (#7133)
|
||||
* Fix incorrectly passed arguments to assert_equal (#7134)
|
||||
* Lock Travis to Bundler-1.16.2 (#7144)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
@@ -90,7 +80,6 @@
|
||||
### feature
|
||||
|
||||
* Disable Liquid via front matter (#6824)
|
||||
* Do not process Liquid in post excerpt when disabled in front matter (#7146)
|
||||
|
||||
## 3.8.3 / 2018-06-05
|
||||
|
||||
|
||||
@@ -3,11 +3,9 @@
|
||||
[][ruby-gems]
|
||||
[][travis]
|
||||
[][appveyor]
|
||||
[][codeclimate]
|
||||
[][coverage]
|
||||
[](codeclimate)
|
||||
[](coverage)
|
||||
[][hakiri]
|
||||
[](#backers)
|
||||
[](#sponsors)
|
||||
|
||||
[ruby-gems]: https://rubygems.org/gems/jekyll
|
||||
[codeclimate]: https://codeclimate.com/github/jekyll/jekyll
|
||||
@@ -56,28 +54,6 @@ these terms, please let one of our [core team members](https://jekyllrb.com/team
|
||||
* Use the built-in [Liquid Extensions](https://jekyllrb.com/docs/templates/) to make your life easier
|
||||
* Use custom [Plugins](https://jekyllrb.com/docs/plugins/) to generate content specific to your site
|
||||
|
||||
## Credits
|
||||
|
||||
### Contributors
|
||||
|
||||
This project exists thanks to all the people who contribute.
|
||||
<a href="graphs/contributors"><img src="https://opencollective.com/jekyll/contributors.svg?width=890&button=false" /></a>
|
||||
|
||||
### Backers
|
||||
|
||||
Thank you to all our backers! 🙏 [Become a backer](https://opencollective.com/jekyll#backer)
|
||||
|
||||
<a href="https://opencollective.com/jekyll#backers" target="_blank"><img src="https://opencollective.com/jekyll/backers.svg?width=890" /></a>
|
||||
|
||||
### Sponsors
|
||||
|
||||
Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor!](https://opencollective.com/jekyll#sponsor)
|
||||
|
||||
<a href="https://opencollective.com/jekyll/sponsor/0/website" target="_blank"><img src="https://opencollective.com/jekyll/sponsor/0/avatar.svg" /></a>
|
||||
<a href="https://opencollective.com/jekyll/sponsor/1/website" target="_blank"><img src="https://opencollective.com/jekyll/sponsor/1/avatar.svg" /></a>
|
||||
<a href="https://opencollective.com/jekyll/sponsor/2/website" target="_blank"><img src="https://opencollective.com/jekyll/sponsor/2/avatar.svg" /></a>
|
||||
|
||||
|
||||
## License
|
||||
|
||||
See the [LICENSE](https://github.com/jekyll/jekyll/blob/master/LICENSE) file.
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
- name: Forestry.io
|
||||
image: /img/forestry-logo.png
|
||||
url: https://forestry.io
|
||||
width: 140
|
||||
height: 30
|
||||
- name: CloudCannon
|
||||
image: /img/cloudcannon-logo.png
|
||||
url: https://cloudcannon.com
|
||||
width: 75
|
||||
height: 30
|
||||
- name: Siteleaf
|
||||
image: /img/siteleaf-logo.png
|
||||
url: https://siteleaf.com
|
||||
width: 40
|
||||
height: 50
|
||||
@@ -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.
|
||||
|
||||
@@ -86,7 +86,6 @@ For example, suppose you have a special image syntax with complex formatting, an
|
||||
<a href="http://jekyllrb.com">
|
||||
<img src="logo.png" style="max-width: 200px;"
|
||||
alt="Jekyll logo" />
|
||||
</a>
|
||||
<figcaption>This is the Jekyll logo</figcaption>
|
||||
</figure>
|
||||
```
|
||||
@@ -99,7 +98,6 @@ You could templatize this content in your include and make each value available
|
||||
<a href="{{ include.url }}">
|
||||
<img src="{{ include.file }}" style="max-width: {{ include.max-width }};"
|
||||
alt="{{ include.alt }}"/>
|
||||
</a>
|
||||
<figcaption>{{ include.caption }}</figcaption>
|
||||
</figure>
|
||||
```
|
||||
|
||||
@@ -137,9 +137,9 @@ An overview of what each of these does:
|
||||
<p>
|
||||
Well-formatted site data should be placed here. The Jekyll engine
|
||||
will autoload all data files (using either the <code>.yml</code>,
|
||||
<code>.yaml</code>, <code>.json</code>, <code>.csv</code> or
|
||||
<code>.tsv</code> formats and extensions) in this directory,
|
||||
and they will be accessible via `site.data`. If there's a file
|
||||
<code>.yaml</code>, <code>.json</code> or <code>.csv</code>
|
||||
formats and extensions) in this directory, and they will be
|
||||
accessible via `site.data`. If there's a file
|
||||
<code>members.yml</code> under the directory, then you can access
|
||||
contents of the file through <code>site.data.members</code>.
|
||||
</p>
|
||||
|
||||
@@ -94,8 +94,7 @@ you come up with your own tags via plugins.
|
||||
<tr>
|
||||
<td>
|
||||
<p class="name"><strong>Date to String in ordinal US style</strong></p>
|
||||
<p>Format a date to ordinal, US, short format.
|
||||
{% include docs_version_badge.html version="3.8.0" %}</p>
|
||||
<p>Format a date to ordinal, US, short format.</p>
|
||||
</td>
|
||||
<td class="align-center">
|
||||
<p>
|
||||
@@ -123,8 +122,7 @@ you come up with your own tags via plugins.
|
||||
<tr>
|
||||
<td>
|
||||
<p class="name"><strong>Date to Long String in ordinal UK style</strong></p>
|
||||
<p>Format a date to ordinal, UK, long format.
|
||||
{% include docs_version_badge.html version="3.8.0" %}</p>
|
||||
<p>Format a date to ordinal, UK, long format.</p>
|
||||
</td>
|
||||
<td class="align-center">
|
||||
<p>
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
---
|
||||
title: Upgrading from 3.x to 4.x
|
||||
permalink: /docs/upgrading/3-to-4/
|
||||
---
|
||||
|
||||
Upgrading from an older version of Jekyll? A few things have changed in Jekyll 4
|
||||
that you'll want to know about.
|
||||
|
||||
Before we dive in, you need to have at least Ruby 2.3.0 installed. Run the following
|
||||
in your terminal to check
|
||||
|
||||
```sh
|
||||
ruby -v
|
||||
```
|
||||
|
||||
If you're using Ruby >= 2.3.0, go ahead and fetch the latest version of Jekyll:
|
||||
|
||||
```sh
|
||||
gem update jekyll
|
||||
```
|
||||
|
||||
|
||||
### Template rendering
|
||||
|
||||
We've slightly altered the way Jekyll parses and renders your various templates to improve
|
||||
the overall build times. Jekyll now parses a template once, caches it internally and then
|
||||
renders the parsed template multiple times as required by your pages and documents.
|
||||
|
||||
The downside to this is that some of the community-authored plugins may not work as they
|
||||
previously used to.
|
||||
|
||||
#### For Plugin-authors
|
||||
|
||||
* If your plugin depends on the following code: `site.liquid_renderer.file(path).parse(content)`,
|
||||
note that the return value (`template`, an instance of *`Liquid::Template`*), from that line will
|
||||
always be the **same object** for a given `path`. <br/>
|
||||
The *`template`* instance is then rendered as previously, with respect to the `payload` passed to it.
|
||||
You'll therefore have to ensure that *`payload`* is not memoized or cached in your plugin instance.
|
||||
|
||||
* If its a requirement that `template` you get from the above step *be different* at all times,
|
||||
you can invoke *`Liquid::Template`* directly:
|
||||
|
||||
|
||||
```diff
|
||||
- template = site.liquid_renderer.file(path).parse(content)
|
||||
+ template = Liquid::Template.parse(content)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
*Did we miss something? Please click "Improve this page" above and add a section. Thanks!*
|
||||
@@ -11,15 +11,5 @@
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
<div class="unit two-thirds align-right center-on-mobiles">
|
||||
<p>
|
||||
Sponsored by
|
||||
{% for sponsor in site.data.sponsors %}
|
||||
<a href="{{ sponsor.url }}" style="margin-left: 10px;">
|
||||
<img src="{{ sponsor.image }}" height="{{ sponsor.height }}" width="{{ sponsor.width }}" alt="{{ sponsor.name }}">
|
||||
</a>
|
||||
{% endfor %}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
---
|
||||
title: "Sponsoring Jekyll's development"
|
||||
date: 2018-08-01 15:00:00 +0200
|
||||
author: oe
|
||||
categories: [community]
|
||||
---
|
||||
|
||||
_(TL;DR: We're open for sponsorships on our [OpenCollective page](https://opencollective.com/jekyll))_
|
||||
|
||||
Hi Jekyllers,
|
||||
|
||||
As you may know, Jekyll is a completely free and open source project. We offer our
|
||||
software and its related plugins and documentation at no cost because we believe
|
||||
that good software should not cost anything. We're not planning on changing that,
|
||||
but today I want to talk about a different monetary aspect of open source.
|
||||
|
||||
Open source developers being paid for the work they do is a rare sight. Most open source
|
||||
software is effectively the result of hundreds and thousands of hours of free labor provided
|
||||
by individuals who are passionate enough to work outside of their day job to create
|
||||
software that, ironically, is being used by almost every company that offers
|
||||
digital services. It's a problem that has gotten more attention in recent years, with
|
||||
the open source community becoming more diverse and more and more companies actively
|
||||
investing in providing monetary support for open source developers.
|
||||
|
||||
Jekyll has always been a product of volunteers. Rarely has someone been paid to implement
|
||||
a certain plugin or feature. Today, we're excited to announce that we will finally
|
||||
be able to fund our contributors! __We are opening an OpenCollective to receive
|
||||
individual and corporate sponsorships__. This is not unheard of, [Hugo](http://gohugo.io)
|
||||
is also funded by sponsorships, as are many other similar projects, such as
|
||||
[webpack](https://opencollective.com/webpack), [Babel](https://opencollective.com/babel) or
|
||||
[RuboCop](https://opencollective.com/rubocop).
|
||||
|
||||
OpenCollective is a service that makes it easy for open source projects to receive funding
|
||||
from individuals and companies alike. It's specifically designed for open source and
|
||||
many other projects already use it for funding.
|
||||
|
||||
Sponsoring is, for us, a method to finally realize some of the more ambitious goals we've had
|
||||
with the project for years. The closest thing we want to realize is to __release Jekyll 4.0, and
|
||||
to make it as polished as we can__. In the future, we would also like to work on other things that
|
||||
will improve the Jekyll ecosystem. Here's a couple of ideas:
|
||||
|
||||
- Create a comprehensive official plugin and theme directory site
|
||||
- Improve tooling built around measuring and improving Jekyll's performance
|
||||
- Improve maintenance for official plugins
|
||||
- Including the community into official decisions; making Jekyll more friendly to folks in the community
|
||||
|
||||
Again, these are just some ideas, but with the help of sponsoring, they are now one step closer
|
||||
to being realized :heart:
|
||||
|
||||
<div align="center">
|
||||
<img src="/img/forestry-logo.png" width="300" />
|
||||
</div>
|
||||
|
||||
With that, we would like to announce our very first sponsor: [__Forestry.io__](https://forestry.io)! Forestry is
|
||||
a CMS that integrates with your Jekyll sites and lets you update content using a beautiful
|
||||
interface, and then automatically commits it back to your GitHub repository. We're excited to have
|
||||
them on board on a new, exciting step of our journey.
|
||||
|
||||
Will anything change for Jekyll users? The answer is no - this step does not impact the Jekyll software
|
||||
in any aspect. In fact, you might see positive changes, such as more features and better
|
||||
performance. Surprisingly, that's what happens when you properly fund people for their work!
|
||||
|
||||
If you have been a long time user for Jekyll and would like to give something back to the project,
|
||||
you can consider a small monthly donation to our [OpenCollective page](http://opencollective.com/jekyll).
|
||||
If your company heavily relies on Jekyll, do consider sponsoring us! Contact me at
|
||||
`olivia at fastmail dot com` and we'll figure something out together.
|
||||
|
||||
Thanks for sticking with us, and happy Jekylling! :tada:
|
||||
@@ -224,7 +224,8 @@ footer {
|
||||
|
||||
img {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
position: relative;
|
||||
top: 8px;
|
||||
margin-left: 5px;
|
||||
opacity: .8;
|
||||
padding: 1px;
|
||||
|
||||
@@ -26,10 +26,6 @@ question!
|
||||
Get live support at **#jekyll** on **irc.freenode.net**, the official
|
||||
Jekyll IRC channel.
|
||||
|
||||
### [The Dev community](https://dev.to/)
|
||||
|
||||
[DEV’s jekyll tag](https://dev.to/t/jekyll) is a place to share Jekyll projects, articles and tutorials as well as start discussions and ask for feedback on Jekyll-related topics. Developers of all skill-levels are welcome to take part.
|
||||
|
||||
### View source
|
||||
|
||||
Learn from the source of others, you'll find plenty of [jekyll sites](https://github.com/topics/jekyll-site) and [jekyll themes](https://github.com/topics/jekyll-themes) carefully handcrafted on GitHub.
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 18 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 25 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 11 KiB |
@@ -70,21 +70,3 @@ Feature: Post excerpts
|
||||
And the "_site/2007/12/31/entry1.html" file should exist
|
||||
And I should see "<p>content for entry1.</p>" in "_site/index.html"
|
||||
And I should see "<html><head></head><body><p>content for entry1.</p>\n</body></html>" in "_site/2007/12/31/entry1.html"
|
||||
|
||||
Scenario: Excerpts from posts having 'render_with_liquid' in their front matter
|
||||
Given I have an "index.html" page that contains "{% for post in site.posts %}{{ post.excerpt }}{% endfor %}"
|
||||
And I have a _posts directory
|
||||
And I have a _layouts directory
|
||||
And I have a post layout that contains "{{ page.excerpt }}"
|
||||
And I have the following posts:
|
||||
| title | layout | render_with_liquid | date | content |
|
||||
| Unrendered Post | post | false | 2017-07-06 | Liquid is not rendered at {{ page.url }} |
|
||||
| Rendered Post | post | true | 2017-07-06 | Liquid is rendered at {{ page.url }} |
|
||||
When I run jekyll build
|
||||
Then I should get a zero exit status
|
||||
And the _site/2017/07/06 directory should exist
|
||||
And the "_site/2017/07/06/unrendered-post.html" file should exist
|
||||
And the "_site/2017/07/06/rendered-post.html" file should exist
|
||||
And I should see "Liquid is not rendered at {{ page.url }}" in "_site/2017/07/06/unrendered-post.html"
|
||||
But I should see "<p>Liquid is rendered at /2017/07/06/rendered-post.html</p>" in "_site/2017/07/06/rendered-post.html"
|
||||
And I should see "<p>Liquid is not rendered at {{ page.url }}</p>\n<p>Liquid is rendered at /2017/07/06/rendered-post.html</p>" in "_site/index.html"
|
||||
|
||||
@@ -54,7 +54,6 @@ module Jekyll
|
||||
autoload :FrontmatterDefaults, "jekyll/frontmatter_defaults"
|
||||
autoload :Hooks, "jekyll/hooks"
|
||||
autoload :Layout, "jekyll/layout"
|
||||
autoload :Cache, "jekyll/cache"
|
||||
autoload :CollectionReader, "jekyll/readers/collection_reader"
|
||||
autoload :DataReader, "jekyll/readers/data_reader"
|
||||
autoload :LayoutReader, "jekyll/readers/layout_reader"
|
||||
|
||||
@@ -1,127 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "digest"
|
||||
require "fileutils"
|
||||
require "pstore"
|
||||
|
||||
module Jekyll
|
||||
class Cache
|
||||
extend Forwardable
|
||||
|
||||
# Get an existing named cache, or create a new one if none exists
|
||||
#
|
||||
# name - name of the cache
|
||||
#
|
||||
# Returns nothing.
|
||||
# rubocop:disable Style/ClassVars
|
||||
def initialize(name)
|
||||
@@base_dir ||= File.expand_path(".jekyll-cache/Jekyll/Cache")
|
||||
@@caches ||= {}
|
||||
@cache = @@caches[name] ||= {}
|
||||
@name = name
|
||||
FileUtils.mkdir_p(path_to)
|
||||
end
|
||||
|
||||
def self.clear
|
||||
delete_cache_files
|
||||
@@caches.each_value(&:clear)
|
||||
end
|
||||
# rubocop:enable Style/ClassVars
|
||||
|
||||
def clear
|
||||
delete_cache_files
|
||||
@cache.clear
|
||||
end
|
||||
|
||||
def [](key)
|
||||
return @cache[key] if @cache.key?(key)
|
||||
path = path_to(hash(key))
|
||||
if File.file?(path) && File.readable?(path)
|
||||
@cache[key] = load(path)
|
||||
else
|
||||
raise
|
||||
end
|
||||
end
|
||||
|
||||
def getset(key)
|
||||
return @cache[key] if @cache.key?(key)
|
||||
path = path_to(hash(key))
|
||||
if File.file?(path) && File.readable?(path)
|
||||
value = load(path)
|
||||
else
|
||||
value = yield
|
||||
dump(path, value)
|
||||
end
|
||||
@cache[key] = value
|
||||
end
|
||||
|
||||
def []=(key, value)
|
||||
@cache[key] = value
|
||||
path = path_to(hash(key))
|
||||
dump(path, value)
|
||||
end
|
||||
|
||||
def delete(key)
|
||||
@cache.delete(key)
|
||||
path = path_to(hash(key))
|
||||
File.delete(path)
|
||||
end
|
||||
|
||||
def key?(key)
|
||||
return true if @cache.key?(key)
|
||||
path = path_to(hash(key))
|
||||
File.file?(path) && File.readable?(path)
|
||||
end
|
||||
|
||||
# rubocop:disable Style/ClassVars
|
||||
def self.clear_if_config_changed(config)
|
||||
config = config.inspect
|
||||
cache = Jekyll::Cache.new "Jekyll::Cache"
|
||||
unless cache.key?("config") && cache["config"] == config
|
||||
delete_cache_files
|
||||
@@caches = {}
|
||||
cache = Jekyll::Cache.new "Jekyll::Cache"
|
||||
cache["config"] = config
|
||||
end
|
||||
end
|
||||
# rubocop:enable Style/ClassVars
|
||||
|
||||
private
|
||||
|
||||
def path_to(hash = nil)
|
||||
@base_dir ||= File.join(@@base_dir, @name)
|
||||
return @base_dir if hash.nil?
|
||||
File.join(@base_dir, hash[0..1], hash[2..-1]).freeze
|
||||
end
|
||||
|
||||
def hash(key)
|
||||
Digest::SHA2.hexdigest(key).freeze
|
||||
end
|
||||
|
||||
def delete_cache_files
|
||||
FileUtils.rm_rf(path_to)
|
||||
end
|
||||
|
||||
# rubocop:disable Security/MarshalLoad
|
||||
def load(path)
|
||||
cached_file = File.open(path, "rb")
|
||||
value = Marshal.load(cached_file)
|
||||
cached_file.close
|
||||
value
|
||||
end
|
||||
# rubocop:enable Security/MarshalLoad
|
||||
|
||||
def dump(path, value)
|
||||
dir, _file = File.split(path)
|
||||
FileUtils.mkdir_p(dir)
|
||||
cached_file = File.open(path, "wb")
|
||||
Marshal.dump(value, cached_file)
|
||||
cached_file.close
|
||||
end
|
||||
|
||||
def self.delete_cache_files
|
||||
FileUtils.rm_rf(@@base_dir)
|
||||
end
|
||||
private_class_method :delete_cache_files
|
||||
end
|
||||
end
|
||||
@@ -22,12 +22,10 @@ module Jekyll
|
||||
options = configuration_from_options(options)
|
||||
destination = options["destination"]
|
||||
metadata_file = File.join(options["source"], ".jekyll-metadata")
|
||||
cache_dir = File.join(options["source"], options["cache_dir"])
|
||||
sass_cache = ".sass-cache"
|
||||
|
||||
remove(destination, :checker_func => :directory?)
|
||||
remove(metadata_file, :checker_func => :file?)
|
||||
remove(cache_dir, :checker_func => :directory?)
|
||||
remove(sass_cache, :checker_func => :directory?)
|
||||
end
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ module Jekyll
|
||||
"source" => Dir.pwd,
|
||||
"destination" => File.join(Dir.pwd, "_site"),
|
||||
"collections_dir" => "",
|
||||
"cache_dir" => ".jekyll-cache",
|
||||
"plugins_dir" => "_plugins",
|
||||
"layouts_dir" => "_layouts",
|
||||
"data_dir" => "_data",
|
||||
|
||||
@@ -19,8 +19,6 @@ module Jekyll
|
||||
raise Errors::FatalException, "Bailing out; invalid Markdown processor."
|
||||
end
|
||||
|
||||
@cache = Jekyll::Cache.new("Jekyll::Converters::Markdown")
|
||||
|
||||
@setup = true
|
||||
end
|
||||
|
||||
@@ -72,9 +70,7 @@ module Jekyll
|
||||
|
||||
def convert(content)
|
||||
setup
|
||||
@cache.getset(content) do
|
||||
@parser.convert(content)
|
||||
end
|
||||
@parser.convert(content)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -89,7 +89,6 @@ module Jekyll
|
||||
end
|
||||
|
||||
def render_with_liquid?
|
||||
return false if data["render_with_liquid"] == false
|
||||
!(coffeescript_file? || yaml_file? || !Utils.has_liquid_construct?(content))
|
||||
end
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ module Jekyll
|
||||
private
|
||||
|
||||
def filename_regex
|
||||
@filename_regex ||= %r!\A(#{source_dir}/|#{theme_dir}/|/*)(.*)!i
|
||||
@filename_regex ||= %r!\A(#{source_dir}/|#{theme_dir}/|\W*)(.*)!i
|
||||
end
|
||||
|
||||
def new_profile_hash
|
||||
|
||||
@@ -10,9 +10,7 @@ module Jekyll
|
||||
|
||||
def parse(content)
|
||||
measure_time do
|
||||
@template = Jekyll::Cache.new("Jekyll::LiquidRenderer::File").getset(content) do
|
||||
Liquid::Template.parse(content, :line_numbers => true)
|
||||
end
|
||||
@template = Liquid::Template.parse(content, :line_numbers => true)
|
||||
end
|
||||
|
||||
self
|
||||
@@ -26,7 +24,6 @@ module Jekyll
|
||||
end
|
||||
end
|
||||
|
||||
# This method simply 'rethrows any error' before attempting to render the template.
|
||||
def render!(*args)
|
||||
measure_time do
|
||||
measure_bytes do
|
||||
|
||||
@@ -43,7 +43,6 @@ module Jekyll
|
||||
self.log_level = :debug
|
||||
end
|
||||
debug "Logging at level:", LOG_LEVELS.key(writer.level).to_s
|
||||
debug "Jekyll Version:", Jekyll::VERSION
|
||||
end
|
||||
|
||||
# Public: Print a debug message
|
||||
|
||||
@@ -100,7 +100,6 @@ module Jekyll
|
||||
|
||||
raise ArgumentError, "limit_posts must be a non-negative number" if limit_posts.negative?
|
||||
|
||||
Jekyll::Cache.clear_if_config_changed config
|
||||
Jekyll::Hooks.trigger :site, :after_reset, self
|
||||
end
|
||||
|
||||
|
||||
@@ -31,25 +31,22 @@ module Jekyll
|
||||
def render(context)
|
||||
prefix = context["highlighter_prefix"] || ""
|
||||
suffix = context["highlighter_suffix"] || ""
|
||||
key = super.to_s
|
||||
cache.getset(key) do
|
||||
code = key.gsub(%r!\A(\n|\r)+|(\n|\r)+\z!, "")
|
||||
code = super.to_s.gsub(%r!\A(\n|\r)+|(\n|\r)+\z!, "")
|
||||
|
||||
is_safe = !!context.registers[:site].safe
|
||||
is_safe = !!context.registers[:site].safe
|
||||
|
||||
output =
|
||||
case context.registers[:site].highlighter
|
||||
when "pygments"
|
||||
render_pygments(code, is_safe)
|
||||
when "rouge"
|
||||
render_rouge(code)
|
||||
else
|
||||
render_codehighlighter(code)
|
||||
end
|
||||
output =
|
||||
case context.registers[:site].highlighter
|
||||
when "pygments"
|
||||
render_pygments(code, is_safe)
|
||||
when "rouge"
|
||||
render_rouge(code)
|
||||
else
|
||||
render_codehighlighter(code)
|
||||
end
|
||||
|
||||
rendered_output = add_code_tag(output)
|
||||
prefix + rendered_output + suffix
|
||||
end
|
||||
rendered_output = add_code_tag(output)
|
||||
prefix + rendered_output + suffix
|
||||
end
|
||||
|
||||
def sanitized_opts(opts, is_safe)
|
||||
@@ -70,10 +67,6 @@ module Jekyll
|
||||
|
||||
OPTIONS_REGEX = %r!(?:\w="[^"]*"|\w=\w|\w)+!
|
||||
|
||||
def cache
|
||||
Jekyll::Cache.new("Jekyll::Tags::HighlightBlock")
|
||||
end
|
||||
|
||||
def parse_options(input)
|
||||
options = {}
|
||||
return options if input.empty?
|
||||
|
||||
@@ -90,7 +90,13 @@ module Jekyll
|
||||
|
||||
# Render the variable if required
|
||||
def render_variable(context)
|
||||
Liquid::Template.parse(@file).render(context) if @file =~ VARIABLE_SYNTAX
|
||||
if @file =~ VARIABLE_SYNTAX
|
||||
partial = context.registers[:site]
|
||||
.liquid_renderer
|
||||
.file("(variable)")
|
||||
.parse(@file)
|
||||
partial.render!(context)
|
||||
end
|
||||
end
|
||||
|
||||
def tag_includes_dirs(context)
|
||||
@@ -145,8 +151,10 @@ module Jekyll
|
||||
cached_partial = context.registers[:cached_partials]
|
||||
|
||||
if cached_partial.key?(path)
|
||||
Jekyll.logger.info "Include cache hit: ", path.green
|
||||
cached_partial[path]
|
||||
else
|
||||
Jekyll.logger.info "Include cache miss: ", path.yellow
|
||||
unparsed_file = context.registers[:site]
|
||||
.liquid_renderer
|
||||
.file(path)
|
||||
|
||||
@@ -17,7 +17,9 @@ module Jekyll
|
||||
|
||||
def render(context)
|
||||
site = context.registers[:site]
|
||||
relative_path = Liquid::Template.parse(@relative_path).render(context)
|
||||
|
||||
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
|
||||
|
||||
@@ -6,11 +6,7 @@ categories: jekyll update
|
||||
---
|
||||
You’ll find this post in your `_posts` directory. Go ahead and edit it and re-build the site to see your changes. You can rebuild the site in many different ways, but the most common way is to run `jekyll serve`, which launches a web server and auto-regenerates your site when a file is updated.
|
||||
|
||||
Jekyll requires blog post files to be named according to the following format:
|
||||
|
||||
`YEAR-MONTH-DAY-title.MARKUP`
|
||||
|
||||
Where `YEAR` is a four-digit number, `MONTH` and `DAY` are both two-digit numbers, and `MARKUP` is the file extension representing the format used in the file. After that, include the necessary front matter. Take a look at the source for this post to get an idea about how it works.
|
||||
To add new posts, simply add a file in the `_posts` directory that follows the convention `YYYY-MM-DD-name-of-post.ext` and includes the necessary front matter. Take a look at the source for this post to get an idea about how it works.
|
||||
|
||||
Jekyll also offers powerful support for code snippets:
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ class TestAnsi < JekyllUnitTest
|
||||
end
|
||||
|
||||
should "be able to strip colors" do
|
||||
assert_equal "hello", @subject.strip(@subject.yellow(@subject.red("hello")))
|
||||
assert_equal @subject.strip(@subject.yellow(@subject.red("hello"))), "hello"
|
||||
end
|
||||
|
||||
should "be able to detect colors" do
|
||||
|
||||
@@ -9,11 +9,11 @@ class TestCollections < JekyllUnitTest
|
||||
end
|
||||
|
||||
should "sanitize the label name" do
|
||||
assert_equal "....etcpassword", @collection.label
|
||||
assert_equal @collection.label, "....etcpassword"
|
||||
end
|
||||
|
||||
should "have a sanitized relative path name" do
|
||||
assert_equal "_....etcpassword", @collection.relative_directory
|
||||
assert_equal @collection.relative_directory, "_....etcpassword"
|
||||
end
|
||||
|
||||
should "have a sanitized full path" do
|
||||
@@ -27,11 +27,11 @@ class TestCollections < JekyllUnitTest
|
||||
end
|
||||
|
||||
should "sanitize the label name" do
|
||||
assert_equal "methods", @collection.label
|
||||
assert_equal @collection.label, "methods"
|
||||
end
|
||||
|
||||
should "have default URL template" do
|
||||
assert_equal "/:collection/:path:output_ext", @collection.url_template
|
||||
assert_equal @collection.url_template, "/:collection/:path:output_ext"
|
||||
end
|
||||
|
||||
should "contain no docs when initialized" do
|
||||
@@ -39,7 +39,7 @@ class TestCollections < JekyllUnitTest
|
||||
end
|
||||
|
||||
should "know its relative directory" do
|
||||
assert_equal "_methods", @collection.relative_directory
|
||||
assert_equal @collection.relative_directory, "_methods"
|
||||
end
|
||||
|
||||
should "know the full path to itself on the filesystem" do
|
||||
@@ -48,15 +48,15 @@ class TestCollections < JekyllUnitTest
|
||||
|
||||
context "when turned into Liquid" do
|
||||
should "have a label attribute" do
|
||||
assert_equal "methods", @collection.to_liquid["label"]
|
||||
assert_equal @collection.to_liquid["label"], "methods"
|
||||
end
|
||||
|
||||
should "have a docs attribute" do
|
||||
assert_equal [], @collection.to_liquid["docs"]
|
||||
assert_equal @collection.to_liquid["docs"], []
|
||||
end
|
||||
|
||||
should "have a files attribute" do
|
||||
assert_equal [], @collection.to_liquid["files"]
|
||||
assert_equal @collection.to_liquid["files"], []
|
||||
end
|
||||
|
||||
should "have a directory attribute" do
|
||||
@@ -64,18 +64,18 @@ class TestCollections < JekyllUnitTest
|
||||
end
|
||||
|
||||
should "have a relative_directory attribute" do
|
||||
assert_equal "_methods", @collection.to_liquid["relative_directory"]
|
||||
assert_equal @collection.to_liquid["relative_directory"], "_methods"
|
||||
end
|
||||
|
||||
should "have a output attribute" do
|
||||
assert_equal false, @collection.to_liquid["output"]
|
||||
assert_equal @collection.to_liquid["output"], false
|
||||
end
|
||||
end
|
||||
|
||||
should "know whether it should be written or not" do
|
||||
assert_equal false, @collection.write?
|
||||
assert_equal @collection.write?, false
|
||||
@collection.metadata["output"] = true
|
||||
assert_equal true, @collection.write?
|
||||
assert_equal @collection.write?, true
|
||||
@collection.metadata.delete "output"
|
||||
end
|
||||
end
|
||||
@@ -107,7 +107,7 @@ class TestCollections < JekyllUnitTest
|
||||
end
|
||||
|
||||
should "have custom URL template" do
|
||||
assert_equal "/awesome/:path/", @collection.url_template
|
||||
assert_equal @collection.url_template, "/awesome/:path/"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -174,8 +174,7 @@ class TestCollections < JekyllUnitTest
|
||||
end
|
||||
|
||||
should "extract the configuration collection information as metadata" do
|
||||
expected = { "foo" => "bar", "baz" => "whoo" }
|
||||
assert_equal expected, @collection.metadata
|
||||
assert_equal @collection.metadata, "foo" => "bar", "baz" => "whoo"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -154,7 +154,9 @@ class TestCommandsServe < JekyllUnitTest
|
||||
end
|
||||
|
||||
should "label itself" do
|
||||
assert_equal :serve, @merc.name
|
||||
assert_equal(
|
||||
@merc.name, :serve
|
||||
)
|
||||
end
|
||||
|
||||
should "have aliases" do
|
||||
@@ -267,11 +269,11 @@ class TestCommandsServe < JekyllUnitTest
|
||||
|
||||
context "verbose" do
|
||||
should "debug when verbose" do
|
||||
assert_equal 5, custom_opts("verbose" => true)[:Logger].level
|
||||
assert_equal custom_opts("verbose" => true)[:Logger].level, 5
|
||||
end
|
||||
|
||||
should "warn when not verbose" do
|
||||
assert_equal 3, custom_opts({})[:Logger].level
|
||||
assert_equal custom_opts({})[:Logger].level, 3
|
||||
end
|
||||
end
|
||||
|
||||
@@ -303,8 +305,8 @@ class TestCommandsServe < JekyllUnitTest
|
||||
)
|
||||
|
||||
assert result[:SSLEnable]
|
||||
assert_equal "c2", result[:SSLPrivateKey]
|
||||
assert_equal "c1", result[:SSLCertificate]
|
||||
assert_equal result[:SSLPrivateKey], "c2"
|
||||
assert_equal result[:SSLCertificate], "c1"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -17,7 +17,7 @@ class TestConfiguration < JekyllUnitTest
|
||||
should "merge input over defaults" do
|
||||
result = Configuration.from("source" => "blah")
|
||||
refute_equal result["source"], Configuration::DEFAULTS["source"]
|
||||
assert_equal "blah", result["source"]
|
||||
assert_equal result["source"], "blah"
|
||||
end
|
||||
|
||||
should "return a valid Configuration instance" do
|
||||
@@ -26,11 +26,13 @@ class TestConfiguration < JekyllUnitTest
|
||||
|
||||
should "add default collections" do
|
||||
result = Configuration.from({})
|
||||
expected = { "posts" => {
|
||||
"output" => true,
|
||||
"permalink" => "/:categories/:year/:month/:day/:title:output_ext",
|
||||
}, }
|
||||
assert_equal expected, result["collections"]
|
||||
assert_equal(
|
||||
result["collections"],
|
||||
"posts" => {
|
||||
"output" => true,
|
||||
"permalink" => "/:categories/:year/:month/:day/:title:output_ext",
|
||||
}
|
||||
)
|
||||
end
|
||||
|
||||
should "NOT backwards-compatibilize" do
|
||||
@@ -66,29 +68,32 @@ class TestConfiguration < JekyllUnitTest
|
||||
should "turn an array into a hash" do
|
||||
result = Configuration[{ "collections" => %w(methods) }].add_default_collections
|
||||
assert_instance_of Hash, result["collections"]
|
||||
expected = { "posts" => { "output" => true }, "methods" => {} }
|
||||
assert_equal expected, result["collections"]
|
||||
assert_equal(
|
||||
result["collections"],
|
||||
"posts" => { "output" => true }, "methods" => {}
|
||||
)
|
||||
end
|
||||
|
||||
should "only assign collections.posts.permalink if a permalink is specified" do
|
||||
result = Configuration[{ "permalink" => "pretty", "collections" => {} }]
|
||||
.add_default_collections
|
||||
expected = { "posts" => {
|
||||
"output" => true,
|
||||
"permalink" => "/:categories/:year/:month/:day/:title/",
|
||||
}, }
|
||||
assert_equal expected, result["collections"]
|
||||
assert_equal(
|
||||
result["collections"],
|
||||
"posts" => {
|
||||
"output" => true,
|
||||
"permalink" => "/:categories/:year/:month/:day/:title/",
|
||||
}
|
||||
)
|
||||
|
||||
result = Configuration[{ "permalink" => nil, "collections" => {} }]
|
||||
.add_default_collections
|
||||
expected = { "posts" => { "output" => true } }
|
||||
assert_equal expected, result["collections"]
|
||||
assert_equal result["collections"], "posts" => { "output" => true }
|
||||
end
|
||||
|
||||
should "forces posts to output" do
|
||||
result = Configuration[{ "collections" => { "posts" => { "output" => false } } }]
|
||||
.add_default_collections
|
||||
assert_equal true, result["collections"]["posts"]["output"]
|
||||
assert_equal result["collections"]["posts"]["output"], true
|
||||
end
|
||||
end
|
||||
|
||||
@@ -211,19 +216,23 @@ class TestConfiguration < JekyllUnitTest
|
||||
should "transform string exclude into an array" do
|
||||
assert @config.key?("exclude")
|
||||
assert @config.backwards_compatibilize.key?("exclude")
|
||||
expected = %w(READ-ME.md Gemfile CONTRIBUTING.hello.markdown)
|
||||
assert_equal expected, @config.backwards_compatibilize["exclude"]
|
||||
assert_equal(
|
||||
@config.backwards_compatibilize["exclude"],
|
||||
%w(READ-ME.md Gemfile CONTRIBUTING.hello.markdown)
|
||||
)
|
||||
end
|
||||
should "transform string include into an array" do
|
||||
assert @config.key?("include")
|
||||
assert @config.backwards_compatibilize.key?("include")
|
||||
expected = %w(STOP_THE_PRESSES.txt .heloses .git)
|
||||
assert_equal expected, @config.backwards_compatibilize["include"]
|
||||
assert_equal(
|
||||
@config.backwards_compatibilize["include"],
|
||||
%w(STOP_THE_PRESSES.txt .heloses .git)
|
||||
)
|
||||
end
|
||||
should "set highlighter to pygments" do
|
||||
assert @config.key?("pygments")
|
||||
assert !@config.backwards_compatibilize.key?("pygments")
|
||||
assert_equal "pygments", @config.backwards_compatibilize["highlighter"]
|
||||
assert_equal @config.backwards_compatibilize["highlighter"], "pygments"
|
||||
end
|
||||
should "adjust directory names" do
|
||||
assert @config.key?("layouts")
|
||||
@@ -491,13 +500,12 @@ class TestConfiguration < JekyllUnitTest
|
||||
)
|
||||
)
|
||||
assert_equal(
|
||||
"This string of text will ignore newlines till the next key.\n",
|
||||
config["folded_string"]
|
||||
config["folded_string"],
|
||||
"This string of text will ignore newlines till the next key.\n"
|
||||
)
|
||||
|
||||
assert_equal(
|
||||
"This string of text will ignore newlines till the next key.",
|
||||
config["clean_folded_string"]
|
||||
config["clean_folded_string"],
|
||||
"This string of text will ignore newlines till the next key."
|
||||
)
|
||||
end
|
||||
|
||||
|
||||
@@ -155,7 +155,7 @@ class TestKramdown < JekyllUnitTest
|
||||
)
|
||||
|
||||
expect(Kramdown::Document).to receive(:new) do |arg1, hash|
|
||||
assert_equal "world", hash["syntax_highlighter_opts"]["hello"]
|
||||
assert_equal hash["syntax_highlighter_opts"]["hello"], "world"
|
||||
original.call(arg1, hash)
|
||||
end
|
||||
|
||||
|
||||
@@ -22,11 +22,11 @@ class TestLiquidExtensions < JekyllUnitTest
|
||||
end
|
||||
|
||||
should "extract the var properly" do
|
||||
assert_equal "hi tobi", @template.render("page" => { "name" => "tobi" })
|
||||
assert_equal @template.render("page" => { "name" => "tobi" }), "hi tobi"
|
||||
end
|
||||
|
||||
should "return the variable name if the value isn't there" do
|
||||
assert_equal "hi page.name", @template.render("page" => { "title" => "tobi" })
|
||||
assert_equal @template.render("page" => { "title" => "tobi" }), "hi page.name"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -153,8 +153,7 @@ class TestRegenerator < JekyllUnitTest
|
||||
assert @regenerator.cache[@path]
|
||||
|
||||
@regenerator.clear_cache
|
||||
expected = {}
|
||||
assert_equal expected, @regenerator.cache
|
||||
assert_equal @regenerator.cache, {}
|
||||
end
|
||||
|
||||
should "write to the metadata file" do
|
||||
|
||||
@@ -76,9 +76,6 @@ class TestSite < JekyllUnitTest
|
||||
allow(File).to receive(:directory?).with(theme_dir("_sass")).and_return(true)
|
||||
allow(File).to receive(:directory?).with(theme_dir("_layouts")).and_return(true)
|
||||
allow(File).to receive(:directory?).with(theme_dir("_includes")).and_return(false)
|
||||
allow(File).to receive(:directory?).with(
|
||||
File.expand_path(".jekyll-cache/Jekyll/Cache/Jekyll::Cache")
|
||||
).and_return(true)
|
||||
site = fixture_site("theme" => "test-theme")
|
||||
assert_equal [source_dir("_includes")], site.includes_load_paths
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user