Skip to content

Commit

Permalink
add pages and import more wiki content
Browse files Browse the repository at this point in the history
  • Loading branch information
cobyism committed Jul 30, 2012
1 parent ea1f465 commit 1fd0849
Show file tree
Hide file tree
Showing 9 changed files with 1,601 additions and 5 deletions.
2 changes: 1 addition & 1 deletion _config.yml
@@ -1,4 +1,4 @@
auto: true
auto: false
server: true
permalink: /docs/:categories/:title
pygments: true
6 changes: 6 additions & 0 deletions _includes/docs_contents.html
Expand Up @@ -38,6 +38,12 @@ <h4>Customization</h4>
<li class="{% if page.title == "Managing Assets" %}current{% endif %}">
<a href="{{ site.url }}/docs/assets">Managing Assets</a>
</li>
<li class="{% if page.title == "Permalinks" %}current{% endif %}">
<a href="{{ site.url }}/docs/permalinks">Permalinks</a>
</li>
<li class="{% if page.title == "Pagination" %}current{% endif %}">
<a href="{{ site.url }}/docs/pagination">Pagination</a>
</li>
<li class="{% if page.title == "Plugins" %}current{% endif %}">
<a href="{{ site.url }}/docs/plugins">Plugins</a>
</li>
Expand Down
2 changes: 1 addition & 1 deletion _posts/2012-07-19-assets.md
Expand Up @@ -2,7 +2,7 @@
layout: docs
title: Managing Assets
prev_section: templates
next_section: plugins
next_section: permalinks
---

Move along, people. Nothing to see here.
272 changes: 271 additions & 1 deletion _posts/2012-07-19-plugins.md

Large diffs are not rendered by default.

985 changes: 984 additions & 1 deletion _posts/2012-07-19-sites.md

Large diffs are not rendered by default.

182 changes: 181 additions & 1 deletion _posts/2012-07-19-templates.md
Expand Up @@ -5,4 +5,184 @@ prev_section: migrations
next_section: assets
---

Move along, people. Nothing to see here.
Jekyll uses [Liquid](http://www.liquidmarkup.org/) to process templates.
Along with the [standard liquid tags and
filters](http://wiki.github.com/shopify/liquid/liquid-for-designers),
Jekyll adds a few of its own:

Filters
-------

### Date to XML Schema

Convert a Time into XML Schema format.

`{{ "{{ site.time | date\_to\_xmlschema " }}}}`
`2008-11-17T13:07:54-08:00`

### Date to String

Convert a date in short format, e.g. “27 Jan 2011”.

`{{ "{{ site.time | date\_to\_string " }}}}`
`17 Nov 2008`

### Date to Long String

Format a date in long format e.g. “27 January 2011”.

`{{ "{{ site.time | date\_to\_long\_string " }}}}`
`17 November 2008`

### XML Escape

Escape some text for use in XML.

`{{ "{{ page.content | xml\_escape " }}}}`

### CGI Escape

CGI escape a string for use in a URL. Replaces any special characters
with appropriate %XX replacements.

`{{ "{{ “foo,bar;baz?” | cgi\_escape " }}}}`
`foo%2Cbar%3Bbaz%3F`

### Number of Words

Count the number of words in some text.

`{{ "{{ page.content | number\_of\_words " }}}}`
`1337`

### Array to Sentence

Convert an array into a sentence.

`{{ "{{ page.tags | array\_to\_sentence\_string " }}}}`
`foo, bar, and baz`

### Textilize

Convert a Textile-formatted string into HTML, formatted via RedCloth

`{{ "{{ page.excerpt | textilize " }}}}`

### Markdownify

Convert a Markdown-formatted string into HTML.

`{{ "{{ page.excerpt | markdownify " }}}}`

Tags
----

### Include

If you have small page fragments that you wish to include in multiple
places\
on your site, you can use the `include` tag.

{{ "{% include sig.textile " }}}%

Jekyll expects all include files to be placed in an `_includes`
directory at the root of your source dir. So this will embed the
contents of `/path/to/proto/site/_includes/sig.textile` into the calling
file.

### Code Highlighting

Jekyll has built in support for syntax highlighting of over [100
languages](http://pygments.org/languages/) via
[Pygments](http://pygments.org/). In order to take advantage of this
you’ll need to have Pygments installed, and the pygmentize binary must
be in your path. When you run Jekyll, make sure you run it with
[Pygments support](../configuration)

To denote a code block that should be highlighted:

{{ "{% highlight ruby " }}}%
def foo
puts 'foo'
end
{{ "{% endhighlight " }}}%

The argument to `highlight` is the language identifier. To find the
appropriate identifier to use for your favorite language, look for the
“short name” on the [Lexers](http://pygments.org/docs/lexers/) page.

#### Line number

There is a second argument to `highlight` called `linenos` that is
optional. Including the `linenos` argument will force the highlighted
code to include line numbers. For instance, the following code block
would include line numbers next to each line:

{{ "{% highlight ruby linenos " }}}%
def foo
puts 'foo'
end
{{ "{% endhighlight " }}}%

In order for the highlighting to show up, you’ll need to include a
highlighting stylesheet. For an example stylesheet you can look at
[syntax.css](http://github.com/mojombo/tpw/tree/master/css/syntax.css).
These are the same styles as used by GitHub and you are free to use them
for your own site. If you use linenos, you might want to include an
additional CSS class definition for `lineno` in syntax.css to
distinguish the line numbers from the highlighted code.

### Post Url

If you would like to include a link to a post on your site, you can use
the `post\_url` tag.

{{ "{% post_url 2010-07-21-name-of-post " }}}%

There is no need to include the extension.

To create a link, do:

[Name of Link]({{ "{% post_url 2010-07-21-name-of-post " }}}%)


## Markup Problems

The various markup engines that Jekyll uses may have some issues. This
page will document them to help others who may run into the same
problems.

Maruku
------

If your link has characters that need to be escaped, you need to use
this syntax:

`![Alt text](http://yuml.me/diagram/class/[Project]->[Task])`

If you have an empty tag, i.e. `<script src="js.js"></script>`, Maruku
transforms this into `<script src="js.js" />`. This causes problems in
Firefox and possibly other browsers and is [discouraged in
XHTML.](http://www.w3.org/TR/xhtml1/#C_3) An easy fix is to put a space
between the opening and closing tags.

RedCloth
--------

Versions 4.1.1 and higher do not obey the notextile tag. [This is a
known
bug](http://aaronqian.com/articles/2009/04/07/redcloth-ate-my-notextile.html)
and will hopefully be fixed for 4.2. You can still use 4.1.9, but the
test suite requires that 4.1.0 be installed. If you use a version of
RedCloth that does not have the notextile tag, you may notice that
syntax highlighted blocks from Pygments are not formatted correctly,
among other things. If you’re seeing this just install 4.1.0.

Liquid
------

The latest version, version 2.0, seems to break the use of {{ "{{" }} in
templates. Unlike previous versions, using {{ "{{" }} in 2.0 gives me:
`'{{ "{{" }}' was not properly terminated with regexp: /\}\}/ (Liquid::SyntaxError)`


115 changes: 115 additions & 0 deletions _posts/2012-07-26-pagination.md
@@ -0,0 +1,115 @@
---
layout: docs
title: Pagination
prev_section: permalinks
next_section: plugins
---

Note: Pagination does not work with markdown files, it only works with html file extensions.

Just follow these steps to add pagination to your blog:

## \_config.yml
add the pagination setting:

{% highlight yaml %}
markdown: rdiscount
pygments: true
lsi: true
exclude: ['README.markdown', 'README_FOR_COLLABORATORS.markdown', 'Gemfile.lock', 'Gemfile']
production: false
//add this line to add pagination
paginate: 3 //the number of post per page
{% endhighlight %}

## index.html
just add the posts and the pagination links:

{% highlight html %}
---
layout: default
title: Blog
---

{{ "{% for post in paginator.posts " }}%}

<!-- here add you post markup -->
<h1><a href="{{ "{{ post.url " }}}}">{{ "{{ post.title " }}}}</a></h1>
<p class="author">
<span class="date">{{ "{{post.date" }}}}</span>
</p>
<div class="content">
{{ "{{ post.content " }}}}
</div>
{{ "{% endfor " }}%}

<!-- Pagination links -->
<div class="pagination">
{{ "{% if paginator.previous_page " }}%}
<a href="/page{{ "{{paginator.previous_page" }}}}" class="previous">Previous</a>
{{ "{% else " }}%}
<span class="previous">Previous</span>
{{ "{% endif " }}%}
<span class="page_number ">Page: {{ "{{paginator.page" }}}} of {{ "{{paginator.total_pages" }}}}</span>
{{ "{% if paginator.next_page " }}%}
<a href="/page{{ "{{paginator.next_page" }}}}" class="next ">Next</a>
{{ "{% else " }}%}
<span class="next ">Next</span>
{{ "{% endif " }}%}
</div>

{% endhighlight %}

## A note about page1

Jekyll does not produce a page1 folder so using the above code will not work when a link is produced of the form "/page1". The following textile will handle page1 and render a list of each page with links to all but the current page.

{% highlight html %}
<div id="post-pagination" class="pagination">

{{ "{% if paginator.previous_page " }}%}
<p class="previous">
{{ "{% if paginator.previous_page == 1 " }}%}
<a href="/">Previous</a>
{{ "{% else " }}%}
<a href="/page{{ "{{paginator.previous_page" }}}}">Previous</a>
{{ "{% endif " }}%}
</p>
{{ "{% else " }}%}
<p class="previous disabled">
<span>Previous</span>
</p>
{{ "{% endif " }}%}

<ul class="pages">
<li class="page">
{{ "{% if paginator.page == 1 " }}%}
<span class="current-page">1</span>
{{ "{% else " }}%}
<a href="/">1</a>
{{ "{% endif " }}%}
</li>

{{ "{% for count in (2..paginator.total_pages) " }}%}
<li class="page">
{{ "{% if count == paginator.page " }}%}
<span class="current-page">{{ "{{count" }}}}</span>
{{ "{% else " }}%}
<a href="/page{{ "{{count" }}}}">{{ "{{count" }}}}</a>
{{ "{% endif " }}%}
</li>
{{ "{% endfor " }}%}
</ul>

{{ "{% if paginator.next_page " }}%}
<p class="next">
<a href="/page{{ "{{paginator.next_page" }}}}">Next</a>
</p>
{{ "{% else " }}%}
<p class="next disabled">
<span>Next</span>
</p>
{{ "{% endif " }}%}

</div>
{% endhighlight %}
40 changes: 40 additions & 0 deletions _posts/2012-07-26-permalinks.md
@@ -0,0 +1,40 @@
---
layout: docs
title: Permalinks
prev_section: assets
next_section: pagination
---

Jekyll supports a flexible way to build your site’s URLs. You can
specify the permalinks for your site through the [Configuration](../configuration) or on
the [YAML Front Matter](../frontmatter) for each post. You’re free to choose one of
the built-in styles to create your links or craft your own. The default
style is always `date`.

Template Variables

**Variable** **Description**
`year` Year from the post’s filename
`month` Month from the post’s filename
`day` Day from the post’s filename
`title` Title from the post’s filename
`categories` The specified categories for this post. Jekyll automatically parses out double slashes in the URLs, so if no categories are present, it basically ignores this.
`i_month`  Month from the post’s filename without leading zeros.
`i_day` Day from the post’s filename without leading zeros.

Built-in styles

**Name** **Template**
`date` `/:categories/:year/:month/:day/:title.html`
`pretty` `/:categories/:year/:month/:day/:title/`
`none` `/:categories/:title.html`

Examples

Given a post named: `/2009-04-29-slap-chop.textile`

**Setting** **Result**
`None specified.` `/2009/04/29/slap-chop.html`
`permalink: pretty` `/2009/04/29/slap-chop/index.html`
`permalink: /:month-:day-:year/:title.html` `/04-29-2009/slap-chop.html`
`permalink: /blog/:year/:month/:day/:title` `/blog/2009/04/29/slap-chop/index.html`
2 changes: 2 additions & 0 deletions css/style.css
Expand Up @@ -427,6 +427,8 @@ pre, code {

.highlight {
padding: 10px 0;
width: 100%;
overflow: scroll;
}


Expand Down

0 comments on commit 1fd0849

Please sign in to comment.