Compare commits

...

61 Commits

Author SHA1 Message Date
Pat Hawks
177c1ca09e Cache all the things! 2018-08-13 13:17:14 -05:00
Pat Hawks
07c5ddde4a Cache converted Markdown 2018-08-07 16:26:49 -05:00
Pat Hawks
4081044178 Cache highlights 2018-08-07 16:25:50 -05:00
Pat Hawks
139073430f Fix stupid test in a stupid way 2018-08-07 16:19:46 -05:00
Pat Hawks
575bf51fa2 Use disk for persistent cache 2018-08-07 16:19:32 -05:00
jekyllbot
4814b45847 Update history to reflect merge of #7173 [ci skip] 2018-08-06 15:02:19 -04:00
Ashwin Maroli
81392ae0ee Output Jekyll Version while debugging (#7173)
Merge pull request 7173
2018-08-06 15:02:17 -04:00
olivia
9136e9c394 add cloudcannon to site sponsors 2018-08-06 18:33:31 +02:00
Pat Hawks
62a65cd358 Always clear cache when config changes 2018-08-04 14:27:11 -05:00
Pat Hawks
3e077bba84 Use key? instead of has_key? because Rubocop 2018-08-04 14:27:10 -05:00
Pat Hawks
2b33b3df23 Add getset method 2018-08-04 14:27:10 -05:00
Pat Hawks
f7d5559f10 Add basic Cache class 2018-08-04 14:27:07 -05:00
liv
4d6edb3a26 update sponsor links 2018-08-04 19:38:08 +02:00
olivia
fb7a13ab1e add siteleaf to site sponsors 2018-08-03 13:31:41 +02:00
jekyllbot
87cc350313 Update history to reflect merge of #7168 [ci skip] 2018-08-02 15:05:10 -04:00
Ken Salomon
85be75160c Document TSV as a supported data file format (#7168)
Merge pull request 7168
2018-08-02 15:05:09 -04:00
Frank Taillandier
0ff2ef7d28 Merge pull request #7171 from ashmaroli/codeclimate-badges
Fix links in Code Climate badges
2018-08-02 20:58:26 +02:00
Ashwin Maroli
aaa723373b Fix links in Code Climate badges 2018-08-02 22:30:33 +05:30
liv
ce6173360d revert and manually use sponsor images 2018-08-02 09:24:04 +02:00
liv
b4b90a989c use the correct sponsor embed 2018-08-02 09:22:13 +02:00
liv
edbd9f3028 fix opencollective display in readme 2018-08-01 14:25:41 +02:00
liv
2eb0c5bc8d Merge pull request #7142 from monkeywithacupcake/patch-1
Display Open Collective backers and sponsors
2018-08-01 14:12:13 +02:00
liv
e51f9c346c Merge pull request #7143 from jekyll/sponsor
Prepare docs for sponsoring
2018-08-01 14:11:33 +02:00
liv
f0da10a77a update blog post date 2018-08-01 09:56:40 +02:00
jekyllbot
51629865de Update history to reflect merge of #7158 [ci skip] 2018-07-31 16:12:59 -04:00
Pat Hawks
6e980f3f6a Remove 'cache_dir' during jekyll clean (#7158)
Merge pull request 7158
2018-07-31 16:12:57 -04:00
jekyllbot
37c9347422 Update history to reflect merge of #7163 [ci skip] 2018-07-28 12:22:16 -04:00
Zhang Xiangze
0001895968 Add closing tags for <a> (#7163)
Merge pull request 7163
2018-07-28 12:22:15 -04:00
jekyllbot
d0f8c86d2f Update history to reflect merge of #7162 [ci skip] 2018-07-27 15:17:03 -04:00
Kevin Plattret
493757d7cf Add version badge for date filters with ordinal (#7162)
Merge pull request 7162
2018-07-27 15:17:00 -04:00
Ashwin Maroli
66ac9b8675 Merge 'master' into optimize-liquid-rendering 2018-07-24 23:23:16 +05:30
Pat Hawks
ef41eeb7d4 Name some of our Travis builds 2018-07-23 13:29:36 -05:00
jekyllbot
fe0a6caa7f Update history to reflect merge of #7146 [ci skip] 2018-07-20 19:22:46 -04:00
Ken Salomon
5701087e7b Do not process Liquid in post excerpt when disabled in front matter (#7146)
Merge pull request 7146
2018-07-20 19:22:44 -04:00
Ashwin Maroli
e9f78247de Merge branch 'master' into sponsor 2018-07-17 22:06:47 +05:30
jekyllbot
02a2f9460a Update history to reflect merge of #7144 [ci skip] 2018-07-17 10:42:12 -04:00
Ashwin Maroli
e61cc513e9 Lock Travis to Bundler-1.16.2 (#7144)
Merge pull request 7144
2018-07-17 10:42:10 -04:00
olivia
477dbb34f4 update with suggestions 2018-07-17 16:04:14 +02:00
olivia
f0e26e9c1a add intentions to post; change title 2018-07-17 15:58:16 +02:00
olivia
9f05275619 Merge branch 'master' into sponsor 2018-07-17 12:20:54 +02:00
olivia
89ac354d5a add blank newline 2018-07-17 12:20:09 +02:00
Ashwin Maroli
f034f624cc document change in behavior and its workaround 2018-07-17 09:58:18 +05:30
Ashwin Maroli
c58d747506 Merge branch 'master' of https://github.com/jekyll/jekyll into optimize-liquid-rendering 2018-07-17 08:50:53 +05:30
jess
5c41eb743f Update README.markdown
Hi, I'm making updates for Open Collective. Either you or a supporter signed this repo up for Open Collective. This pull request adds backers and sponsors from your Open Collective https://opencollective.com/jekyll❤️

It adds two badges at the top to show the latest number of backers and sponsors. It also adds placeholders so that the avatar/logo of new backers/sponsors can automatically be shown without having to update your README.md. [more info](https://github.com/opencollective/opencollective/wiki/Github-banner). See how it looks on this [repo](https://github.com/apex/apex#backers).

You can also add a postinstall script to let people know after npm|yarn install that you are welcoming donations (optional). [More info](https://github.com/OpenCollective/opencollective-cli)
You can also add a "Donate" button to your website and automatically show your backers and sponsors there with our widgets. Have a look here: https://opencollective.com/widgets

P.S: As with any pull request, feel free to comment or suggest changes. The only thing "required" are the placeholders on the README because we believe it's important to acknowledge the people in your community that are contributing (financially or with code!).

Thank you for your great contribution to the open source community. You are awesome! 🙌
And welcome to the open collective community! 😊

Come chat with us in the #opensource channel on https://slack.opencollective.com - great place to ask questions and share best practices with other open source sustainers!
2018-07-16 13:06:18 -07:00
jekyllbot
ad9fbeb4b1 Update history to reflect merge of #7140 [ci skip] 2018-07-16 15:04:22 -04:00
Ashwin Maroli
50e0379444 Initialize upgrading doc for v4.0 (#7140)
Merge pull request 7140
2018-07-16 15:04:19 -04:00
Frank Taillandier
c2649ce5fb Merge pull request #7141 from belhassen07/master
Add dev.to link
2018-07-16 17:14:37 +02:00
Frank Taillandier
4cfba70355 Merge branch 'master' into master 2018-07-16 17:14:22 +02:00
Belhassen Chelbi
6802ec93eb Add Dev.to website link 2018-07-16 15:13:26 +01:00
jekyllbot
707e48a412 Update history to reflect merge of #7139 [ci skip] 2018-07-16 09:58:28 -04:00
Belhassen Chelbi
ca2766c2a1 Add DEV Community's Jekyll tag to community page (#7139)
Merge pull request 7139
2018-07-16 09:58:26 -04:00
Ashwin Maroli
cf9176efba parse variables in our tags directly via Liquid 2018-07-16 14:15:35 +05:30
Ashwin Maroli
8256ff1757 cache templates parsed by Liquid 2018-07-16 14:14:58 +05:30
Belhassen Chelbi
af78a1a568 Add DEV Community's Jekyll tag to community page 2018-07-16 03:17:22 +01:00
jekyllbot
34a1b7aeef Update history to reflect merge of #7138 [ci skip] 2018-07-15 18:18:44 -04:00
104fps
b2c6d03b47 Update docs about post creation (#7138)
Merge pull request 7138
2018-07-15 18:18:43 -04:00
jekyllbot
e49f507e4f Update history to reflect merge of #7134 [ci skip] 2018-07-15 16:11:46 -04:00
Ashwin Maroli
506c764e1e fix incorrectly passed arguments to assert_equal (#7134)
Merge pull request 7134
2018-07-15 16:11:45 -04:00
olivia
2dcdc49a36 add sponsoring post 2018-06-28 19:17:50 +02:00
olivia
efb7819d2e add forestry logo 2018-06-28 17:55:29 +02:00
olivia
67331185c2 add sponsor display in website footer 2018-06-26 22:48:26 +02:00
39 changed files with 443 additions and 98 deletions

View File

@@ -14,8 +14,10 @@ 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
@@ -52,4 +54,4 @@ after_success:
before_install:
- gem update --system
- gem install bundler
- gem install bundler --version 1.16.2

View File

@@ -34,6 +34,12 @@
* 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&#39;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 &lt;a&gt; (#7163)
* Add TSV to list of supported _data files. (#7168)
### Minor Enhancements
@@ -55,6 +61,8 @@
* Drop support for older versions of Rouge (#6978)
* Remove support for Redcarpet (#6987)
* Remove support for rdiscount (#6988)
* Remove &#39;cache_dir&#39; during `jekyll clean` (#7158)
* Output Jekyll Version while debugging (#7173)
### Development Fixes
@@ -72,6 +80,8 @@
* 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
@@ -80,6 +90,7 @@
### 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

View File

@@ -3,9 +3,11 @@
[![Gem Version](https://img.shields.io/gem/v/jekyll.svg)][ruby-gems]
[![Linux Build Status](https://img.shields.io/travis/jekyll/jekyll/master.svg?label=Linux%20build)][travis]
[![Windows Build status](https://img.shields.io/appveyor/ci/jekyll/jekyll/master.svg?label=Windows%20build)][appveyor]
[![Maintainability](https://api.codeclimate.com/v1/badges/8ba0cb5b17bb9848e128/maintainability)](codeclimate)
[![Test Coverage](https://api.codeclimate.com/v1/badges/8ba0cb5b17bb9848e128/test_coverage)](coverage)
[![Maintainability](https://api.codeclimate.com/v1/badges/8ba0cb5b17bb9848e128/maintainability)][codeclimate]
[![Test Coverage](https://api.codeclimate.com/v1/badges/8ba0cb5b17bb9848e128/test_coverage)][coverage]
[![Security](https://hakiri.io/github/jekyll/jekyll/master.svg)][hakiri]
[![Backers on Open Collective](https://opencollective.com/jekyll/backers/badge.svg)](#backers)
[![Sponsors on Open Collective](https://opencollective.com/jekyll/sponsors/badge.svg)](#sponsors)
[ruby-gems]: https://rubygems.org/gems/jekyll
[codeclimate]: https://codeclimate.com/github/jekyll/jekyll
@@ -54,6 +56,28 @@ 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.

15
docs/_data/sponsors.yml Normal file
View File

@@ -0,0 +1,15 @@
- 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

View File

@@ -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 on how to improve something.
* 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.
* 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.

View File

@@ -86,6 +86,7 @@ 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>
```
@@ -98,6 +99,7 @@ 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>
```

View File

@@ -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> or <code>.csv</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>, <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>members.yml</code> under the directory, then you can access
contents of the file through <code>site.data.members</code>.
</p>

View File

@@ -94,7 +94,8 @@ 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.</p>
<p>Format a date to ordinal, US, short format.
{% include docs_version_badge.html version="3.8.0" %}</p>
</td>
<td class="align-center">
<p>
@@ -122,7 +123,8 @@ 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.</p>
<p>Format a date to ordinal, UK, long format.
{% include docs_version_badge.html version="3.8.0" %}</p>
</td>
<td class="align-center">
<p>

View File

@@ -0,0 +1,51 @@
---
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!*

View File

@@ -11,5 +11,15 @@
</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>

View File

@@ -0,0 +1,68 @@
---
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:

View File

@@ -224,8 +224,7 @@ footer {
img {
display: inline-block;
position: relative;
top: 8px;
vertical-align: middle;
margin-left: 5px;
opacity: .8;
padding: 1px;

View File

@@ -26,6 +26,10 @@ question!
Get live support at **#jekyll** on **irc.freenode.net**, the official
Jekyll IRC channel.
### [The Dev community](https://dev.to/)
[DEVs 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.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
docs/img/forestry-logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

BIN
docs/img/siteleaf-logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

@@ -70,3 +70,21 @@ 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"

View File

@@ -54,6 +54,7 @@ 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"

127
lib/jekyll/cache.rb Normal file
View File

@@ -0,0 +1,127 @@
# 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

View File

@@ -22,10 +22,12 @@ 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

View File

@@ -9,6 +9,7 @@ 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",

View File

@@ -19,6 +19,8 @@ module Jekyll
raise Errors::FatalException, "Bailing out; invalid Markdown processor."
end
@cache = Jekyll::Cache.new("Jekyll::Converters::Markdown")
@setup = true
end
@@ -70,7 +72,9 @@ module Jekyll
def convert(content)
setup
@parser.convert(content)
@cache.getset(content) do
@parser.convert(content)
end
end
private

View File

@@ -89,6 +89,7 @@ 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

View File

@@ -53,7 +53,7 @@ module Jekyll
private
def filename_regex
@filename_regex ||= %r!\A(#{source_dir}/|#{theme_dir}/|\W*)(.*)!i
@filename_regex ||= %r!\A(#{source_dir}/|#{theme_dir}/|/*)(.*)!i
end
def new_profile_hash

View File

@@ -10,7 +10,9 @@ module Jekyll
def parse(content)
measure_time do
@template = Liquid::Template.parse(content, :line_numbers => true)
@template = Jekyll::Cache.new("Jekyll::LiquidRenderer::File").getset(content) do
Liquid::Template.parse(content, :line_numbers => true)
end
end
self
@@ -24,6 +26,7 @@ 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

View File

@@ -43,6 +43,7 @@ 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

View File

@@ -100,6 +100,7 @@ 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

View File

@@ -31,22 +31,25 @@ module Jekyll
def render(context)
prefix = context["highlighter_prefix"] || ""
suffix = context["highlighter_suffix"] || ""
code = super.to_s.gsub(%r!\A(\n|\r)+|(\n|\r)+\z!, "")
key = super.to_s
cache.getset(key) do
code = key.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
rendered_output = add_code_tag(output)
prefix + rendered_output + suffix
end
end
def sanitized_opts(opts, is_safe)
@@ -67,6 +70,10 @@ 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?

View File

@@ -90,13 +90,7 @@ module Jekyll
# Render the variable if required
def render_variable(context)
if @file =~ VARIABLE_SYNTAX
partial = context.registers[:site]
.liquid_renderer
.file("(variable)")
.parse(@file)
partial.render!(context)
end
Liquid::Template.parse(@file).render(context) if @file =~ VARIABLE_SYNTAX
end
def tag_includes_dirs(context)

View File

@@ -17,9 +17,7 @@ module Jekyll
def render(context)
site = context.registers[:site]
liquid = site.liquid_renderer.file("(jekyll:link)")
relative_path = liquid.parse(@relative_path).render(context)
relative_path = Liquid::Template.parse(@relative_path).render(context)
site.each_site_file do |item|
return item.url if item.relative_path == relative_path

View File

@@ -6,7 +6,11 @@ categories: jekyll update
---
Youll 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.
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 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.
Jekyll also offers powerful support for code snippets:

View File

@@ -15,7 +15,7 @@ class TestAnsi < JekyllUnitTest
end
should "be able to strip colors" do
assert_equal @subject.strip(@subject.yellow(@subject.red("hello"))), "hello"
assert_equal "hello", @subject.strip(@subject.yellow(@subject.red("hello")))
end
should "be able to detect colors" do

View File

@@ -9,11 +9,11 @@ class TestCollections < JekyllUnitTest
end
should "sanitize the label name" do
assert_equal @collection.label, "....etcpassword"
assert_equal "....etcpassword", @collection.label
end
should "have a sanitized relative path name" do
assert_equal @collection.relative_directory, "_....etcpassword"
assert_equal "_....etcpassword", @collection.relative_directory
end
should "have a sanitized full path" do
@@ -27,11 +27,11 @@ class TestCollections < JekyllUnitTest
end
should "sanitize the label name" do
assert_equal @collection.label, "methods"
assert_equal "methods", @collection.label
end
should "have default URL template" do
assert_equal @collection.url_template, "/:collection/:path:output_ext"
assert_equal "/:collection/:path:output_ext", @collection.url_template
end
should "contain no docs when initialized" do
@@ -39,7 +39,7 @@ class TestCollections < JekyllUnitTest
end
should "know its relative directory" do
assert_equal @collection.relative_directory, "_methods"
assert_equal "_methods", @collection.relative_directory
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 @collection.to_liquid["label"], "methods"
assert_equal "methods", @collection.to_liquid["label"]
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 @collection.to_liquid["relative_directory"], "_methods"
assert_equal "_methods", @collection.to_liquid["relative_directory"]
end
should "have a output attribute" do
assert_equal @collection.to_liquid["output"], false
assert_equal false, @collection.to_liquid["output"]
end
end
should "know whether it should be written or not" do
assert_equal @collection.write?, false
assert_equal false, @collection.write?
@collection.metadata["output"] = true
assert_equal @collection.write?, true
assert_equal true, @collection.write?
@collection.metadata.delete "output"
end
end
@@ -107,7 +107,7 @@ class TestCollections < JekyllUnitTest
end
should "have custom URL template" do
assert_equal @collection.url_template, "/awesome/:path/"
assert_equal "/awesome/:path/", @collection.url_template
end
end
@@ -174,7 +174,8 @@ class TestCollections < JekyllUnitTest
end
should "extract the configuration collection information as metadata" do
assert_equal @collection.metadata, "foo" => "bar", "baz" => "whoo"
expected = { "foo" => "bar", "baz" => "whoo" }
assert_equal expected, @collection.metadata
end
end

View File

@@ -154,9 +154,7 @@ class TestCommandsServe < JekyllUnitTest
end
should "label itself" do
assert_equal(
@merc.name, :serve
)
assert_equal :serve, @merc.name
end
should "have aliases" do
@@ -269,11 +267,11 @@ class TestCommandsServe < JekyllUnitTest
context "verbose" do
should "debug when verbose" do
assert_equal custom_opts("verbose" => true)[:Logger].level, 5
assert_equal 5, custom_opts("verbose" => true)[:Logger].level
end
should "warn when not verbose" do
assert_equal custom_opts({})[:Logger].level, 3
assert_equal 3, custom_opts({})[:Logger].level
end
end
@@ -305,8 +303,8 @@ class TestCommandsServe < JekyllUnitTest
)
assert result[:SSLEnable]
assert_equal result[:SSLPrivateKey], "c2"
assert_equal result[:SSLCertificate], "c1"
assert_equal "c2", result[:SSLPrivateKey]
assert_equal "c1", result[:SSLCertificate]
end
end
end

View File

@@ -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 result["source"], "blah"
assert_equal "blah", result["source"]
end
should "return a valid Configuration instance" do
@@ -26,13 +26,11 @@ class TestConfiguration < JekyllUnitTest
should "add default collections" do
result = Configuration.from({})
assert_equal(
result["collections"],
"posts" => {
"output" => true,
"permalink" => "/:categories/:year/:month/:day/:title:output_ext",
}
)
expected = { "posts" => {
"output" => true,
"permalink" => "/:categories/:year/:month/:day/:title:output_ext",
}, }
assert_equal expected, result["collections"]
end
should "NOT backwards-compatibilize" do
@@ -68,32 +66,29 @@ 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"]
assert_equal(
result["collections"],
"posts" => { "output" => true }, "methods" => {}
)
expected = { "posts" => { "output" => true }, "methods" => {} }
assert_equal expected, result["collections"]
end
should "only assign collections.posts.permalink if a permalink is specified" do
result = Configuration[{ "permalink" => "pretty", "collections" => {} }]
.add_default_collections
assert_equal(
result["collections"],
"posts" => {
"output" => true,
"permalink" => "/:categories/:year/:month/:day/:title/",
}
)
expected = { "posts" => {
"output" => true,
"permalink" => "/:categories/:year/:month/:day/:title/",
}, }
assert_equal expected, result["collections"]
result = Configuration[{ "permalink" => nil, "collections" => {} }]
.add_default_collections
assert_equal result["collections"], "posts" => { "output" => true }
expected = { "posts" => { "output" => true } }
assert_equal expected, result["collections"]
end
should "forces posts to output" do
result = Configuration[{ "collections" => { "posts" => { "output" => false } } }]
.add_default_collections
assert_equal result["collections"]["posts"]["output"], true
assert_equal true, result["collections"]["posts"]["output"]
end
end
@@ -216,23 +211,19 @@ class TestConfiguration < JekyllUnitTest
should "transform string exclude into an array" do
assert @config.key?("exclude")
assert @config.backwards_compatibilize.key?("exclude")
assert_equal(
@config.backwards_compatibilize["exclude"],
%w(READ-ME.md Gemfile CONTRIBUTING.hello.markdown)
)
expected = %w(READ-ME.md Gemfile CONTRIBUTING.hello.markdown)
assert_equal expected, @config.backwards_compatibilize["exclude"]
end
should "transform string include into an array" do
assert @config.key?("include")
assert @config.backwards_compatibilize.key?("include")
assert_equal(
@config.backwards_compatibilize["include"],
%w(STOP_THE_PRESSES.txt .heloses .git)
)
expected = %w(STOP_THE_PRESSES.txt .heloses .git)
assert_equal expected, @config.backwards_compatibilize["include"]
end
should "set highlighter to pygments" do
assert @config.key?("pygments")
assert !@config.backwards_compatibilize.key?("pygments")
assert_equal @config.backwards_compatibilize["highlighter"], "pygments"
assert_equal "pygments", @config.backwards_compatibilize["highlighter"]
end
should "adjust directory names" do
assert @config.key?("layouts")
@@ -500,12 +491,13 @@ class TestConfiguration < JekyllUnitTest
)
)
assert_equal(
config["folded_string"],
"This string of text will ignore newlines till the next key.\n"
"This string of text will ignore newlines till the next key.\n",
config["folded_string"]
)
assert_equal(
config["clean_folded_string"],
"This string of text will ignore newlines till the next key."
"This string of text will ignore newlines till the next key.",
config["clean_folded_string"]
)
end

View File

@@ -155,7 +155,7 @@ class TestKramdown < JekyllUnitTest
)
expect(Kramdown::Document).to receive(:new) do |arg1, hash|
assert_equal hash["syntax_highlighter_opts"]["hello"], "world"
assert_equal "world", hash["syntax_highlighter_opts"]["hello"]
original.call(arg1, hash)
end

View File

@@ -22,11 +22,11 @@ class TestLiquidExtensions < JekyllUnitTest
end
should "extract the var properly" do
assert_equal @template.render("page" => { "name" => "tobi" }), "hi tobi"
assert_equal "hi tobi", @template.render("page" => { "name" => "tobi" })
end
should "return the variable name if the value isn't there" do
assert_equal @template.render("page" => { "title" => "tobi" }), "hi page.name"
assert_equal "hi page.name", @template.render("page" => { "title" => "tobi" })
end
end
end

View File

@@ -153,7 +153,8 @@ class TestRegenerator < JekyllUnitTest
assert @regenerator.cache[@path]
@regenerator.clear_cache
assert_equal @regenerator.cache, {}
expected = {}
assert_equal expected, @regenerator.cache
end
should "write to the metadata file" do

View File

@@ -76,6 +76,9 @@ 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