Update Ractive and Jekyll.

This commit is contained in:
Rico Sta. Cruz 2014-07-14 19:13:42 +08:00
parent 563a112354
commit c3a3371410
2 changed files with 73 additions and 77 deletions

110
jekyll.md
View File

@ -4,6 +4,7 @@ layout: default
jekyll_escape: true jekyll_escape: true
--- ---
{% raw %}
### Installation ### Installation
$ gem install jekyll $ gem install jekyll
@ -56,60 +57,60 @@ Configuration
## [Variables](http://jekyllrb.com/docs/variables/) ## [Variables](http://jekyllrb.com/docs/variables/)
{\{ site }} - from config.yml {{ site }} - from config.yml
{\{ page }} - from frontmatter, and page-specific info {{ page }} - from frontmatter, and page-specific info
{\{ content }} - html content (use in layouts) {{ content }} - html content (use in layouts)
{\{ paginator }} - ... {{ paginator }} - ...
### Site ### Site
{\{ site.time }} - current time {{ site.time }} - current time
{\{ site.pages }} - list of pages {{ site.pages }} - list of pages
{\{ site.posts }} - list of posts {{ site.posts }} - list of posts
{\{ site.related_posts }} - list {{ site.related_posts }} - list
{\{ site.categories.CATEGORY }} - list {{ site.categories.CATEGORY }} - list
{\{ site.tags.TAG }} - list {{ site.tags.TAG }} - list
{\{ site.static_files }} {{ site.static_files }}
### Page ### Page
{\{ page.content }} - un-rendered content {{ page.content }} - un-rendered content
{\{ page.title }} {{ page.title }}
{\{ page.excerpt }} - un-rendered excerpt {{ page.excerpt }} - un-rendered excerpt
{\{ page.url }} {{ page.url }}
{\{ page.date }} {{ page.date }}
{\{ page.id }} - unique id for RSS feeds {{ page.id }} - unique id for RSS feeds
{\{ page.categories }} {{ page.categories }}
{\{ page.tags }} {{ page.tags }}
{\{ page.path }} {{ page.path }}
{\{ post.excerpt | remove: '<p>' | remove: '</p>' }} {{ post.excerpt | remove: '<p>' | remove: '</p>' }}
{\{ post.excerpt | strip_html }} {{ post.excerpt | strip_html }}
<!-- blog pagination: --> <!-- blog pagination: -->
{\{ page.next }} {{ page.next }}
{\{ page.previous }} {{ page.previous }}
### [Paginator](http://jekyllrb.com/docs/pagination/) ### [Paginator](http://jekyllrb.com/docs/pagination/)
{\{ paginator.page }} - page number {{ paginator.page }} - page number
{\{ paginator.total_posts}} {{ paginator.total_posts}}
{\{ paginator.total_pages}} {{ paginator.total_pages}}
{\{ paginator.per_page }} {{ paginator.per_page }}
{\% for post in paginator.posts %} ... {\% endfor %} {% for post in paginator.posts %} ... {% endfor %}
{\% if paginator.previous_page %} {% if paginator.previous_page %}
<a href="{\{ paginator.previous_page_path }}">Previous</a> <a href="{{ paginator.previous_page_path }}">Previous</a>
{\% else %} {% else %}
{\% endif %} {% endif %}
{\{ paginator.next_page }} - page number {{ paginator.next_page }} - page number
{\{ paginator.next_page_path }} {{ paginator.next_page_path }}
... ...
{\% if paginator.total_pages > 1 %} {% if paginator.total_pages > 1 %}
{\% endif %} {% endif %}
Add this to `_config.yml`: Add this to `_config.yml`:
@ -118,37 +119,37 @@ Add this to `_config.yml`:
### Code ### Code
{\% highlight ruby linenos %} {% highlight ruby linenos %}
def show def show
... ...
end end
{\% endhighlight %} {% endhighlight %}
Markup Markup
------ ------
### Loops ### Loops
{\% for post in site.posts %} {% for post in site.posts %}
<a href="{{ post.url }}"> <a href="{{ post.url }}">
<h2>{\{ post.title }} &mdash; {\{ post.date | date_to_string }}</h2> <h2>{{ post.title }} &mdash; {{ post.date | date_to_string }}</h2>
</a> </a>
{\{ post.content }} {{ post.content }}
{\% endfor %} {% endfor %}
### Dates ### Dates
{\{ page.date | date: "%b %d, %Y" }} {{ page.date | date: "%b %d, %Y" }}
### If ### If
{\% if page.image.feature %} {% if page.image.feature %}
{\% else %} {% else %}
{\% endif %} {% endif %}
### Includes (partials) ### Includes (partials)
{\% include header.html %} {% include header.html %}
Blogging Blogging
-------- --------
@ -157,7 +158,7 @@ Blogging
### Image paths ### Image paths
![My helpful screenshot]({\{ site.url }}/assets/screenshot.jpg) ![My helpful screenshot]({{ site.url }}/assets/screenshot.jpg)
### [Drafts](http://jekyllrb.com/docs/drafts/) ### [Drafts](http://jekyllrb.com/docs/drafts/)
@ -176,15 +177,15 @@ Blogging
_data/members.yml _data/members.yml
{\% for member in site.data.members %} {% for member in site.data.members %}
Helpers and Filters Helpers and Filters
------------------- -------------------
{\{ site.time | date_to_xmlschema }} #=> 2008-11-07T13:07:54-08:00 {{ site.time | date_to_xmlschema }} #=> 2008-11-07T13:07:54-08:00
{\{ site.time | date_to_rfc822 }} #=> Mon, 07 Nov 2008 13:07:54 -0800 {{ site.time | date_to_rfc822 }} #=> Mon, 07 Nov 2008 13:07:54 -0800
{\{ site.time | date_to_string }} #=> 07 Nov 2008 {{ site.time | date_to_string }} #=> 07 Nov 2008
{\{ site.time | date_to_long_string }} #=> 07 November 2008 {{ site.time | date_to_long_string }} #=> 07 November 2008
| where:"year","2014" | where:"year","2014"
| group_by:"genre" | group_by:"genre"
@ -231,3 +232,4 @@ Integration
* http://jekyllrb.com/docs/templates/ * http://jekyllrb.com/docs/templates/
* http://docs.shopify.com/themes/liquid-basics/output * http://docs.shopify.com/themes/liquid-basics/output
* http://docs.shopify.com/themes/liquid-basics/logic * http://docs.shopify.com/themes/liquid-basics/logic
{% endraw %}

View File

@ -4,7 +4,8 @@ layout: default
vim: ft=javascript vim: ft=javascript
--- ---
### Initialization {% raw %}
### [Initialization](http://docs.ractivejs.org/latest/initialisation-options)
new Ractive({ new Ractive({
el: $('..'), el: $('..'),
@ -12,15 +13,15 @@ vim: ft=javascript
template: '...', // required template: '...', // required
// callbacks // callbacks
init: function() // on instanciate init: function() {}, // on instanciate
complete: function() // on finish animations complete: function() {}, // on finish animations
// objs // objs
data: { ... } data: { ... },
partials: { ... } // global: Ractive.partials partials: { ... }, // global: Ractive.partials
transitions: { ... } // global: Ractive.transitions transitions: { ... }, // global: Ractive.transitions
components: { ... } components: { ... },
adaptors: [ ... ] adaptors: [ ... ],
// options // options
magic: false magic: false
@ -33,9 +34,7 @@ vim: ft=javascript
sanitize: false sanitize: false
}) })
http://docs.ractivejs.org/latest/initialisation-options ### [Instance methods](http://docs.ractivejs.org/latest/initialisation-options)
### Instance methods
view.set('a', true) view.set('a', true)
view.set({ a: true }) view.set({ a: true })
@ -53,7 +52,7 @@ http://docs.ractivejs.org/latest/initialisation-options
view.nodes view.nodes
view.nodes['hello'] // .find('#hello') view.nodes['hello'] // .find('#hello')
http://docs.ractivejs.org/latest/initialisation-options view.findComponent('photo')
### Extend ### Extend
@ -62,7 +61,7 @@ http://docs.ractivejs.org/latest/initialisation-options
}) })
new View() new View()
### Components ### [Components](https://github.com/RactiveJS/Ractive/wiki/Components)
Widget = Ractive.extend({ ... }) Widget = Ractive.extend({ ... })
@ -74,8 +73,7 @@ http://docs.ractivejs.org/latest/initialisation-options
} }
}); });
https://github.com/RactiveJS/Ractive/issues/74 See: https://github.com/RactiveJS/Ractive/issues/74
https://github.com/RactiveJS/Ractive/wiki/Components
### Partials ### Partials
@ -84,7 +82,7 @@ https://github.com/RactiveJS/Ractive/wiki/Components
### Events ### Events
view.on('teardown') view.on('teardown')
### DOM Events ### DOM Events
@ -158,7 +156,7 @@ This transforms the `list` attribute via a helper function called `sort()`.
t.complete(); t.complete();
}; };
### Decorators ### [Decorators](http://docs.ractivejs.org/latest/decorators)
<span decorator="tooltip:hello there">Hover me</span> <span decorator="tooltip:hello there">Hover me</span>
@ -177,9 +175,7 @@ This transforms the `list` attribute via a helper function called `sort()`.
tooltip: function (node, a, b, two, c) { ... } tooltip: function (node, a, b, two, c) { ... }
http://docs.ractivejs.org/latest/decorators ### [Adaptors](http://docs.ractivejs.org/latest/adaptors)
### Adaptors
myAdaptor = { myAdaptor = {
filter: function (object, keypath, ractive) { filter: function (object, keypath, ractive) {
@ -200,6 +196,4 @@ http://docs.ractivejs.org/latest/decorators
}; };
} }
}; };
{% endraw %}
http://docs.ractivejs.org/latest/adaptors