From eca6729900b543ff4eb5087e89c93d6850247dc0 Mon Sep 17 00:00:00 2001 From: "Rico Sta. Cruz" Date: Wed, 30 Aug 2017 22:19:40 +0800 Subject: [PATCH] Fix JS errors --- assets/2017/script.js | 1 + html-meta.md | 2 - jekyll.md | 313 +++++++++++++++++++++--------------------- 3 files changed, 160 insertions(+), 156 deletions(-) diff --git a/assets/2017/script.js b/assets/2017/script.js index d60427838..8b40b396d 100644 --- a/assets/2017/script.js +++ b/assets/2017/script.js @@ -228,6 +228,7 @@ function qs (search) { } function qsdecode (string) { + if (!string) string = '' string = string.replace(/\+/g, ' ') return string } diff --git a/html-meta.md b/html-meta.md index 2f17a2d8d..656e5da10 100644 --- a/html-meta.md +++ b/html-meta.md @@ -12,8 +12,6 @@ weight: -3 ``` -Title - ```html ··· diff --git a/jekyll.md b/jekyll.md index 7cca4211d..5c46a461e 100644 --- a/jekyll.md +++ b/jekyll.md @@ -198,27 +198,32 @@ Markup {% endcomment %} ``` -## Expression +## Variables ### Top-level variables - {{ site }} - from config.yml - {{ page }} - from frontmatter, and page-specific info - {{ content }} - html content (use in layouts) - {{ paginator }} - ... + +| `{{ site }}` | Data from `config.yml` | +| `{{ page }}` | From frontmatter, and page-specific info | +| `{{ content }}` | HTML content (use in layouts) | +| `{{ paginator }}` | Paginator | See: [Variables](http://jekyllrb.com/docs/variables/) ### Site - {{ site.time }} - current time - {{ site.pages }} - list of pages - {{ site.posts }} - list of posts - {{ site.related_posts }} - list - {{ site.categories.CATEGORY }} - list - {{ site.tags.TAG }} - list +```html +{{ site.time }} +``` +{: .-setup} - {{ site.static_files }} +| `site.time` | Current time | +| `site.pages` | List of pages | +| `site.posts` | List of blog posts | +| `site.related_posts` | List of posts related to current | +| `site.categories.CATEGORY` | List | +| `site.tags.TAG` | List | +| `site.static_files` | List | ### Page @@ -232,8 +237,9 @@ See: [Variables](http://jekyllrb.com/docs/variables/) {{ page.categories }} {{ page.tags }} {{ page.path }} -{{ post.excerpt | remove: '

' | remove: '

' }} -{{ post.excerpt | strip_html }} +{{ page.dir }} +{{ page.excerpt | remove: '

' | remove: '

' }} +{{ page.excerpt | strip_html }} ``` ```html @@ -242,6 +248,145 @@ See: [Variables](http://jekyllrb.com/docs/variables/) {{ page.previous }} ``` +Filters +------- +{: .-three-column} + +### Dates + +```ruby +{{ site.time | date: "%Y %m %d" }} +``` +{: .-setup} + +| `date_to_xmlschema` | → `2008-11-07T13:07:54-08:00` | +| `date_to_rfc822` | → `Mon, 07 Nov 2008 13:07:54 -0800` | +| `date_to_string` | → `07 Nov 2008` | +| `date_to_long_string` | → `07 November 2008` | +| `date:` _'%Y %m %d'_ | → `2017 Nov 7` | + +### Preprocessors + + +```ruby +{{ page.description | markdownify }} +``` +{: .-setup} + +| Filter | Description | +| --- | --- | +| `textilize` | Textile | +| `markdownify` | Markdown | +| `jsonify` | JSON | +| `sassify` | Sass | +| `scssify` | SCSS | +| `smartify` | Smartypants | + +### Array filters + +```ruby +{{ site.pages | where: "year", "2014" }} +``` +{: .-setup} + +| Filter | Description | +| --- | --- | +| `where:` _"year", "2014"_ | | +| `where_exp:` _"item", "item.year >= 2014"_ | | +| --- | --- | +| `group_by:` _"genre"_ | → `{name, items}` | +| `group_by_exp:` _"item", "item.genre"_ | → `{name, items}` | +| --- | --- | +| `sort` | | +| `sort:` _'author'_ | | +| --- | --- | +| `uniq` | | +| --- | --- | +| `first` | | +| `last` | | +| `join:` _','_ | | +| `array_to_setentence_string` | → `"X, Y and Z"` | +| --- | --- | +| `map:` _'post'_ | Works like 'pluck' | +| --- | --- | +| `size` | | +| `push:` _'xxx'_ | Adds an item | + +### String filters + +```ruby +{{ page.title | default: "xxx" }} +``` +{: .-setup} + +| Filter | Description | +| --- | --- | +| `default:` _'xxx'_ | | +| --- | --- | +| `upcase` | | +| `downcase` | | +| --- | --- | +| `remove:` _'p'_ | | +| `replace:` _'super', 'mega'_ | | +| `remove_first:` _'p'_ | | +| `replace_first:` _'super', 'mega'_ | | +| --- | --- | +| `truncate:` _5_ | | +| `truncatewords:` _20_ | | +| --- | --- | +| `prepend:` _'Mr. '_ | | +| `append:` _'Jr.'_ | | +| --- | --- | +| `camelize` | | +| `capitalize` | | +| `strip_html` | | +| `strip_newlines` | | +| `newlines_to_br` | | +| --- | --- | +| `split:` _','_ | | +| --- | --- | +| `escape` | | +| `escape_once` | | +| --- | --- | +| `slice:` _-3, 3_ | | + +See: [String filters](http://docs.shopify.com/themes/liquid-documentation/filters) + +### String filters (Jekyll-only) + +```ruby +{{ page.excerpt | number_of_words }} +``` +{: .-setup} + +| Filter | Description | +| --- | --- | +| `number_of_words` | | +| `slugify` | | +| --- | --- | +| `xml_escape` | → `CDATA` | +| `cgi_escape` | → `foo%2Cbar` | +| `uri_escape` | → `foo,%20bar` | + +### Numbers + +``` +{{ site.posts.size | minus: 2 }} +``` +{: .-setup} + +| Filter | Description | +| --- | --- | +| `minus:` _2_ | | +| `plus:` _2_ | | +| `times:` _2_ | | +| `divided_by:` _2_ | | +| `modulo:` _2_ | | +| --- | --- | +| `ceil` | | +| `floor` | | +| `round` | | + ## Paginator ### Paginator setup @@ -256,7 +401,6 @@ paginate_path: "blog/:num" See: [Paginator](http://jekyllrb.com/docs/pagination/) - ### Numbers ``` @@ -409,145 +553,6 @@ end {% endhighlight %} ``` -Helpers and filters -------------------- -{: .-three-column} - -### Dates - -```ruby -{{ site.time | date: "%Y %m %d" }} -``` -{: .-setup} - -| `date_to_xmlschema` | → `2008-11-07T13:07:54-08:00` | -| `date_to_rfc822` | → `Mon, 07 Nov 2008 13:07:54 -0800` | -| `date_to_string` | → `07 Nov 2008` | -| `date_to_long_string` | → `07 November 2008` | -| `date:` _'%Y %m %d'_ | → `2017 Nov 7` | - -### Preprocessors - - -```ruby -{{ page.description | markdownify }} -``` -{: .-setup} - -| Filter | Description | -| --- | --- | -| `textilize` | Textile | -| `markdownify` | Markdown | -| `jsonify` | JSON | -| `sassify` | Sass | -| `scssify` | SCSS | -| `smartify` | Smartypants | - -### Array filters - -```ruby -{{ site.pages | where: "year", "2014" }} -``` -{: .-setup} - -| Filter | Description | -| --- | --- | -| `where:` _"year", "2014"_ | | -| `where_exp:` _"item", "item.year >= 2014"_ | | -| --- | --- | -| `group_by:` _"genre"_ | → `{name, items}` | -| `group_by_exp:` _"item", "item.genre"_ | → `{name, items}` | -| --- | --- | -| `sort` | | -| `sort:` _'author'_ | | -| --- | --- | -| `uniq` | | -| --- | --- | -| `first` | | -| `last` | | -| `join:` _','_ | | -| `array_to_setentence_string` | → `"X, Y and Z"` | -| --- | --- | -| `map:` _'post'_ | Works like 'pluck' | -| --- | --- | -| `size` | | -| `push:` _'xxx'_ | Adds an item | - -### String filters - -```ruby -{{ page.title | default: "xxx" }} -``` -{: .-setup} - -| Filter | Description | -| --- | --- | -| `default:` _'xxx'_ | | -| --- | --- | -| `upcase` | | -| `downcase` | | -| --- | --- | -| `remove:` _'p'_ | | -| `replace:` _'super', 'mega'_ | | -| `remove_first:` _'p'_ | | -| `replace_first:` _'super', 'mega'_ | | -| --- | --- | -| `truncate:` _5_ | | -| `truncatewords:` _20_ | | -| --- | --- | -| `prepend:` _'Mr. '_ | | -| `append:` _'Jr.'_ | | -| --- | --- | -| `camelize` | | -| `capitalize` | | -| `strip_html` | | -| `strip_newlines` | | -| `newlines_to_br` | | -| --- | --- | -| `split:` _','_ | | -| --- | --- | -| `escape` | | -| `escape_once` | | -| --- | --- | -| `slice:` _-3, 3_ | | - -See: [String filters](http://docs.shopify.com/themes/liquid-documentation/filters) - -### String filters (Jekyll-only) - -```ruby -{{ page.excerpt | number_of_words }} -``` -{: .-setup} - -| Filter | Description | -| --- | --- | -| `number_of_words` | | -| `slugify` | | -| --- | --- | -| `xml_escape` | → `CDATA` | -| `cgi_escape` | → `foo%2Cbar` | -| `uri_escape` | → `foo,%20bar` | - -### Numbers - -``` -{{ site.posts.size | minus: 2 }} -``` -{: .-setup} - -| Filter | Description | -| --- | --- | -| `minus:` _2_ | | -| `plus:` _2_ | | -| `times:` _2_ | | -| `divided_by:` _2_ | | -| `modulo:` _2_ | | -| --- | --- | -| `ceil` | | -| `floor` | | -| `round` | | - Integration -----------