merge lastest from mojombo/jekyll master

This commit is contained in:
edeustace 2013-01-11 12:23:53 +01:00
commit 0fa55418e9
71 changed files with 4538 additions and 94 deletions

2
.gitignore vendored
View File

@ -8,3 +8,5 @@ _site/
.bundle/
.DS_Store
bbin/
gh-pages/
site/_site/

1
.ruby-version Normal file
View File

@ -0,0 +1 @@
1.9.3-p362

45
CONTRIBUTING.md Normal file
View File

@ -0,0 +1,45 @@
Contribute
==========
So you've got an awesome idea to throw into Jekyll. Great! Please keep the following in mind:
* **Contributions will not be accepted without tests.**
* If you're creating a small fix or patch to an existing feature, just a simple test will do. Please stay in the confines of the current test suite and use [Shoulda](http://github.com/thoughtbot/shoulda/tree/master) and [RR](http://github.com/btakita/rr/tree/master).
* If it's a brand new feature, make sure to create a new [Cucumber](https://github.com/cucumber/cucumber/) feature and reuse steps where appropriate. Also, whipping up some documentation in your fork's wiki would be appreciated, and once merged it will be transferred over to the main wiki.
Test Dependencies
-----------------
To run the test suite and build the gem you'll need to install Jekyll's dependencies. Jekyll uses Bundler, so a quick run of the bundle command and you're all set!
$ bundle
Before you start, run the tests and make sure that they pass (to confirm your environment is configured properly):
$ rake test
$ rake features
Workflow
--------
Here's the most direct way to get your work merged into the project:
* Fork the project
* Clone down your fork ( `git clone git://github.com/<username>/jekyll.git` )
* Create a topic branch to contain your change ( `git checkout -b my_awesome_feature` )
* Hack away, add tests. Not necessarily in that order.
* Make sure everything still passes by running `rake`
* If necessary, rebase your commits into logical chunks, without errors
* Push the branch up ( `git push origin my_awesome_feature` )
* Create an issue with a description and link to your branch
Gotchas
-------
* If you want to bump the gem version, please put that in a separate commit. This way, the maintainers can control when the gem gets released.
* Try to keep your patch(es) based from the latest commit on mojombo/jekyll. The easier it is to apply your work, the less work the maintainers have to do, which is always a good thing.
* Please don't tag your GitHub issue with [fix], [feature], etc. The maintainers actively read the issues and will label it once they come across it.
Finally...
----------
Thanks! Hacking on Jekyll should be fun, and if for some reason it's a pain to do let us know so we can fix it.

View File

@ -1,4 +1,14 @@
== HEAD
* Minor Enhancements
* Add source and destination directory protection (#535)
* Better YAML error message (#718)
* Bug Fixes
* Prevent custom destination from causing continuous regen (#528)
* Site Enhancements
* Bring site into master branch with better preview/deploy (#709)
* Redesigned site (#583)
== 0.12.0 / 2012-12-22
* Minor Enhancements
* Add ability to explicitly specify included files (#261)
* Add --default-mimetype option (#279)
@ -7,12 +17,16 @@
* Allow multiple plugin dirs to be specified (#438)
* Inline TOC token support for RDiscount (#333)
* Add the option to specify the paginated url format (#342)
* Swap out albino for pygments.rb (#569)
* Support Redcarpet 2 and fenced code blocks (#619)
* Better reporting of Liquid errors (#624)
* Bug Fixes
* Allow some special characters in highlight names
* URL escape category names in URL generation (#360)
* Fix error with limit_posts (#442)
* Properly select dotfile during directory scan (#363, #431, #377)
* Allow setting of Kramdown smart_quotes (#482)
* Ensure front-matter is at start of file (#562)
== 0.11.2 / 2011-12-27
* Bug Fixes

View File

@ -22,19 +22,20 @@ h2. Diving In
h2. Runtime Dependencies
* RedCloth: Textile support (Ruby)
* Liquid: Templating system (Ruby)
* Classifier: Generating related posts (Ruby)
* Maruku: Default markdown engine (Ruby)
* Directory Watcher: Auto-regeneration of sites (Ruby)
* Kramdown: Markdown-superset converter (Ruby)
* Liquid: Templating system (Ruby)
* Maruku: Default markdown engine (Ruby)
* Pygments: Syntax highlighting (Python)
h2. Developer Dependencies
* Shoulda: Test framework (Ruby)
* RR: Mocking (Ruby)
* RedGreen: Nicer test output (Ruby)
* RDiscount: Discount Markdown Processor (Ruby)
* RedCloth: Textile support (Ruby)
* RedGreen: Nicer test output (Ruby)
* RR: Mocking (Ruby)
* Shoulda: Test framework (Ruby)
h2. License

View File

@ -109,6 +109,72 @@ rescue LoadError
end
end
#############################################################################
#
# Site tasks - http://jekyllrb.com
#
#############################################################################
namespace :site do
desc "Generate and view the site locally"
task :preview do
require "launchy"
# Yep, it's a hack! Wait a few seconds for the Jekyll site to generate and
# then open it in a browser. Someday we can do better than this, I hope.
Thread.new do
sleep 4
puts "Opening in browser..."
Launchy.open("http://localhost:4000")
end
# Generate the site in server mode.
puts "Running Jekyll..."
Dir.chdir("site") do
sh "#{File.expand_path('bin/jekyll', File.dirname(__FILE__))} --server"
end
end
desc "Commit the local site to the gh-pages branch and publish to GitHub Pages"
task :publish do
# Failsafe. Remove this once it has been done.
puts "Make sure to merge #583 into gh-pages before deploying."
exit(1)
# Ensure the gh-pages dir exists so we can generate into it.
puts "Checking for gh-pages dir..."
unless File.exist?("./gh-pages")
puts "No gh-pages directory found. Run the following commands first:"
puts " `git clone git@github.com:mojombo/jekyll gh-pages"
puts " `cd gh-pages"
puts " `git checkout gh-pages`"
exit(1)
end
# Ensure gh-pages branch is up to date.
Dir.chdir('gh-pages') do
sh "git pull origin gh-pages"
end
# Copy to gh-pages dir.
puts "Copying site to gh-pages branch..."
Dir.glob("site/*") do |path|
next if path == "_site"
sh "cp -R #{path} gh-pages/"
end
# Commit and push.
puts "Committing and pushing to GitHub Pages..."
sha = `git log`.match(/[a-z0-9]{40}/)[0]
Dir.chdir('gh-pages') do
sh "git add ."
sh "git commit -m 'Updating to #{sha}.'"
sh "git push origin gh-pages"
end
puts 'Done.'
end
end
#############################################################################
#
# Packaging tasks

View File

@ -229,10 +229,10 @@ source = options['source']
destination = options['destination']
# Files to watch
def globs(source)
def globs(source, destination)
Dir.chdir(source) do
dirs = Dir['*'].select { |x| File.directory?(x) }
dirs -= ['_site']
dirs -= [destination]
dirs = dirs.map { |x| "#{x}/**/*" }
dirs += ['*']
end
@ -249,7 +249,7 @@ if options['auto']
dw = DirectoryWatcher.new(source)
dw.interval = 1
dw.glob = globs(source)
dw.glob = globs(source, destination)
dw.add_observer do |*args|
t = Time.now.strftime("%Y-%m-%d %H:%M:%S")

View File

@ -4,8 +4,9 @@ Gem::Specification.new do |s|
s.rubygems_version = '1.3.5'
s.name = 'jekyll'
s.version = '0.11.2'
s.date = '2011-12-27'
s.version = '0.12.0'
s.license = 'MIT'
s.date = '2012-12-22'
s.rubyforge_project = 'jekyll'
s.summary = "A simple, blog aware, static site generator."
@ -27,7 +28,7 @@ Gem::Specification.new do |s|
s.add_runtime_dependency('directory_watcher', "~> 1.1")
s.add_runtime_dependency('maruku', "~> 0.5")
s.add_runtime_dependency('kramdown', "~> 0.13.4")
s.add_runtime_dependency('pygments.rb', "~> 0.2.12")
s.add_runtime_dependency('pygments.rb', "~> 0.3.2")
s.add_development_dependency('rake', "~> 0.9")
s.add_development_dependency('rdoc', "~> 3.11")
@ -37,7 +38,8 @@ Gem::Specification.new do |s|
s.add_development_dependency('cucumber', "1.1")
s.add_development_dependency('RedCloth', "~> 4.2")
s.add_development_dependency('rdiscount', "~> 1.6")
s.add_development_dependency('redcarpet', "~> 1.9")
s.add_development_dependency('redcarpet', "~> 2.1.1")
s.add_development_dependency('launchy', "~> 2.1.2")
# = MANIFEST =
s.files = %w[
@ -74,10 +76,12 @@ Gem::Specification.new do |s|
lib/jekyll/migrators/csv.rb
lib/jekyll/migrators/drupal.rb
lib/jekyll/migrators/enki.rb
lib/jekyll/migrators/joomla.rb
lib/jekyll/migrators/marley.rb
lib/jekyll/migrators/mephisto.rb
lib/jekyll/migrators/mt.rb
lib/jekyll/migrators/posterous.rb
lib/jekyll/migrators/rss.rb
lib/jekyll/migrators/textpattern.rb
lib/jekyll/migrators/tumblr.rb
lib/jekyll/migrators/typo.rb
@ -90,6 +94,9 @@ Gem::Specification.new do |s|
lib/jekyll/static_file.rb
lib/jekyll/tags/highlight.rb
lib/jekyll/tags/include.rb
lib/jekyll/tags/post_url.rb
test/fixtures/broken_front_matter1.erb
test/fixtures/front_matter.erb
test/helper.rb
test/source/.htaccess
test/source/_includes/sig.markdown
@ -132,6 +139,7 @@ Gem::Specification.new do |s|
test/source/z_category/_posts/2008-9-23-categories.textile
test/suite.rb
test/test_configuration.rb
test/test_convertible.rb
test/test_core_ext.rb
test/test_filters.rb
test/test_generated_site.rb
@ -141,9 +149,9 @@ Gem::Specification.new do |s|
test/test_post.rb
test/test_rdiscount.rb
test/test_redcarpet.rb
test/test_redcloth.rb
test/test_site.rb
test/test_tags.rb
test/test_redcloth.rb
]
# = MANIFEST =

View File

@ -46,47 +46,50 @@ require_all 'jekyll/generators'
require_all 'jekyll/tags'
module Jekyll
VERSION = '0.11.2'
VERSION = '0.12.0'
# Default options. Overriden by values in _config.yml or command-line opts.
# (Strings rather symbols used for compatability with YAML).
# Strings rather than symbols are used for compatability with YAML.
DEFAULTS = {
'safe' => false,
'auto' => false,
'server' => false,
'server_port' => 4000,
'source' => Dir.pwd,
'destination' => File.join(Dir.pwd, '_site'),
'plugins' => File.join(Dir.pwd, '_plugins'),
'source' => Dir.pwd,
'destination' => File.join(Dir.pwd, '_site'),
'plugins' => File.join(Dir.pwd, '_plugins'),
'layouts' => '_layouts',
'keep_files' => ['.git','.svn'],
'layouts' => '_layouts',
'future' => true,
'lsi' => false,
'pygments' => false,
'markdown' => 'maruku',
'permalink' => 'date',
'include' => ['.htaccess'],
'future' => true,
'lsi' => false,
'pygments' => false,
'markdown' => 'maruku',
'permalink' => 'date',
'include' => ['.htaccess'],
'paginate_path' => 'page:num',
'markdown_ext' => 'markdown,mkd,mkdn,md',
'textile_ext' => 'textile',
'markdown_ext' => 'markdown,mkd,mkdn,md',
'textile_ext' => 'textile',
'maruku' => {
'maruku' => {
'use_tex' => false,
'use_divs' => false,
'png_engine' => 'blahtex',
'png_dir' => 'images/latex',
'png_url' => '/images/latex'
},
'rdiscount' => {
'rdiscount' => {
'extensions' => []
},
'redcarpet' => {
'redcarpet' => {
'extensions' => []
},
'kramdown' => {
'kramdown' => {
'auto_ids' => true,
'footnote_nr' => 1,
'entity_output' => 'as_char',
@ -103,8 +106,9 @@ module Jekyll
'coderay_css' => 'style'
}
},
'redcloth' => {
'hard_breaks' => true
'redcloth' => {
'hard_breaks' => true
}
}

View File

@ -8,12 +8,28 @@ module Jekyll
def setup
return if @setup
# Set the Markdown interpreter (and Maruku self.config, if necessary)
case @config['markdown']
when 'redcarpet'
begin
require 'redcarpet'
@redcarpet_extensions = @config['redcarpet']['extensions'].map { |e| e.to_sym }
@renderer ||= Class.new(Redcarpet::Render::HTML) do
def block_code(code, lang)
lang = lang && lang.split.first || "text"
output = add_code_tags(
Pygments.highlight(code, :lexer => lang, :options => { :encoding => 'utf-8' }),
lang
)
end
def add_code_tags(code, lang)
code = code.sub(/<pre>/,'<pre><code class="' + lang + '">')
code = code.sub(/<\/pre>/,"</code></pre>")
end
end
@redcarpet_extensions = {}
@config['redcarpet']['extensions'].each { |e| @redcarpet_extensions[e.to_sym] = true }
rescue LoadError
STDERR.puts 'You are missing a library required for Markdown. Please run:'
STDERR.puts ' $ [sudo] gem install redcarpet'
@ -30,8 +46,6 @@ module Jekyll
when 'rdiscount'
begin
require 'rdiscount'
# Load rdiscount extensions
@rdiscount_extensions = @config['rdiscount']['extensions'].map { |e| e.to_sym }
rescue LoadError
STDERR.puts 'You are missing a library required for Markdown. Please run:'
@ -88,7 +102,10 @@ module Jekyll
setup
case @config['markdown']
when 'redcarpet'
Redcarpet.new(content, *@redcarpet_extensions).to_html
@redcarpet_extensions[:fenced_code_blocks] = !@redcarpet_extensions[:no_fenced_code_blocks]
@renderer.send :include, Redcarpet::Render::SmartyPants if @redcarpet_extensions[:smart]
markdown = Redcarpet::Markdown.new(@renderer.new(@redcarpet_extensions), @redcarpet_extensions)
markdown.render(content)
when 'kramdown'
# Check for use of coderay
if @config['kramdown']['use_coderay']

View File

@ -25,15 +25,17 @@ module Jekyll
#
# Returns nothing.
def read_yaml(base, name)
self.content = File.read(File.join(base, name))
begin
if self.content =~ /^(---\s*\n.*?\n?)^(---\s*$\n?)/m
self.content = File.read(File.join(base, name))
if self.content =~ /\A(---\s*\n.*?\n?)^(---\s*$\n?)/m
self.content = $POSTMATCH
self.data = YAML.load($1)
end
rescue => e
puts "YAML Exception reading #{name}: #{e.message}"
puts "Error reading file #{File.join(base, name)}: #{e.message}"
rescue SyntaxError => e
puts "YAML Exception reading #{File.join(base, name)}: #{e.message}"
end
self.data ||= {}
@ -76,9 +78,13 @@ module Jekyll
payload["pygments_suffix"] = converter.pygments_suffix
begin
self.content = Liquid::Template.parse(self.content).render(payload, info)
self.content = Liquid::Template.parse(self.content).render!(payload, info)
rescue => e
puts "Liquid Exception: #{e.message} in #{self.name}"
e.backtrace.each do |backtrace|
puts backtrace
end
abort("Build Failed")
end
self.transform
@ -94,9 +100,13 @@ module Jekyll
payload = payload.deep_merge({"content" => self.output, "page" => layout.data})
begin
self.output = Liquid::Template.parse(layout.content).render(payload, info)
self.output = Liquid::Template.parse(layout.content).render!(payload, info)
rescue => e
puts "Liquid Exception: #{e.message} in #{self.data["layout"]}"
e.backtrace.each do |backtrace|
puts backtrace
end
abort("Build Failed")
end
if layout = layouts[layout.data["layout"]]

View File

@ -57,6 +57,17 @@ module Jekyll
date.xmlschema
end
# XML escape a string for use. Replaces any special characters with
# appropriate HTML entity replacements.
#
# input - The String to escape.
#
# Examples
#
# xml_escape('foo "bar" <baz>')
# # => "foo &quot;bar&quot; &lt;baz&gt;"
#
# Returns the escaped String.
def xml_escape(input)
CGI.escapeHTML(input)
end

View File

@ -1,11 +1,14 @@
require 'rubygems'
require 'jekyll'
require 'fileutils'
require 'net/http'
require 'net/https'
require 'open-uri'
require 'uri'
require "json"
# ruby -r './lib/jekyll/migrators/posterous.rb' -e 'Jekyll::Posterous.process(email, pass, api_key, blog)'
# ruby -r './lib/jekyll/migrators/posterous.rb' -e 'Jekyll::Posterous.process(email, pass, api_token, blog, tags_key)'
# You can find your api token in posterous api page - http://posterous.com/api . Click on any of the 'view token' links to see your token.
# blog is optional, by default it is the primary one
module Jekyll
module Posterous
@ -14,6 +17,9 @@ module Jekyll
raise ArgumentError, 'Stuck in a redirect loop. Please double check your email and password' if limit == 0
response = nil
puts uri_str
puts '-------'
Net::HTTP.start('posterous.com') do |http|
req = Net::HTTP::Get.new(uri_str)
req.basic_auth @email, @pass
@ -23,36 +29,50 @@ module Jekyll
case response
when Net::HTTPSuccess then response
when Net::HTTPRedirection then fetch(response['location'], limit - 1)
when Net::HTTPForbidden then
retry_after = response.to_hash['retry-after'][0]
puts "We have been told to try again after #{retry_after} seconds"
sleep(retry_after.to_i + 1)
fetch(uri_str, limit - 1)
else response.error!
end
end
def self.process(email, pass, api_token, blog = 'primary')
def self.process(email, pass, api_token, blog = 'primary', tags_key = 'categories')
@email, @pass, @api_token = email, pass, api_token
FileUtils.mkdir_p "_posts"
posts = JSON.parse(self.fetch("/api/v2/users/me/sites/#{blog}/posts?api_token=#{@api_token}").body)
posts = JSON.parse(self.fetch("/api/2/sites/#{blog}/posts?api_token=#{@api_token}").body)
page = 1
while posts.any?
posts.each do |post|
title = post["title"]
slug = title.gsub(/[^[:alnum:]]+/, '-').downcase
slug = title.gsub(/[^[:alnum:]]+/, '-').gsub(/^-+|-+$/, '').downcase
posterous_slug = post["slug"]
date = Date.parse(post["display_date"])
content = post["body_html"]
published = !post["is_private"]
name = "%02d-%02d-%02d-%s.html" % [date.year, date.month, date.day, slug]
tags = []
post["tags"].each do |tag|
tags.push(tag["name"])
end
# Get the relevant fields as a hash, delete empty fields and convert
# to YAML for the header
data = {
'layout' => 'post',
'title' => title.to_s,
'published' => published
'published' => published,
tags_key => tags,
'posterous_url' => post["full_url"],
'posterous_slug' => posterous_slug
}.delete_if { |k,v| v.nil? || v == ''}.to_yaml
# Write out the data and content to file
File.open("_posts/#{name}", "w") do |f|
puts name
f.puts data
f.puts "---"
f.puts content
@ -60,7 +80,7 @@ module Jekyll
end
page += 1
posts = JSON.parse(self.fetch("/api/v2/users/me/sites/#{blog}/posts?api_token=#{@api_token}&page=#{page}").body)
posts = JSON.parse(self.fetch("/api/2/sites/#{blog}/posts?api_token=#{@api_token}&page=#{page}").body)
end
end
end

View File

@ -8,12 +8,13 @@ module Jekyll
attr_accessor :lsi
end
# Valid post name regex.
MATCHER = /^(.+\/)*(\d+-\d+-\d+)-(.*)(\.[^.]+)$/
# Post name validator. Post filenames must be like:
# 2008-11-05-my-awesome-post.textile
# 2008-11-05-my-awesome-post.textile
#
# Returns <Bool>
# Returns true if valid, false if not.
def self.valid?(name)
name =~ MATCHER
end
@ -25,12 +26,13 @@ module Jekyll
attr_reader :name
# Initialize this Post instance.
# +site+ is the Site
# +base+ is the String path to the dir containing the post file
# +name+ is the String filename of the post file
# +categories+ is an Array of Strings for the categories for this post
#
# Returns <Post>
# site - The Site.
# base - The String path to the dir containing the post file.
# name - The String filename of the post file.
# categories - An Array of Strings for the categories for this post.
#
# Returns the new Post.
def initialize(site, source, dir, name)
@site = site
@base = File.join(source, dir, '_posts')
@ -38,10 +40,14 @@ module Jekyll
self.categories = dir.split('/').reject { |x| x.empty? }
self.process(name)
self.read_yaml(@base, name)
begin
self.read_yaml(@base, name)
rescue Exception => msg
raise FatalException.new("#{msg} in #{@base}/#{name}")
end
#If we've added a date and time to the yaml, use that instead of the filename date
#Means we'll sort correctly.
# If we've added a date and time to the YAML, use that instead of the
# filename date. Means we'll sort correctly.
if self.data.has_key?('date')
# ensure Time via to_s and reparse
self.date = Time.parse(self.data["date"].to_s)
@ -60,7 +66,10 @@ module Jekyll
end
end
# Spaceship is based on Post#date, slug
# Compares Post objects. First compares the Post date. If the dates are
# equal, it compares the Post slugs.
#
# other - The other Post we are comparing to.
#
# Returns -1, 0, 1
def <=>(other)
@ -71,10 +80,11 @@ module Jekyll
return cmp
end
# Extract information from the post filename
# +name+ is the String filename of the post file
# Extract information from the post filename.
#
# Returns nothing
# name - The String filename of the post file.
#
# Returns nothing.
def process(name)
m, cats, date, slug, ext = *name.match(MATCHER)
self.date = Time.parse(date)
@ -87,18 +97,17 @@ module Jekyll
# The generated directory into which the post will be placed
# upon generation. This is derived from the permalink or, if
# permalink is absent, set to the default date
# e.g. "/2008/11/05/" if the permalink style is :date, otherwise nothing
# e.g. "/2008/11/05/" if the permalink style is :date, otherwise nothing.
#
# Returns <String>
# Returns the String directory.
def dir
File.dirname(url)
end
# The full path and filename of the post.
# Defined in the YAML of the post body
# (Optional)
# The full path and filename of the post. Defined in the YAML of the post
# body (optional).
#
# Returns <String>
# Returns the String permalink.
def permalink
self.data && self.data['permalink']
end
@ -116,10 +125,10 @@ module Jekyll
end
end
# The generated relative url of this post
# The generated relative url of this post.
# e.g. /2008/11/05/my-awesome-post.html
#
# Returns <String>
# Returns the String URL.
def url
return @url if @url
@ -146,17 +155,17 @@ module Jekyll
@url
end
# The UID for this post (useful in feeds)
# The UID for this post (useful in feeds).
# e.g. /2008/11/05/my-awesome-post
#
# Returns <String>
# Returns the String UID.
def id
File.join(self.dir, self.slug)
end
# Calculate related posts.
#
# Returns [<Post>]
# Returns an Array of related Posts.
def related_posts(posts)
return [] unless posts.size > 1
@ -176,11 +185,12 @@ module Jekyll
end
end
# Add any necessary layouts to this post
# +layouts+ is a Hash of {"name" => "layout"}
# +site_payload+ is the site payload hash
# Add any necessary layouts to this post.
#
# Returns nothing
# layouts - A Hash of {"name" => "layout"}.
# site_payload - The site payload hash.
#
# Returns nothing.
def render(layouts, site_payload)
# construct payload
payload = {
@ -192,9 +202,10 @@ module Jekyll
end
# Obtain destination path.
# +dest+ is the String path to the destination dir
#
# Returns destination file path.
# dest - The String path to the destination dir.
#
# Returns destination file path String.
def destination(dest)
# The url needs to be unescaped in order to preserve the correct filename
path = File.join(dest, CGI.unescape(self.url))
@ -203,9 +214,10 @@ module Jekyll
end
# Write the generated post file to the destination directory.
# +dest+ is the String path to the destination dir
#
# Returns nothing
# dest - The String path to the destination dir.
#
# Returns nothing.
def write(dest)
path = destination(dest)
FileUtils.mkdir_p(File.dirname(path))
@ -216,7 +228,7 @@ module Jekyll
# Convert this post into a Hash for use in Liquid templates.
#
# Returns <Hash>
# Returns the representative Hash.
def to_liquid
self.data.deep_merge({
"title" => self.data["title"] || self.slug.split('-').select {|w| w.capitalize! || w }.join(' '),
@ -230,6 +242,7 @@ module Jekyll
"content" => self.content })
end
# Returns the shorthand String identifier of this Post.
def inspect
"<Post: #{self.id}>"
end

View File

@ -72,6 +72,12 @@ module Jekyll
def setup
require 'classifier' if self.lsi
# Check that the destination dir isn't the source dir or a directory
# parent to the source dir.
if self.source =~ /^#{self.dest}/
raise FatalException.new "Destination directory cannot be or contain the Source directory."
end
# If safe mode is off, load in any Ruby files under the plugins
# directory.
unless self.safe
@ -244,7 +250,6 @@ module Jekyll
files.merge(dirs)
obsolete_files = dest_files - files
FileUtils.rm_rf(obsolete_files.to_a)
end
@ -329,7 +334,7 @@ module Jekyll
#
# Returns the Array of filtered entries.
def filter_entries(entries)
entries = entries.reject do |e|
entries.reject do |e|
unless self.include.include?(e)
['.', '_', '#'].include?(e[0..0]) ||
e[-1..-1] == '~' ||

4
site/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
_site/
*.swp
pkg/
test/

1
site/CNAME Normal file
View File

@ -0,0 +1 @@
jekyllrb.com

1
site/README Normal file
View File

@ -0,0 +1 @@
Jekyll's awesome website.

5
site/_config.yml Normal file
View File

@ -0,0 +1,5 @@
auto: false
server: true
permalink: /docs/:categories/:title
pygments: true
gauges_id: 503c5af6613f5d0f19000027

View File

@ -0,0 +1,32 @@
{% if site.gauges_id %}
<!-- Gauges (http://gaug.es/) -->
<script type="text/javascript">
var _gauges = _gauges || [];
(function() {
var t = document.createElement('script');
t.type = 'text/javascript';
t.async = true;
t.id = 'gauges-tracker';
t.setAttribute('data-site-id', '{{ site.gauges_id }}');
t.src = '//secure.gaug.es/track.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(t, s);
})();
</script>
{% endif %}
{% if site.google_analytics_id %}
<!-- Google Analytics (http://google.com/analytics) -->
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', '{{ site.google_analytics_id }}']);
_gaq.push(['_setDomainName', '{{ site.url }}']); // Multiple sub-domains
_gaq.push(['_setAllowLinker', true]); // Multiple TLDs
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
{% endif %}

View File

@ -0,0 +1,79 @@
<div class="grid2">
<aside>
<h4>Getting Started</h4>
<ul>
<li class="{% if page.title == "Welcome" %}current{% endif %}">
<a href="{{ site.url }}/docs/home">Welcome</a>
</li>
<li class="{% if page.title == "Installation" %}current{% endif %}">
<a href="{{ site.url }}/docs/installation">Installation</a>
</li>
<li class="{% if page.title == "Basic Usage" %}current{% endif %}">
<a href="{{ site.url }}/docs/usage">Basic Usage</a>
</li>
<li class="{% if page.title == "Directory structure" %}current{% endif %}">
<a href="{{ site.url }}/docs/structure">Directory structure</a>
</li>
<li class="{% if page.title == "Configuration" %}current{% endif %}">
<a href="{{ site.url }}/docs/configuration">Configuration</a>
</li>
</ul>
<h4>Your Content</h4>
<ul>
<li class="{% if page.title == "Front-matter" %}current{% endif %}">
<a href="{{ site.url }}/docs/frontmatter">Front-matter</a>
</li>
<li class="{% if page.title == "Writing posts" %}current{% endif %}">
<a href="{{ site.url }}/docs/posts">Writing posts</a>
</li>
<li class="{% if page.title == "Creating pages" %}current{% endif %}">
<a href="{{ site.url }}/docs/pages">Creating pages</a>
</li>
<li class="{% if page.title == "Variables" %}current{% endif %}">
<a href="{{ site.url }}/docs/variables">Variables</a>
</li>
<li class="{% if page.title == "Blog migrations" %}current{% endif %}">
<a href="{{ site.url }}/docs/migrations">Blog migrations</a>
</li>
</ul>
<h4>Customization</h4>
<ul>
<li class="{% if page.title == "Templates" %}current{% endif %}">
<a href="{{ site.url }}/docs/templates">Templates</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>
<li class="{% if page.title == "Extras" %}current{% endif %}">
<a href="{{ site.url }}/docs/extras">Extras</a>
</li>
</ul>
<h4>Deployment</h4>
<ul>
<li class="{% if page.title == "GitHub Pages" %}current{% endif %}">
<a href="{{ site.url }}/docs/github-pages">GitHub Pages</a>
</li>
<li class="{% if page.title == "Deployment methods" %}current{% endif %}">
<a href="{{ site.url }}/docs/deployment-methods">Other methods</a>
</li>
</ul>
<h4>Miscellaneous</h4>
<ul>
<li class="{% if page.title == "Contributing" %}current{% endif %}">
<a href="{{ site.url }}/docs/contributing">Contributing</a>
</li>
<li class="{% if page.title == "Troubleshooting" %}current{% endif %}">
<a href="{{ site.url }}/docs/troubleshooting">Troubleshooting</a>
</li>
<li class="{% if page.title == "Resources" %}current{% endif %}">
<a href="{{ site.url }}/docs/resources">Resources</a>
</li>
</ul>
</aside>
</div>

View File

@ -0,0 +1,15 @@
<footer>
<div class="content">
<div class="grid4 first">
<p>By <a href="http://tom.preston-werner.com">Tom Preston-Werner</a>, <a href="http://quaran.to/">Nick Quaranto</a>, and many more <a href="https://github.com/mojombo/jekyll/graphs/contributors">awesome contributors</a>.</p>
</div>
<div class="grid8 align-right">
<p>Proudly hosted by</p>
<a href="https://github.com">
<img src="{{ site.url }}/img/footer-logo.png" alt="GitHub • Social coding">
</a>
</div>
<div class="clear"></div>
</div>
</footer>
<div class="clear"></div>

View File

@ -0,0 +1,26 @@
<header>
<div class="content">
<div class="grid3 first">
<h1>
<a href="{{ site.url }}/">
<span>Jekyll</span>
<img src="{{ site.url }}/img/logo-2x.png" width="249px" height="115px" alt="">
</a>
</h1>
</div>
<nav class="grid6">
<ul>
<li {% if page.overview %}class="current"{% endif %}>
<a href="{{ site.url }}/">Overview</a>
</li>
<li {% unless page.overview %}class="current"{% endunless %}>
<a href="{{ site.url }}/docs">Documentation</a>
</li>
<li class="">
<a href="https://github.com/mojombo/jekyll">View on GitHub</a>
</li>
</ul>
</nav>
<div class="clear"></div>
</div>
</header>

View File

@ -0,0 +1,22 @@
<div class="section-nav">
<div class="left align-right">
{% if page.prev_section != null %}
<a href="{{ site.url }}/docs/{{ page.prev_section }}" class="prev">
Back
</a>
{% else %}
<span class="prev disabled">Back</span>
{% endif %}
</div>
<div class="right align-left">
{% if page.next_section != null %}
<a href="{{ site.url }}/docs/{{ page.next_section }}" class="next">
Next
</a>
{% else %}
<span class="next disabled">Next</span>
{% endif %}
</div>
<div class="clear"></div>
</div>

14
site/_includes/top.html Normal file
View File

@ -0,0 +1,14 @@
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>{{ page.title }}</title>
<link href='http://fonts.googleapis.com/css?family=Lato:100,300,400,700,900,100italic,300italic,400italic,700italic,900italic' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Arizonia' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="{{ site.url }}/css/normalize.css" />
<link rel="stylesheet" href="{{ site.url }}/css/grid.css" />
<link rel="stylesheet" href="{{ site.url }}/css/style.css" />
<link rel="stylesheet" href="{{ site.url }}/css/pygments.css" />
<link rel="icon" type="image/x-icon" href="{{ site.url }}/favicon.png" />
<script src="{{ site.url }}/js/modernizr-2.5.3.min.js"></script>
</head>

View File

@ -0,0 +1,12 @@
{% include top.html %}
<body>
{% include header.html %}
{{ content }}
{% include footer.html %}
{% include analytics.html %}
</body>
</html>

21
site/_layouts/docs.html Normal file
View File

@ -0,0 +1,21 @@
---
layout: default
---
<section class="docs">
<div class="content">
<div class="grid10 first">
<article>
<h1>{{ page.title }}</h1>
{{ content }}
{% include section_nav.html %}
</article>
</div>
{% include docs_contents.html %}
<div class="clear"></div>
</div>
</section>

View File

@ -0,0 +1,250 @@
---
layout: docs
title: Configuration
prev_section: structure
next_section: frontmatter
---
Jekyll allows you to concoct your sites in any way you can dream up, and its thanks to the powerful and flexible configuration options that this is possible. These options can either be specified in a `_config.yml` file placed in your sites root directory, or can be specified as flags for the `jekyll` executable in the terminal.
## Configuration Settings
The table below lists the available settings for Jekyll, and the various <code class="option">options</code> (specifed in the configuration file) and <code class="flag">flags</code> (specified on the command-line) that control them.
<table>
<thead>
<tr>
<th>Setting</th>
<th><span class="option">Options</span> and <span class="flag">Flags</span></th>
</tr>
</thead>
<tbody>
<tr class='setting'>
<td>
<p class='name'><strong>Safe</strong></p>
<p class='description'>Disables <a href="../plugins">custom plugins</a>.</p>
</td>
<td class="align-center">
<p><code class="option">safe: [boolean]</code></p>
<p><code class="flag">--safe</code></p>
</td>
</tr>
<tr class='setting'>
<td>
<p class='name'><strong>Regeneration</strong></p>
<p class='description'>Enables or disables Jekyll from recreating the site when files are modified.</p>
</td>
<td class="align-center">
<p><code class="option">auto: [boolean]</code></p>
<p><code class="flag">--auto</code></p>
<p><code class="flag">--no-auto</code></p>
</td>
</tr>
<tr class='setting'>
<td>
<p class='name'><strong>Local Server</strong></p>
<p class='description'>Fires up a server that will host your <code>_site</code> directory</p>
</td>
<td class="align-center">
<p><code class="option">server: [boolean]</code></p>
<p><code class="flag">--server</code></p>
</td>
</tr>
<tr class='setting'>
<td>
<p class='name'><strong>Local Server Port</strong></p>
<p class='description'>Changes the port that the Jekyll server will run on</p>
</td>
<td class="align-center">
<p><code class="option">server_port: [integer]</code></p>
<p><code class="flag">--server [port]</code></p>
</td>
</tr>
<tr class='setting'>
<td>
<p class='name'><strong>Base URL</strong></p>
<p class='description'>Serve website from a given base URL</p>
</td>
<td class="align-center">
<p><code class="option">baseurl: [BASE_URL]</code></p>
<p><code class="flag">--base-url [url]</code></p>
</td>
</tr>
<tr class='setting'>
<td>
<p class='name'><strong>URL</strong></p>
<p class='description'>Sets <code>site.url</code>, useful for environment switching</p>
</td>
<td class="align-center">
<p><code class="option">url: [URL]</code></p>
<p><code class="flag">--url [URL]</code></p>
</td>
</tr>
<tr class='setting'>
<td>
<p class='name'><strong>Site Destination</strong></p>
<p class="description">Changes the directory where Jekyll will write files to</p>
</td>
<td class='align-center'>
<p><code class="option">destination: [dir]</code></p>
<p><code class="flag">jekyll [dest]</code></p>
</td>
</tr>
<tr class='setting'>
<td>
<p class='name'><strong>Site Source</strong></p>
<p class="description">Changes the directory where Jekyll will look to transform files</p>
</td>
<td class='align-center'>
<p><code class="option">source: [dir]</code></p>
<p><code class="flag">jekyll [source] [dest]</code></p>
</td>
</tr>
<tr class='setting'>
<td>
<p class='name'><strong>Markdown</strong></p>
<p class="description">Uses RDiscount or <code>[engine]</code> instead of Maruku.</p>
</td>
<td class='align-center'>
<p><code class="option">markdown: [engine]</code></p>
<p><code class="flag">--rdiscount</code></p>
<p><code class="flag">--kramdown</code></p>
<p><code class="flag">--redcarpet</code></p>
</td>
</tr>
<tr class='setting'>
<td>
<p class='name'><strong>Pygments</strong></p>
<p class="description">Enables highlight tag with Pygments.</p>
</td>
<td class='align-center'>
<p><code class="option">pygments: [boolean]</code></p>
<p><code class="flag">--pygments</code></p>
</td>
</tr>
<tr class='setting'>
<td>
<p class='name'><strong>Future</strong></p>
<p class="description">Publishes posts with a future date</p>
</td>
<td class='align-center'>
<p><code class="option">future: [boolean]</code></p>
<p><code class="flag">--no-future</code></p>
<p><code class="flag">--future</code></p>
</td>
</tr>
<tr class='setting'>
<td>
<p class='name'><strong>LSI</strong></p>
<p class="description">Produces an index for related posts.</p>
</td>
<td class='align-center'>
<p><code class="option">lsi: [boolean]</code></p>
<p><code class="flag">--lsi</code></p>
</td>
</tr>
<tr class='setting'>
<td>
<p class='name'><strong>Permalink</strong></p>
<p class="description">Controls the URLs that posts are generated with. Please refer to the <a href="../permalinks">Permalinks</a> page for more info.</p>
</td>
<td class='align-center'>
<p><code class="option">permalink: [style]</code></p>
<p><code class="flag">--permalink=[style]</code></p>
</td>
</tr>
<tr class='setting'>
<td>
<p class='name'><strong>Pagination</strong></p>
<p class="description">Splits your posts up over multiple subdirectories called "page2", "page3", ... "pageN"</p>
</td>
<td class='align-center'>
<p><code class="option">paginate: [per_page]</code></p>
<p><code class="flag">--paginate [per_page]</code></p>
</td>
</tr>
<tr class='setting'>
<td>
<p class='name'><strong>Exclude</strong></p>
<p class="description">A list of directories and files to exclude from the conversion</p>
</td>
<td class='align-center'>
<p><code class="option">exclude: [dir1, file1, dir2]</code></p>
</td>
</tr>
<tr class='setting'>
<td>
<p class='name'><strong>Include</strong></p>
<p class="description">A list of directories and files to specifically include in the conversion. <code>.htaccess</code> is a good example since dotfiles are excluded by default.</p>
</td>
<td class='align-center'>
<p><code class="option">include: [dir1, file1, dir2]</code></p>
</td>
</tr>
<tr class='setting'>
<td>
<p class='name'><strong>Limit Posts</strong></p>
<p class="description">Limits the number of posts to parse and publish</p>
</td>
<td class='align-center'>
<p><code class="option">limit_posts: [max_posts]</code></p>
<p><code class="flag">--limit_posts=[max_posts]</code></p>
</td>
</tr>
</tbody>
</table>
<div class="note warning">
<h5>Do not use tabs in configuration files</h5>
<p>This will either lead to parsing errors, or Jekyll will revert to the default settings. Use spaces instead.</p>
</div>
## Default Configuration
Jekyll runs with the following configuration options by default. Unless alternative settings for these options are explicitly specified in the configuration file or on the command-line, Jekyll will run using these options.
{% highlight yaml %}
safe: false
auto: false
server: false
server_port: 4000
baseurl: /
url: http://localhost:4000
source: .
destination: ./_site
plugins: ./_plugins
future: true
lsi: false
pygments: false
markdown: maruku
permalink: date
maruku:
use_tex: false
use_divs: false
png_engine: blahtex
png_dir: images/latex
png_url: /images/latex
rdiscount:
extensions: []
kramdown:
auto_ids: true,
footnote_nr: 1
entity_output: as_char
toc_levels: 1..6
use_coderay: false
coderay:
coderay_wrap: div
coderay_line_numbers: inline
coderay_line_numbers_start: 1
coderay_tab_width: 4
coderay_bold_every: 10
coderay_css: style
{% endhighlight %}

View File

@ -0,0 +1,66 @@
---
layout: docs
title: Contributing
prev_section: deployment-methods
next_section: troubleshooting
---
Contributions to Jekyll are always welcome, however theres a few things that you should keep in mind to improve your chances of having your changes merged in.
## Workflow
Heres the most typical way to get your change merged into the project:
1. Fork the project [on GitHub](https://github.com/mojombo/jekyll) and clone it down to your local machine.
2. Create a topic branch to contain your change.
3. Hack away, add tests. Not necessarily in that order.
4. Make sure all the existing tests still pass.
5. If necessary, rebase your commits into logical chunks, without errors.
6. Push the branch up to your fork on GitHub.
7. Create an issue on GitHub with a link to your branch.
<div class="note warning">
<h5>Contributions will not be accepted without tests</h5>
<p>If youre creating a small fix or patch to an existing feature, just
a simple test will do.</p>
</div>
## Tests
Were big on tests, so please be sure to include them. Please stay in the confines of the current test suite and use [Shoulda](https://github.com/thoughtbot/shoulda) and [RR](https://github.com/btakita/rr).
### Tests for brand-new features
If its a brand new feature, make sure to create a new [Cucumber](https://github.com/cucumber/cucumber/) feature and reuse steps where appropriate. Also, whipping up some documentation in your forks `gh-pages` branch would be appreciated, so the main website can be updated as soon as your new feature is merged.
### Test dependencies
To run the test suite and build the gem youll need to install Jekylls dependencies. Jekyll uses Bundler, so a quick run of the bundle command and youre all set!
{% highlight bash %}
$ bundle
{% endhighlight %}
Before you start, run the tests and make sure that they pass (to confirm
your environment is configured properly):
{% highlight bash %}
$ rake test
$ rake features
{% endhighlight %}
## Common Gotchas
- If you want to bump the gem version, please put that in a separate
commit. This way, the maintainers can control when the gem gets released.
- Try to keep your patch(es) based from [the latest commit on
mojombo/jekyll](https://github.com/mojombo/jekyll/commits/master). The easier it is to apply your work, the less work
the maintainers have to do, which is always a good thing.
- Please dont tag your GitHub issue with labels like “fix” or “feature”.
The maintainers actively read the issues and will label it once they come
across it.
<div class="note">
<h5>Let us know what could be better!</h5>
<p>Both using and hacking on Jekyll should be fun, simple, and easy, so if for some reason you find its a pain, please <a href="https://github.com/mojombo/jekyll/issues/new">create an issue</a> on GitHub describing your experience so we can make it better.</p>
</div>

View File

@ -0,0 +1,108 @@
---
layout: docs
title: Deployment methods
prev_section: github-pages
next_section: contributing
---
Sites built using Jekyll can be deployed in a large number of ways due to the static nature of the generated output. A few of the most common deployment techniques are described below.
## Web hosting providers (FTP)
Just about any traditional web hosting provider will let you upload files to their servers over FTP. To upload a Jekyll site to a web host using FTP, simply run the `jekyll` command and copy the generated `_site` folder to the root folder of your hosting account. This is most likely to be the `httpdocs` or `public_html` folder on most hosting providers.
### FTP using Glynn
There is a project called [Glynn](https://github.com/dmathieu/glynn), which lets you easily generate your Jekyll powered websites static files and
send them to your host through FTP.
## Self-managed web server
If you have direct access yourself to the deployment web server yourself, the process is essentially the same, except you might have other methods available to you (such as `scp`, or even direct filesystem access) for transferring the files. Just remember to make sure the contents of the generated `_site` folder get placed in the appropriate web root directory for your web server.
## Automated methods
There are also a number of ways to easily automate the deployment of a Jekyll site. If youve got another method that isnt listed below, wed love it if you [contributed](../contributing) so that everyone else can benefit too.
### Git post-update hook
If you store your jekyll site in [Git](http://git-scm.com/) (you are using version control, right?), its pretty easy to automate the
deployment process by setting up a post-update hook in your Git
repository, [like
this](http://web.archive.org/web/20091223025644/http://www.taknado.com/en/2009/03/26/deploying-a-jekyll-generated-site/).
### Git post-receive hook
To have a remote server handle the deploy for you every time you push changes using Git, you can create a user account which has all the public keys that are authorized to deploy in its `authorized_keys` file. With that in place, setting up the post-receive hook is done as follows:
{% highlight bash %}
laptop$ ssh deployer@myserver.com
server$ mkdir myrepo.git
server$ cd myrepo.git
server$ git --bare init
server$ cp hooks/post-receive.sample hooks/post-receive
server$ mkdir /var/www/myrepo
{% endhighlight %}
Next, add the following lines to hooks/post-receive and be sure Jekyll is
installed on the server:
{% highlight bash %}
GIT_REPO=$HOME/myrepo.git
TMP_GIT_CLONE=$HOME/tmp/myrepo
PUBLIC_WWW=/var/www/myrepo
git clone $GIT_REPO $TMP_GIT_CLONE
jekyll --no-auto $TMP_GIT_CLONE $PUBLIC_WWW
rm -Rf $TMP_GIT_CLONE
exit
{% endhighlight %}
Finally, run the following command on any users laptop that needs to be able to
deploy using this hook:
{% highlight bash %}
laptops$ git remote add deploy deployer@myserver.com:~/myrepo.git
{% endhighlight %}
Deploying is now as easy as telling nginx or Apache to look at
`/var/www/myrepo` and running the following:
{% highlight bash %}
laptops$ git push deploy master
{% endhighlight %}
### Rake
Another way to deploy your Jekyll site is to use [Rake](https://github.com/jimweirich/rake), [HighLine](https://github.com/JEG2/highline), and
[Net::SSH](http://net-ssh.rubyforge.org/). A more complex example of deploying Jekyll with Rake that deals with multiple branches can be found in [Git Ready](https://github.com/gitready/gitready/blob/en/Rakefile).
### rsync
Once youve generated the `_site` directory, you can easily rsync it using a `tasks/deploy` shell script similar to [this deploy script here](http://github.com/henrik/henrik.nyh.se/blob/master/tasks/deploy). Youd obviously need to change the values to reflect your sites details. There is even [a matching TextMate command](http://gist.github.com/214959) that will help you run
this script from within Textmate.
## Rack-Jekyll
[Rack-Jekyll](http://github.com/bry4n/rack-jekyll/) is an easy way to deploy your site on any Rack server such as Amazon EC2, Slicehost, Heroku, and so forth. It also can run with [shotgun](http://github.com/rtomakyo/shotgun/), [rackup](http://github.com/rack/rack), [mongrel](http://github.com/mongrel/mongrel), [unicorn](http://github.com/defunkt/unicorn/), and [others](https://github.com/adaoraul/rack-jekyll#readme).
Read [this post](http://blog.crowdint.com/2010/08/02/instant-blog-using-jekyll-and-heroku.html) on how to deploy to Heroku using Rack-Jekyll.
## Jekyll-Admin for Rails
If you want to maintain Jekyll inside your existing Rails app, [Jekyll-Admin](http://github.com/zkarpinski/Jekyll-Admin) contains drop in code to make this possible. See Jekyll-Admins [README](http://github.com/zkarpinski/Jekyll-Admin/blob/master/README) for more details.
## Amazon S3
If you want to host your site in Amazon S3, you can do so with
[jekyll-s3](https://github.com/laurilehmijoki/jekyll-s3) application. It will
push your site to Amazon S3 where it can be served like any web server,
dynamically scaling to almost unlimited traffic. This approach has the
benefit of being about the cheapest hosting option available for
low-volume blogs as you only pay for what you use.
<div class="note">
<h5>ProTip™: Use GitHub Pages for zero-hassle Jekyll hosting</h5>
<p>GitHub Pages are powered by Jekyll behind the scenes, so if youre looking for a zero-hassle, zero-cost solution, GitHub Pages are a great way to <a href="../github-pages">host your Jekyll-powered website for free</a>.</p>
</div>

View File

@ -0,0 +1,103 @@
---
layout: docs
title: Extras
prev_section: plugins
next_section: github-pages
---
There are a number of (optional) extra features that Jekyll supports that you may want to install, depending on how you plan to use Jekyll.
## Pygments
If you want syntax highlighting via the `{{ "{% highlight " }}%}` tag in your
posts, youll need to install [Pygments](http://pygments.org/).
### Installing Pygments on OSX
Mac OS X (Leopard onwards) come preinstalled with Python, so on just about any OS X machine you can install Pygments simply by running:
{% highlight bash %}
sudo easy_install Pygments
{% endhighlight %}
#### Installing Pygments using Homebrew
Alternatively, you can install Pygments with [Homebrew](http://mxcl.github.com/homebrew/), an excellent package manager for OS X:
{% highlight bash %}
brew install python
# export PATH="/usr/local/share/python:${PATH}"
easy_install pip
pip install --upgrade distribute
pip install pygments
{% endhighlight %}
**ProTip™**: Homebrew doesnt symlink the executables for you. For the Homebrew default Cellar location and Python 2.7, be sure to add `/usr/local/share/python` to your `PATH`. For more information, check out [the Homebrew wiki](https://github.com/mxcl/homebrew/wiki/Homebrew-and-Python).
#### Installing Pygments using MacPorts
If you use MacPorts, you can install Pygments by running:
{% highlight bash %}
sudo port install python25 py25-pygments
{% endhighlight %}
Seriously though, you should check out [Homebrew](http://mxcl.github.com/homebrew/)—its awesome.
### Installing Pygments on Arch Linux
You can install Pygments using the pacman package manager as follows:
{% highlight bash %}
sudo pacman -S python-pygments
{% endhighlight %}
Or to use python2 for Pygments:
{% highlight bash %}
sudo pacman -S python2-pygments
{% endhighlight %}
### Installing Pygments on Ubuntu and Debian
{% highlight bash %}
sudo apt-get install python-pygments
{% endhighlight %}
### Installing Pygments on RedHat, Fedora, and CentOS
{% highlight bash %}
sudo yum install python-pygments
{% endhighlight %}
### Installing Pygments on Gentoo
{% highlight bash %}
sudo emerge -av dev-python/pygments
{% endhighlight %}
## LaTeX Support
Maruku comes with optional support for LaTeX to PNG rendering via
blahtex (Version 0.6) which must be in your `$PATH` along with `dvips`. If you need Maruku to not assume a fixed location for `dvips`, check out [Remis Maruku fork](http://github.com/remi/maruku).
## RDiscount
If you prefer to use [RDiscount](http://github.com/rtomayko/rdiscount) instead of [Maruku](http://maruku.rubyforge.org/) for markdown, just make sure you have it installed:
{% highlight bash %}
sudo gem install rdiscount
{% endhighlight %}
And then run Jekyll with the following option:
{% highlight bash %}
jekyll --rdiscount
{% endhighlight %}
Or, specify RDiscount as the markdown engine in your `_config.yml` file to have Jekyll run with that option by default (so you dont have to specify the flag every time).
{% highlight bash %}
# In _config.yml
markdown: rdiscount
{% endhighlight %}

View File

@ -0,0 +1,120 @@
---
layout: docs
title: Front-matter
prev_section: configuration
next_section: posts
---
The front-matter is where Jekyll starts to get really cool. Any files that contain a [YAML](http://yaml.org/) front matter block will be processed by Jekyll as special files. The front matter must be the first thing in the file and must take the form of sets of variables and values set between triple-dashed lines. Here is a basic example:
{% highlight yaml %}
---
layout: post
title: Blogging Like a Hacker
---
{% endhighlight %}
Between these triple-dashed lines, you can set predefined variables (see below for a reference) or even create custom ones of your own. These variables will then be available to you to access using Liquid tags both further down in the file and also in any layouts or includes that the page or post in question relies on.
<div class="note warning">
<h5>UTF-8 Character Encoding Warning</h5>
<p>If you use UTF-8 encoding, make sure that no <code>BOM</code> header characters exist in your files or very, very bad things will happen to Jekyll. This is especially relevant if youre running Jekyll on Windows.</p>
</div>
## Predefined Global Variables
There are a number of predefined global variables that you can set in the front-matter of a page or post.
<table>
<thead>
<tr>
<th>Variable</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<p><code>layout</code></p>
</td>
<td>
<p>If set, this specifies the layout file to use. Use the layout file name without file extension. Layout files must be placed in the <code>_layouts</code> directory.</p>
</td>
</tr>
<tr>
<td>
<p><code>permalink</code></p>
</td>
<td>
<p>If you need your processed URLs to be something other than the default <code>/year/month/day/title.html</code> then you can set this variable and it will be used as the final URL.</p>
</td>
</tr>
<tr>
<td>
<p><code>published</code></p>
</td>
<td>
<p>Set to false if you dont want a post to show up when the site is generated.</p>
</td>
</tr>
<tr>
<td>
<p style="margin-bottom: 5px;"><code>category</code></p>
<p><code>categories</code></p>
</td>
<td>
<p>Instead of placing posts inside of folders, you can specify one or more categories that the post belongs to. When the site is generated the post will act as though it had been set with these categories normally. Categories (plural key) can be specified as a <a href="http://en.wikipedia.org/wiki/YAML#Lists">YAML list</a> or a space-separated string.</p>
</td>
</tr>
<tr>
<td>
<p><code>tags</code></p>
</td>
<td>
<p>Similar to categories, one or multiple tags can be added to a post. Also like categories, tags can be specified as a YAML list or a space-separated string.</p>
</td>
</tr>
</tbody>
</table>
## Custom Variables
Any variables in the front matter that are not predefined are mixed into
the data that is sent to the Liquid templating engine during the
conversion. For instance, if you set a title, you can use that in your
layout to set the page title:
{% highlight html %}
<!DOCTYPE HTML>
<html>
<head>
<title>{{ "{{ page.title " }}}}</title>
</head>
<body>
...
{% endhighlight %}
## Predefined Variables for Posts
These are available out-of-the-box to be used in the front-matter for a
post.
<table>
<thead>
<tr>
<th>Variable</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<p><code>date</code></p>
</td>
<td>
<p>A date here overrides the date from the name of the post. This can be used to ensure correct sorting of posts.</p>
</td>
</tr>
</tbody>
</table>

View File

@ -0,0 +1,34 @@
---
layout: docs
title: GitHub Pages
prev_section: extras
next_section: deployment-methods
---
[GitHub Pages](https://pages.github.com) are public web pages for users, organizations, and repositories, that are freely hosted on [GitHub](https://github.com/). GitHub Pages are powered by Jekyll behind the scenes, so in addition to supporting regular HTML content, theyre also a great way to host your Jekyll-powered website for free.
## Deploying Jekyll to GitHub Pages
GitHub Pages work by looking at certain branches of repositories on GitHub. There are two basic types of Pages available, user/organization Pages and project Pages. The way to deploy these two types of pages are nearly identical, except for a few minor details.
### User and Organization Pages
User and organization Pages live in a special GitHub repository dedicated to only the Pages files. This repository must be named after the account name. For example, [@mojombos user page repository](https://github.com/mojombo/mojombo.github.com) has the name `mojombo.github.com`.
Content from the `master` branch of your repository will be used to build and publish the GitHub Pages site, so make sure your Jekyll site is stored there.
<div class="note info">
<h5>Custom domains do not affect repository names</h5>
<p>GitHub Pages are initially configured to live under the `username.github.com` subdomain, which is why repositories must be named this way <strong>even if a custom domain is being used</strong>.</p>
</div>
### Project Pages
Unlike user and organization Pages, Project Pages are kept in the same repository as the project they are for, except that the website content is stored in a specially named `gh-pages` branch. The content of this branch will be used to rendered using Jekyll, and the output will become available under a subpath of your user pages subdomain, such as `username.github.com/project` (unless a custom domain is specified—see below).
The Jekyll project repository itself is a perfect example of this branch structure—the [master branch](https://github.com/mojombo/jekyll) contains the actual software project for Jekyll, however the Jekyll website (that youre looking at right now) is contained in the [gh-pages branch](https://github.com/mojombo/jekyll/tree/gh-pages) of the same repository.
<div class="note">
<h5>GitHub Pages Documentation, Help, and Support</h5>
<p>For more information about what you can do with GitHub Pages, as well as for troubleshooting guides, you should check out <a href="https://help.github.com/categories/20/articles">GitHubs Pages Help section</a>. If all else fails, you should contact <a href="https://github.com/contact">GitHub Support</a>.</p>
</div>

View File

@ -0,0 +1,8 @@
---
layout: docs
title: Heroku
prev_section: github-pages
next_section: manual-deployment
---
Move along, people. Nothing to see here.

View File

@ -0,0 +1,47 @@
---
layout: docs
title: Welcome
next_section: installation
---
This site aims to be a comprehensive guide to Jekyll. Well cover everything from getting your site up and running, creating and managing your content, customizing the way your site works and looks, deploying to various environments, as well as some advice on participating in the future development of Jekyll itself.
## So what is Jekyll, exactly?
Jekyll is a simple, blog-aware, static site generator. It takes a template directory containing raw text files in various formats, runs it through [Markdown](http://daringfireball.net/projects/markdown/) (or [Textile](http://textile.sitemonks.com/)) and [Liquid](http://liquidmarkup.org/) converters, and spits out a complete, ready-to-publish static website suitable for serving with your favorite web server. Jekyll also happens to be the engine behind [GitHub Pages](http://pages.github.com), which means you can use Jekyll to host your projects page, blog, or website from GitHubs servers **for free**.
## Quick-start guide
For the impatient, here's how to get Jekyll up and running.
{% highlight bash %}
~ $ gem install jekyll
~ $ mkdir -p my/new/site
~ $ cd my/new/site
~ $ vim index.html
~/my/new/site $ jekyll --server
# => Now browse to http://localhost:4000
{% endhighlight %}
That's nothing though. The real magic happens when you start creating posts, using the front-matter to conrol templates and layouts, and taking advantage of all the awesome configuration options Jekyll makes available.
## ProTips™, Notes, and Warnings
Throughout this guide there are a number of small-but-handy pieces of information that can make using Jekyll easier, more interesting, and less hazardous. Heres what to look out for.
<div class="note">
<h5>ProTips™ help you get more from Jekyll</h5>
<p>These are tips and tricks that will help you be a Jekyll wizard!</p>
</div>
<div class="note info">
<h5>Notes are handy pieces of information</h5>
<p>These are for the extra tidbits sometimes necessary to understand Jekyll.</p>
</div>
<div class="note warning">
<h5>Warnings help you not blow things up</h5>
<p>Be aware of these messages if you wish to avoid certain death.</p>
</div>
If you come across anything along the way that we havent covered, or if you know of a tip yourself you think others would find handy, please [file an issue](https://github.com/mojombo/jekyll/issues/new) and well see about including it in this guide.

View File

@ -0,0 +1,43 @@
---
layout: docs
title: Installation
prev_section: home
next_section: usage
---
Getting Jekyll installed and ready-to-go should only take a few minutes. If it ever becomes a pain in the ass, you should [file an issue](https://github.com/mojombo/jekyll/issues/new) (or submit a pull request) about what might be a better way to do things.
### Requirements
Installing Jekyll is easy and straight-forward, but theres a few requirements youll need to make sure your system has before you start.
- [Ruby](http://www.ruby-lang.org/en/downloads/)
- [RubyGems](http://rubygems.org/pages/download)
- Linux, Unix, or Mac OS X
<div class="note info">
<h5>Running Jekyll on Windows</h5>
<p>It is possible to get <a href="http://www.madhur.co.in/blog/2011/09/01/runningjekyllwindows.html">Jekyll running on Windows</a> however the official documentation does not support installation on Windows platforms.</p>
</div>
## Install with RubyGems
The best way to install Jekyll is via
[RubyGems](http://docs.rubygems.org/read/chapter/3). At the terminal prompt, simply run the following command to install Jekyll:
{% highlight bash %}
gem install jekyll
{% endhighlight %}
All Jekylls gem dependancies are automatically installed by the above command, so you wont have to worry about them at all. If you have problems installing Jekyll, check out the [troubleshooting](../troubleshooting) page or [report an issue](https://github.com/mojombo/jekyll/issues/new) so the Jekyll community can improve the experience for everyone.
## Optional Extras
There are a number of (optional) extra features that Jekyll supports that you may want to install, depending on how you plan to use Jekyll. These extras include syntax highlighting of code snippets using [Pygments](http://pygments.org/), LaTeX support, and the use of alternative content rendering engines. Check out [the extras page](../extras) for more information.
<div class="note">
<h5>ProTip™: Enable Syntax Highlighting</h5>
<p>If youre the kind of person who is using Jekyll, then chances are youll definitely want to enable syntax highlighting using Pygments. You should really <a href="../extras">check out how to do that</a> before you go any further.</p>
</div>
Now that youve got everything installed, lets get to work!

View File

@ -0,0 +1,180 @@
---
layout: docs
title: Blog migrations
prev_section: variables
next_section: templates
---
If youre switching to Jekyll from another blogging system, Jekylls migrators can help you with the move. Most methods listed on this page require read access to the database to generate posts from your old system. Each method generates `.markdown` posts in the `_posts` directory based on the entries in the database.
## Preparing for migrations
The migrators are [built-in to the Jekyll gem](https://github.com/mojombo/jekyll/tree/master/lib/jekyll/migrators), and require a few things to be set up in your project directory before they are run. This should all be done from the root folder of your Jekyll project.
{% highlight bash %}
$ mkdir _import
$ gem install sequel mysqlplus
{% endhighlight %}
You should now be all set to run the migrators below.
<div class="note info">
<h5>Note: Always double-check migrated content</h5>
<p>Import scripts may not distinguish between published or private posts, so you should always check that the content Jekyll generates for you appears as you intended.</p>
</div>
## WordPress
### Wordpress export files
If hpricot is not already installed, you will need to run `gem install hpricot`. Next, export your blog using the Wordpress export utility. Assuming that exported file is saved as `wordpress.xml`, here is the command you need to run:
{% highlight bash %}
$ ruby -rubygems -e 'require "jekyll/migrators/wordpressdotcom";
Jekyll::WordpressDotCom.process("wordpress.xml")'
{% endhighlight %}
<div class="note">
<h5>ProTip™: Wordpress.com Export Tool</h5>
<p>If you are migrating from a Wordpress.com account, you can access the export tool at the following URL: `https://YOUR-USER-NAME.wordpress.com/wp-admin/export.php`.</p>
</div>
### Using Wordpress MySQL server connection
If you want to import using a direct connection to the Wordpress MySQL server, here's how:
{% highlight bash %}
$ ruby -rubygems -e 'require "jekyll/migrators/wordpress";
Jekyll::WordPress.process("database", "user", "pass")'
{% endhighlight %}
If you are using Webfaction and have to set an [SSH tunnel](http://docs.webfaction.com/user-guide/databases.html?highlight=mysql#starting-an-ssh-tunnel-with-ssh), make sure to make the hostname (`127.0.0.1`) explicit, otherwise MySQL may block your access based on localhost and `127.0.0.1` not being equivalent in its authentication system:
{% highlight bash %}
$ ruby -rubygems -e 'require "jekyll/migrators/wordpress";
Jekyll::WordPress.process("database", "user", "pass", "127.0.0.1")'
{% endhighlight %}
### Further Wordpress migration alternatives
While the above methods work, they do not import much of the metadata that is usually stored in Wordpress posts and pages. If you need to export things like pages, tags, custom fields, image attachments and so on, the following resources might be useful to you:
- [Exitwp](https://github.com/thomasf/exitwp) is a configurable tool written in Python for migrating one or more Wordpress blogs into Jekyll (Markdown) format while keeping as much metadata as possible. Exitwp also downloads attachments and pages.
- [A great article](http://vitobotta.com/how-to-migrate-from-wordpress-to-jekyll/) with a step-by-step guide for migrating a Wordpress blog to Jekyll while keeping most of the structure and metadata.
- [wpXml2Jekyll](https://github.com/theaob/wpXml2Jekyll) is an executable windows application for creating Markdown posts from your Wordpress XML file.
## Drupal
If youre migrating from [Drupal](), there is [a migrator](https://github.com/mojombo/jekyll/blob/master/lib/jekyll/migrators/drupal.rb) for you too:
{% highlight bash %}
$ ruby -rubygems -e 'require "jekyll/migrators/drupal";
Jekyll::Drupal.process("database", "user", "pass")'
{% endhighlight %}
<div class="note warning">
<h5>Warning: Drupal Version Compatibility</h5>
<p>This migrator was written for Drupal 6.1 and may not work as expected on future versions of Drupal. Please update it and send us a pull request if necessary.</p>
</div>
## Movable Type
To import posts from Movable Type:
{% highlight bash %}
$ ruby -rubygems -e 'require "jekyll/migrators/mt";
Jekyll::MT.process("database", "user", "pass")'
{% endhighlight %}
## Typo
To import posts from Typo:
{% highlight bash %}
$ ruby -rubygems -e 'require "jekyll/migrators/typo";
Jekyll::Typo.process("database", "user", "pass")'
{% endhighlight %}
This code also has only been tested with Typo version 4+.
## TextPattern
To import posts from TextPattern:
{% highlight bash %}
$ ruby -rubygems -e 'require "jekyll/migrators/textpattern";
Jekyll::TextPattern.process("database_name", "username", "password", "hostname")'
{% endhighlight %}
You will need to run the above from the parent directory of your `_import` folder. For example, if `_import` is located in `/path/source/_import`, you will need to run this code from `/path/source`. The hostname defaults to `localhost`, all other variables are required. You may need to adjust the code used to filter entries. Left alone, it will attempt to pull all entries that are live or sticky.
## Mephisto
To import posts from Mephisto:
{% highlight bash %}
$ ruby -rubygems -e 'require "jekyll/migrators/mephisto";
Jekyll::Mephisto.process("database", "user", "password")'
{% endhighlight %}
If your data is in Postgres, you should do this instead:
{% highlight bash %}
$ ruby -rubygems -e 'require "jekyll/migrators/mephisto";
Jekyll::Mephisto.postgres({:database => "database", :username=>"username", :password =>"password"})'
{% endhighlight %}
## Blogger (Blogspot)
To import posts from Blogger, see [this post about migrating from Blogger to Jekyll](http://coolaj86.info/articles/migrate-from-blogger-to-jekyll.html). If that doesnt work for you, you might want to try some of the following alternatives:
- [@kennym](https://github.com/kennym) created a [little migration script](https://gist.github.com/1115810), because the solutions in the previous article didn't work out for him.
- [@ngauthier](https://github.com/ngauthier) created [another importer](https://gist.github.com/1506614) that imports comments, and does so via bloggers archive instead of the RSS feed.
- [@juniorz](https://github.com/juniorz) created [yet another importer](https://gist.github.com/1564581) that works for [Octopress](http://octopress.org). It is like [@ngauthiers version](https://gist.github.com/1506614) but separates drafts from posts, as well as importing tags and permalinks.
## Posterous
To import posts from your primary Posterous blog:
{% highlight bash %}
$ ruby -rubygems -e 'require "jekyll/migrators/posterous";
Jekyll::Posterous.process("my_email", "my_pass")'
{% endhighlight %}
For any other Posterous blog on your account, you will need to specify the `blog_id` for the blog:
{% highlight bash %}
$ ruby -rubygems -e 'require "jekyll/migrators/posterous";
Jekyll::Posterous.process("my_email", "my_pass", "blog_id")'
{% endhighlight %}
There is also an [alternative Posterous migrator](https://github.com/pepijndevos/jekyll/blob/patch-1/lib/jekyll/migrators/posterous.rb) that maintains permalinks and attempts to import images too.
## Tumblr
To import posts from Tumblr:
{% highlight bash %}
$ ruby -rubygems -e 'require "jekyll/migrators/tumblr";
Jekyll::Tumblr.process("http://www.your_blog_url.com", true)'
{% endhighlight %}
There is also [a modified Tumblr migrator](https://github.com/stephenmcd/jekyll/blob/master/lib/jekyll/migrators/tumblr.rb) that exports posts as Markdown and preserves post tags.
The migrator above requires the `json` gem and Python's `html2text` to be installed as follows:
{% highlight bash %}
$ gem install json
$ pip install html2text
{% endhighlight %}
Once installed, simply use the format argument:
{% highlight bash %}
$ ruby -rubygems -e 'require "jekyll/migrators/tumblr";
Jekyll::Tumblr.process("http://www.your_blog_url.com", format="md")'
{% endhighlight %}
## Other Systems
If you have a system that there isnt currently a migrator for, you should consider writing one and sending us a pull request.

View File

@ -0,0 +1,62 @@
---
layout: docs
title: Creating pages
prev_section: posts
next_section: variables
---
As well as [writing posts](../posts), the other thing you may want to do with your Jekyll site is create static pages. This is pretty simple to do, simply by taking advantage of the way Jekyll copies files and directories.
## Homepage
Just about every web server configuration youll come across will look for a HTML file called `index.html` (by convention) in the site root folder and display that as the homepage. Unless the web server youre using is configured to look for some different filename as the default, this file will turn into the homepage of your Jekyll-generated site.
<div class="note">
<h5>ProTip™: Use layouts on your homepage</h5>
<p>Any HTML file on your site can make use of layouts and includes, even the homepage. Its usually a good idea to extract everything that is the same across all your pages into an included file in a layout.</p>
</div>
## Where additional pages live
Where you put HTML files for pages depends on how you want the pages to work, since there are two main ways of creating pages:
- By placing named HTML files for each page in the site root folder.
- Create a folder in the site root for each page, and placing an index.html file in each page folder.
Both methods work fine (and can be used in conduction with each other), with the only real difference being the resulting URLs each page has.
### Named HTML files
The simplest way of adding a page is just to add a HTML file in the root directory with a suitable name for the page you want to create. For a site with a homepage, an about page, and a contact page, heres what the root directory and associated URLs might look like.
{% highlight bash %}
.
|-- _config.yml
|-- _includes
|-- _layouts
|-- _posts
|-- _site
|-- about.html #=> http://yoursite.com/about.html
|-- index.html #=> http://yoursite.com/
└── contact.html #=> http://yoursite.com/contact.html
{% endhighlight %}
### Named folders containing index HTML files
There is nothing wrong with the above method, however some people like to keep their URLs free from things like filename extensions. To achieve clean URLs for pages using Jekyll, you simply need to create a folder for each top-level page you want, and then place an `index.html` file in each pages folder. This way the page URL ends up being the folder name, and the web server will serve up the respective `index.html` file. An example of what this structure would look like is as follows:
{% highlight bash %}
.
├── _config.yml
├── _includes
├── _layouts
├── _posts
├── _site
├── about
| └── index.html #=> http://yoursite.com/about/
├── contact
| └── index.html #=> http://yoursite.com/contact/
└── index.html #=> http://yoursite.com/
{% endhighlight %}
This approach may not suit everyone, but for people who like clear URLs its simple and it works. In the end the decision is yours!

View File

@ -0,0 +1,116 @@
---
layout: docs
title: Pagination
prev_section: permalinks
next_section: plugins
---
With many websites—especially blogs—its very common to break the main listing of posts up into smaller lists and display them over multiple pages. Jekyll has pagination built-in, so you can automatically generate the appropriate files and folders you need for paginated post listings.
<div class="note info">
<h5>Pagination only works within HTML files</h5>
<p>Pagination does not work with Markdown or Textile files in your Jekyll site. It will only work when used within HTML files. Since youll likely be using this for the list of posts, this probably wont be an issue.</p>
</div>
## Enable pagination
The first thing you need to do to enable pagination for your blog is add a line to the `_config.yml` Jekyll configuration file that specifies how many items should be displayed per page. Here is what the line should look like:
{% highlight yaml %}
paginate: 5
{% endhighlight %}
The number should be the maximum number of posts youd like to be displayed per-page in the generated site.
## Render the paginated posts
The next thing you need to do is to actually display your posts in a list using the `paginator` variable that will now be available to you. Youll probably want to do this in one of the main pages of your site. Heres one example of a simple way of rendering paginated posts in a HTML file:
{% highlight html %}
---
layout: default
title: My Blog
---
<!-- This loops through the paginated posts -->
{{ "{% for post in paginator.posts " }}%}
<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 %}
<div class="note warning">
<h5>Beware the page one edge-case</h5>
<p>Jekyll does not generate a page1 folder, so the above code will not work when a <code>/page1</code> link is produced. See below for a way to handle this if its a problem for you.</p>
</div>
The following HTML snippet should handle page one, 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 %}

View File

@ -0,0 +1,163 @@
---
layout: docs
title: Permalinks
prev_section: templates
next_section: pagination
---
Jekyll supports a flexible way to build your sites URLs. You can
specify the permalinks for your site through the [Configuration](../configuration) or on the [YAML Front Matter](../frontmatter) for each post. Youre 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
<table>
<thead>
<tr>
<th>Variable</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<p><code>year</code></p>
</td>
<td>
<p>Year from the posts filename</p>
</td>
</tr>
<tr>
<td>
<p><code>month</code></p>
</td>
<td>
<p>Month from the posts filename</p>
</td>
</tr>
<tr>
<td>
<p><code>day</code></p>
</td>
<td>
<p>Day from the posts filename</p>
</td>
</tr>
<tr>
<td>
<p><code>title</code></p>
</td>
<td>
<p>Title from the posts filename</p>
</td>
</tr>
<tr>
<td>
<p><code>categories</code></p>
</td>
<td>
<p>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.</p>
</td>
</tr>
<tr>
<td>
<p><code>i_month</code></p>
</td>
<td>
<p> Month from the posts filename without leading zeros.</p>
</td>
</tr>
<tr>
<td>
<p><code>i_day</code></p>
</td>
<td>
<p>Day from the posts filename without leading zeros.</p>
</td>
</tr>
</tbody>
</table>
## Built-in permalink styles
<table>
<thead>
<tr>
<th>Permalink Style</th>
<th>URL Template</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<p><code>date</code></p>
</td>
<td>
<p><code>/:categories/:year/:month/:day/:title.html</code></p>
</td>
</tr>
<tr>
<td>
<p><code>pretty</code></p>
</td>
<td>
<p><code>/:categories/:year/:month/:day/:title/</code></p>
</td>
</tr>
<tr>
<td>
<p><code>none</code></p>
</td>
<td>
<p><code>/:categories/:title.html</code></p>
</td>
</tr>
</tbody>
</table>
## Permalink style examples
Given a post named: `/2009-04-29-slap-chop.textile`
<table>
<thead>
<tr>
<th>Permalink Setting</th>
<th>Resulting Permalink URL</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<p>None specified, or <code>permalink: date</code></p>
</td>
<td>
<p><code>/2009/04/29/slap-chop.html</code></p>
</td>
</tr>
<tr>
<td>
<p><code>permalink: pretty</code></p>
</td>
<td>
<p><code>/2009/04/29/slap-chop/index.html</code></p>
</td>
</tr>
<tr>
<td>
<p><code>permalink: /:month-:day-:year/:title.html</code></p>
</td>
<td>
<p><code>/04-29-2009/slap-chop.html</code></p>
</td>
</tr>
<tr>
<td>
<p><code>permalink: /blog/:year/:month/:day/:title</code></p>
</td>
<td>
<p><code>/blog/2009/04/29/slap-chop/index.html</code></p>
</td>
</tr>
</tbody>
</table>

View File

@ -0,0 +1,384 @@
---
layout: docs
title: Plugins
prev_section: assets
next_section: extras
---
Jekyll has a plugin system with hooks that allow you to create custom generated
content specific to your site. You can run custom code for your site
without having to modify the Jekyll source itself.
<div class="note info">
<h5>Plugins on GitHub Pages</h5>
<p>GitHub Pages are powered by Jekyll, however all Pages sites are generated using the <code>--safe</code> option to disable custom plugins for security reasons. Unfortunately, this means your plugins wont work if youre deploying to GitHub Pages.</p>
</div>
## Installing a plugin
In your site source root, make a `_plugins` directory. Place your plugins
here. Any file ending in `*.rb` inside this directory will be required
when Jekyll generates your site.
In general, plugins you make will fall into one of three categories:
1. Generators
2. Converters
3. Tags
## Generators
You can create a generator when you need Jekyll to create additional
content based on your own rules. For example, a generator might look
like this:
{% highlight ruby %}
module Jekyll
class CategoryPage < Page
def initialize(site, base, dir, category)
@site = site
@base = base
@dir = dir
@name = 'index.html'
self.process(@name)
self.read_yaml(File.join(base, '_layouts'), 'category_index.html')
self.data['category'] = category
category_title_prefix = site.config['category_title_prefix'] || 'Category: '
self.data['title'] = "#{category_title_prefix}#{category}"
end
end
class CategoryPageGenerator < Generator
safe true
def generate(site)
if site.layouts.key? 'category_index'
dir = site.config['category_dir'] || 'categories'
site.categories.keys.each do |category|
site.pages << CategoryPage.new(site, site.source, File.join(dir, category), category)
end
end
end
end
end
{% endhighlight %}
In this example, our generator will create a series of files under the
`categories` directory for each category, listing the posts in each
category using the `category_index.html` layout.
Generators are only required to implement one method:
<table>
<thead>
<tr>
<th>Method</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<p><code>generate</code></p>
</td>
<td>
<p>String output of the content being generated.</p>
</td>
</tr>
</tbody>
</table>
## Converters
If you have a new markup language youd like to include in your site,
you can include it by implementing your own converter. Both the markdown
and textile markup languages are implemented using this method.
<div class="note info">
<h5>Remember your YAML front-matter</h5>
<p>Jekyll will only convert files that have a YAML header at
the top, even for converters you add using a plugin. If there is no YAML header, Jekyll will ignore the file and not send it through the converter.</p>
</div>
Below is a converter that will take all posts ending in .upcase and
process them using the UpcaseConverter:
{% highlight ruby %}
module Jekyll
class UpcaseConverter < Converter
safe true
priority :low
def matches(ext)
ext =~ /upcase/i
end
def output_ext(ext)
".html"
end
def convert(content)
content.upcase
end
end
end
{% endhighlight %}
Converters should implement at a minimum 3 methods:
<table>
<thead>
<tr>
<th>Method</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<p><code>matches</code></p>
</td>
<td>
<p>Called to determine whether the specific converter will
run on the page.</p>
</td>
</tr>
<tr>
<td>
<p><code>output_ext</code></p>
</td>
<td>
<p>The extension of the outputted file, usually this will be <code>.html</code></p>
</td>
</tr>
<tr>
<td>
<p><code>convert</code></p>
</td>
<td>
<p>Logic to do the content conversion</p>
</td>
</tr>
</tbody>
</table>
In our example, UpcaseConverter-matches checks if our filename extension is `.upcase`, and will render using the converter if it is. It will call UpcaseConverter-convert to process the content - in our simple converter were simply capitalizing the entire content string. Finally, when it saves the page, it will do so with the `.html` extension.
## Tags
If youd like to include custom liquid tags in your site, you can do so
by hooking into the tagging system. Built-in examples added by Jekyll
include the `{{"{% highlight "}}%}` and `{{"{% include "}}%}` tags. Below is an example custom liquid tag that will output the time the page was rendered:
{% highlight ruby %}
module Jekyll
class RenderTimeTag < Liquid::Tag
def initialize(tag_name, text, tokens)
super
@text = text
end
def render(context)
"#{@text} #{Time.now}"
end
end
end
Liquid::Template.register_tag('render_time', Jekyll::RenderTimeTag)
{% endhighlight %}
At a minimum, liquid tags must implement:
<table>
<thead>
<tr>
<th>Method</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<p><code>render</code></p>
</td>
<td>
<p>Outputs the content of the tag.</p>
</td>
</tr>
</tbody>
</table>
You must also register the custom tag with the Liquid template engine as follows:
{% highlight ruby %}
Liquid::Template.register_tag('render_time', Jekyll::RenderTimeTag)
{% endhighlight %}
In the example above, we can place the following tag anywhere in one of our pages:
{% highlight ruby %}
<p>{{"{% render_time page rendered at: "}}%}</p>
{% endhighlight %}
And we would get something like this on the page:
{% highlight html %}
<p>page rendered at: Tue June 22 23:38:47 0500 2010</p>
{% endhighlight %}
### Liquid filters
You can add your own filters to the Liquid template system much like you can add tags above. Filters are simply modules that export their methods to liquid. All methods will have to take at least one parameter which represents the input of the filter. The return value will be the output of the filter.
{% highlight ruby %}
module Jekyll
module AssetFilter
def asset_url(input)
"http://www.example.com/#{input}?#{Time.now.to_i}"
end
end
end
Liquid::Template.register_filter(Jekyll::AssetFilter)
{% endhighlight %}
<div class="note">
<h5>ProTip™: Access the site object using Liquid</h5>
<p>Jekyll lets you access the <code>site</code> object through the <code>context.registers</code> feature of liquid. For example, you can access the global configuration file <code>_config.yml</code> using <code>context.registers.config</code>.</p>
</div>
### Flags
There are two flags to be aware of when writing a plugin:
<table>
<thead>
<tr>
<th>Flag</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<p><code>safe</code></p>
</td>
<td>
<p>A boolean flag that allows a plugin to be safely included in
Jekyll core for exclusion from use with GitHub Pages. In general, set
this to <code>true</code>.</p>
</td>
</tr>
<tr>
<td>
<p><code>priortiy</code></p>
</td>
<td>
<p>This flag determines what order the plugin is loaded in. Valid
values are: <code>:lowest</code>, <code>:low</code>, <code>:normal</code>, <code>:high</code>, and <code>:highest</code>.</p>
</td>
</tr>
</tbody>
</table>
To use one of the example plugins above as an illustration, here is how youd specify these two flags:
{% highlight ruby %}
module Jekyll
class UpcaseConverter < Converter
safe true
priority :low
...
end
end
{% endhighlight %}
## Available Plugins
There are a few useful, prebuilt plugins at the following locations:
- [Truncate HTML while preserving markup structure](https://github.com/MattHall/truncatehtml) by [Matt Hall](http://codebeef.com)
- [Generic Blog Plugins by Jose Diaz-Gonzalez](https://github.com/josegonzalez/josediazgonzalez.com/tree/master/_plugins): Contains plugins for tags, categories, archives, as well as a few liquid extensions
- [Domain Name Filter by Lawrence Woodman](https://github.com/LawrenceWoodman/domain_name-liquid_filter): Filters the input text so that just the domain name is left
- [Jekyll Plugins by Recursive Design](http://recursive-design.com/projects/jekyll-plugins/): Plugin to generate Project pages from github readmes, a Category page plugin, and a Sitemap generator
- [Tag Cloud Plugin from a Jekyll walk-through](http://vitobotta.com/how-to-migrate-from-wordpress-to-jekyll/): Plugin to generate a Tag Cloud
- [Pygments Cache Path by Raimonds Simanovskis](https://github.com/rsim/blog.rayapps.com/blob/master/_plugins/pygments_cache_patch.rb): Plugin to cache syntax-highlighted code from Pygments
- [Delicious Plugin by Christian Hellsten](https://github.com/christianhellsten/jekyll-plugins): Fetches and renders bookmarks from delicious.com.
- [Ultraviolet plugin by Steve Alex](https://gist.github.com/480380): Jekyll Plugin for Ultraviolet
- [HAML plugin by Sam Z](https://gist.github.com/517556): HAML plugin for jekyll
- [ArchiveGenerator by Ilkka Laukkanen](https://gist.github.com/707909): Uses [this archive page](https://gist.github.com/707020) to generate archives
- [Tag Cloud Plugin by Ilkka Laukkanen](https://gist.github.com/710577): Jekyll tag cloud / tag pages plugin
- [HAML/SASS Converter by Adam Pearson](https://gist.github.com/481456): Simple haml-sass conversion for jekyll. [Fork](https://gist.github.com/528642) by Sam X
- [SASS scss Converter by Mark Wolfe](https://gist.github.com/960150): Jekyll Converter which uses the new css compatible syntax, based on the one written by Sam X.
- [GIT Tag by Alexandre Girard](https://gist.github.com/730347): Jekyll plugin to add Git activity inside a list
- [Draft/Publish Plugin by Michael Ivey](https://gist.github.com/49630)
- [Less.js generator by Andy Fowler](https://gist.github.com/642739): Jekyll plugin to render less.js files during generation.
- [Less Converter by Jason Graham](https://gist.github.com/639920): A Jekyll plugin to convert a .less file to .css
- [Less Converter by Josh Brown](https://gist.github.com/760265)
- [MathJax Liquid Tags by Jessy Cowan-Sharp](https://gist.github.com/834610): A simple liquid tag for Jekyll that converts and into inline math, and and into block equations, by replacing with the appropriate MathJax script tags.
- [Non-JS Gist Tag by Brandon Tilley](https://gist.github.com/1027674) A Liquid tag for Jekyll sites that allows embedding Gists and showing code for non-JavaScript enabled browsers and readers.
- [Growl Notification Generator by Tate Johnson](https://gist.github.com/490101)
- [Growl Notification Hook by Tate Johnson](https://gist.github.com/525267): Better alternative to the above, but requires his “hook” fork.
- [Version Reporter by Blake Smith](https://gist.github.com/449491)
- [Upcase Converter by Blake Smith](https://gist.github.com/449463)
- [Render Time Tag by Blake Smith](https://gist.github.com/449509)
- [Summarize Filter by Mathieu Arnold](https://gist.github.com/731597)
- [Status.net/OStatus Tag by phaer](https://gist.github.com/912466)
- [CoffeeScript converter by phaer](https://gist.github.com/959938): Put this file in `plugins` and write a YAML header to your .coffee files. See [http://coffeescript.org](http://coffeescript.org) for more info
- [Raw Tag by phaer.](https://gist.github.com/1020852): Keeps liquid from parsing text betweeen `{{ "{% raw " }}%}` and `{{ "{% endraw " }}%}`
- [URL encoding by James An](https://gist.github.com/919275)
- [Sitemap.xml Generator by Michael Levin](http://www.kinnetica.com/projects/jekyll-sitemap-generator/)
- [Markdown references by Olov Lassus](https://gist.github.com/961336): Keep all your markdown reference-style link definitions in one file (_references.md)
- [Full-text search by Pascal Widdershoven](https://github.com/PascalW/jekyll_indextank): Add full-text search to your Jekyll site with this plugin and a bit of JavaScript.
- [Stylus Converter](https://gist.github.com/988201) Convert .styl to .css.
- [Embed.ly client by Robert Böhnke](https://github.com/robb/jekyll-embedly-client) Autogenerate embeds from URLs using oEmbed.
- [Logarithmic Tag Cloud](https://gist.github.com/2290195): Flexible. Logarithmic distribution. Usage eg: `{{ "{% tag_cloud font-size: 50 - 150%, threshold: 2 " }}%}`. Documentation inline.
- [Related Posts by Lawrence Woodman](https://github.com/LawrenceWoodman/related_posts-jekyll_plugin): Overrides `site.related_posts` to use categories to assess relationship
- [AliasGenerator by Thomas Mango](https://github.com/tsmango/jekyll_alias_generator): Generates redirect pages for posts when an alias configuration is specified in the YAML Front Matter.
- [FlickrSetTag by Thomas Mango](https://github.com/tsmango/jekyll_flickr_set_tag): Generates image galleries from Flickr sets.
- [Projectlist by Frederic Hemberger](https://github.com/fhemberger/jekyll-projectlist): Loads all files from a directory and renders the entries into a single page, instead of creating separate posts.
- [Tiered Archives by Eli Naeher](https://gist.github.com/88cda643aa7e3b0ca1e5): creates a tiered template variable that allows you to create archives grouped by year and month.
- [Jammit generator by Vladimir Andrijevik](https://gist.github.com/1224971): enables use of [Jammit](http://documentcloud.github.com/jammit/) for JavaScript and CSS packaging.
- [oEmbed Tag by Tammo van Lessen](https://gist.github.com/1455726): enables easy content embedding (e.g. from YouTube, Flickr, Slideshare) via oEmbed.
- [Company website and blog plugins](https://github.com/flatterline/jekyll-plugins) by Flatterline, a [Ruby on Rails development company](http://flatterline.com/): portfolio/project page generator, team/individual page generator, author bio liquid template tag for use on posts and a few other smaller plugins.
- [Transform Layouts](https://gist.github.com/1472645) Monkey patching allowing HAML layouts (you need a HAML Converter plugin for this to work)
- [ReStructuredText converter](https://github.com/xdissent/jekyll-rst): Converts ReST documents to HTML with Pygments syntax highlighting.
- [Tweet Tag by Scott W. Bradley](https://github.com/scottwb/jekyll-tweet-tag): Liquid tag for [Embedded Tweets](https://dev.twitter.com/docs/embedded-tweets) using Twitters shortcodes
- [jekyll-localization](https://github.com/blackwinter/jekyll-localization): Jekyll plugin that adds localization features to the rendering engine.
- [jekyll-rendering](https://github.com/blackwinter/jekyll-rendering): Jekyll plugin to provide alternative rendering engines.
- [jekyll-pagination](https://github.com/blackwinter/jekyll-pagination): Jekyll plugin to extend the pagination generator.
- [jekyll-tagging](https://github.com/pattex/jekyll-tagging): Jekyll plugin to automatically generate a tag cloud and tag pages.
- [Generate YouTube Embed (tag)](https://gist.github.com/1805814) by [joelverhagen](https://github.com/joelverhagen): Jekyll plugin which allows you to embed a YouTube video in your page with the YouTube ID. Optionally specify width and height dimensions. Like “oEmbed Tag” but just for YouTube.
- [JSON Filter](https://gist.github.com/1850654) by [joelverhagen](https://github.com/joelverhagen): filter that takes input text and outputs it as JSON. Great for rendering JavaScript.
- [jekyll-beastiepress](https://github.com/okeeblow/jekyll-beastiepress): FreeBSD utility tags for Jekyll sites.
- [jsonball](https://gist.github.com/1895282): reads json files and produces maps for use in jekylled files
- [redcarpet2](https://github.com/nono/Jekyll-plugins): use Redcarpet2 for rendering markdown
- [bibjekyll](https://github.com/pablooliveira/bibjekyll): render BibTeX-formatted bibliographies/citations included in posts/pages using bibtex2html
- [jekyll-citation](https://github.com/archome/jekyll-citation): render BibTeX-formatted bibliographies/citations included in posts/pages (pure Ruby)
- [jekyll-scholar](https://github.com/inukshuk/jekyll-scholar): Jekyll extensions for the blogging scholar
- [jekyll-asset_bundler](https://github.com/moshen/jekyll-asset_bundler): bundles and minifies JavaScript and CSS
- [Jekyll Dribbble Set Tag](https://github.com/ericdfields/Jekyll-Dribbble-Set-Tag): builds Dribbble image galleries from any user
- [debbugs](https://gist.github.com/2218470): allows posting links to Debian BTS easily
- [refheap_tag](https://github.com/aburdette/refheap_tag): Liquid tag that allows embedding pastes from [refheap](https://refheap.com)
- [i18n_filter](https://github.com/gacha/gacha.id.lv/blob/master/_plugins/i18n_filter.rb): Liquid filter to use I18n localization.
- [singlepage-jekyll](https://github.com/JCB-K/singlepage-jekyll) by [JCB-K](https://github.com/JCB-K): turns Jekyll into a dynamic one-page website.
- [flickr](http://jonasforsberg.se/2012/04/15/flickr-plugin-for-jekyll/): Embed photos from flickr right into your posts.
- [jekyll-devonly_tag](https://gist.github.com/2403522): A block tag for including markup only during development.
- [Jekyll plugins by Aucor](https://github.com/aucor/jekyll-plugins): Plugins for eg. trimming unwanted newlines/whitespace and sorting pages by weight attribute.
- [Only first paragraph](https://github.com/sebcioz/jekyll-only_first_p): Show only first paragrpaph of page/post.
- [jekyll-pandoc-plugin](https://github.com/dsanson/jekyll-pandoc-plugin): use pandoc for rendering markdown.
- [File compressor](https://gist.github.com/2758691) by [mytharcher](https://github.com/mytharcher): Compress HTML (\*.html) and JavaScript(\*.js) files when output.
- [smilify](https://github.com/SaswatPadhi/jekyll_smilify) by [SaswatPadhi](https://github.com/SaswatPadhi): Convert text emoticons in your content to themeable smiley pics. [Demo](http://saswatpadhi.github.com/)
- [excerpts](http://blog.darkrefraction.com/2012/jekyll-excerpt-plugin.html) by [drawoc](https://github.com/drawoc): provides a nice way to implement page excerpts.
<div class="note info">
<h5>Jekyll Plugins Wanted</h5>
<p>If you have a Jekyll plugin that you would like to see added to this list, you should <a href="../contributing">read the contributing page</a> to find out how to make that happen.</p>
</div>

View File

@ -0,0 +1,106 @@
---
layout: docs
title: Writing posts
prev_section: frontmatter
next_section: pages
---
One of Jekylls best aspects is that it is “blog aware”. What does that mean, exactly? Well, simply put it means that blogging is baked into Jekylls functionality by default. For people who write articles and publish them online, this means that you can publish and maintain a blog simply by managing a folder full of text-files on your computer. Compared to the hassle of configuring and maintaining databases and web-based CMS systems, this will be a welcome change for many.
## The Posts Folder
As detailed on the [directory structure](../structure) page, the `_posts` folder in any Jekyll site is where the files for all your articles will live. These files can be either [Markdown](http://daringfireball.net/projects/markdown/) or [Textile](http://textile.sitemonks.com/) formatted text files, and as long as they have [YAML front-matter](../frontmatter) defined, they will be converted from their source format into a HTML page that is part of your static site.
### Creating Post Files
To create a new post, all you need to do is create a new file in the `_posts` folder. The filename structure used for files in this folder is important—Jekyll requires the file to be named in the following format:
{% highlight bash %}
YEAR-MONTH-DAY-title.MARKUP
{% endhighlight %}
Where `YEAR` is a four-digit number, `MONTH` and `DAY` are both two-digit numbers, and `MARKUP` is an appropriate file extension for the format your post is written in. For example, the following are examples of excellent post filenames:
{% highlight bash %}
2011-12-31-new-years-eve-is-awesome.markdown
2012-09-12-how-to-write-a-blog.textile
{% endhighlight %}
### Content Formats
The first thing you need to put in any post is a section for [YAML front-matter](../frontmatter), but after that, it's simply a case of deciding which format you prefer to write in. Jekyll supports two popular content markup formats: [Markdown](http://daringfireball.net/projects/markdown/) or [Textile](http://textile.sitemonks.com/). These formats each have their own way of signifying different types of content within a post, so you should read up on how these formats work and decide which one suits your needs best.
## Including images and resources
For people who publish articles on a regular basis, its quite common to need to include things like images, links, downloads, and other resources along with their text-based content. While the ways to link to these resources differ between Markdown and Textile, the problem of working out where to store these files in your site is something everyone will face.
Because of Jekylls flexibility, there are many solutions to how to do this. One common solution is to create a folder in the root of the project directory called something like `assets` or `downloads`, into which any images, downloads or other resources are placed. Then, from within any post, they can be linked to using the sites root as the path for the asset to include. Again, this will depend on the way your sites (sub)domain and path are configured, but here some examples (in Markdown) of how you could do this using the `{{ "{{ site.url " }}}}` variable in a post.
Including an image asset in a post:
{% highlight bash %}
… which is shown in the screenshot below:
![My helpful screenshot]({{ "{{ site.url " }}}}/assets/screenshot.jpg)
{% endhighlight %}
Linking to a PDF for readers to download:
{% highlight bash %}
… you can [get the PDF]({{ "{{ site.url " }}}}/assets/mydoc.pdf) directly.
{% endhighlight %}
<div class="note">
<h5>ProTip™: Link using just the site root URL</h5>
<p>You can skip the <code>{{ "{{ site.url " }}}}</code> variable if you <strong>know</strong> your site will only ever be displayed at the root URL of your domain. In this case you can reference assets directly with just <code>/path/file.jpg</code>.</p>
</div>
## Displaying an index of posts
Its all well and good to have posts in a folder, but a blog is no use unless you have a list of posts somewhere for people. Creating an index of posts on another page (or in a [template](../templates)) is easy, thanks to the [Liquid template language](http://liquidmarkup.org/) and its tags. Heres a basic example of how to create an unordered list of links to posts for a Jekyll site:
{% highlight html %}
<ul>
{{ "{% for post in site.posts " }}%}
<li>
<a href="{{ "{{ post.url "}}}}">{{ "{{ post.title "}}}}</a>
</li>
{{ "{% endfor " }}%}
</ul>
{% endhighlight %}
Of course, you have full control over how (and where) you display your posts, and how you structure your site. You should read more about [how templates work](../templates) with Jekyll if youre interested in these kinds of things.
## Highlighting code snippets
Jekyll also has built-in support for syntax highlighting of code snippets using [Pygments](../extras), and including a code snippet in any post is easy. Just use the dedicated Liquid tag as follows:
{% highlight ruby %}
{{ "{% highlight ruby"}} %}
def show
@widget = Widget(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @widget }
end
end
{{ "{% endhighlight"}} %}
{% endhighlight %}
And the output will look like this:
{% highlight ruby %}
def show
@widget = Widget(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @widget }
end
end
{% endhighlight %}
<div class="note">
<h5>ProTip™: Show line numbers</h5>
<p>You can make code snippets include line-numbers easily, simply add the word <code>linenos</code> to the end of the opening highlight tag like this: <code>{{ "{% highlight ruby linenos " }}%}</code>.</p>
</div>
Those basics should be more than enough to get you started writing your first posts. When youre ready to dig into what else is possible, you might be interested in doing things like [customizing post permalinks](../permalinks) or using [custom variables](../variables) in your posts and elsewhere on your site.

View File

@ -0,0 +1,49 @@
---
layout: docs
title: Resources
prev_section: sites
---
Jekylls growing use is producing a wide variety of tutorials, frameworks, extensions, examples, and other resources that can be very helpful. Below is a collection of links to some of the most popular Jekyll resources.
### Jekyll tips & tricks, and examples
- [A simple way to add draft posts](https://gist.github.com/2870636)
No plugins required.
- [Tips for working with GitHub Pages Integration](https://gist.github.com/2890453)
Code example reuse, and keeping documentation up to date.
- [Use Simple Form to integrate a simple contact
form](http://getsimpleform.com/)
- [JekyllBootstrap.com](http://jekyllbootstrap.com)
Provides detailed explanations, examples, and helper-code to make
getting started with Jekyll easier.
### Tutorials
#### Integrating Jekyll with Git
- [Blogging with Git, Emacs and Jekyll](http://metajack.im/2009/01/23/blogging-with-git-emacs-and-jekyll/)
- [Using Git to maintain your blog](http://matedriven.com.ar/2009/04/28/using-git-to-maintain-your-blog.html) (step by step guide)
#### Other hacks
- [Integrating Twitter with Jekyll](http://www.justkez.com/integrating-twitter-with-jekyll/)
> “Having migrated Justkez.com to be based on Jekyll, I was pondering how I might include my recent twitterings on the front page of the site. In the Wordpress world, this would have been done via a plugin which may or may not have hung the loading of the page, might have employed caching, but would certainly have had some overheads. … Not in Jekyll.”
- [My Jekyll Fork, by Mike West](http://mikewest.org/2009/11/my-jekyll-fork)
> “Jekyll is a well-architected throwback to a time before Wordpress, when men were men, and HTML was static. I like the ideas it espouses, and have made a few improvements to its core. Here, Ill point out some highlights of my fork in the hopes that they see usage beyond this site.”
- [About this Website, by Carter Allen](http://cartera.me/2010/08/12/about-this-website/)
> “Jekyll is everything that I ever wanted in a blogging engine. Really. It isnt perfect, but whats excellent about it is that if theres something wrong, I know exactly how it works and how to fix it. It runs on the your machine only, and is essentially an added”build" step between you and the browser. I coded this entire site in TextMate using standard HTML5 and CSS3, and then at the end I added just a few little variables to the markup. Presto-chango, my site is built and I am at peace with the world.”
- [Generating a Tag Cloud in Jekyll](http://www.justkez.com/generating-a-tag-cloud-in-jekyll/)
A guide to implementing a tag cloud and per-tag content pages using Jekyll.
- [Jekyll Extensions -= Pain](http://rfelix.com/2010/01/19/jekyll-extensions-minus-equal-pain/)
A way to [extend Jekyll](http://github.com/rfelix/jekyll_ext) without forking and modifying the Jekyll gem codebase and some [portable Jekyll extensions](http://wiki.github.com/rfelix/jekyll_ext/extensions) that can be reutilized and shared.
- [Using your Rails layouts in Jekyll](http://numbers.brighterplanet.com/2010/08/09/sharing-rails-views-with-jekyll)

View File

@ -0,0 +1,95 @@
---
layout: docs
title: Directory structure
prev_section: usage
next_section: configuration
---
Jekyll at its core is a text transformation engine. The concept behind the system is this: you give it text written in your favorite markup language, be that Markdown, Textile, or just plain HTML, and it churns that through a layout or series of layout files. Throughout that process you can tweak how you want the site URLs to look, what data gets displayed on the layout and more. This is all done through strictly editing files, and the web interface is the final product.
A basic Jekyll site usually looks something like this:
{% highlight bash %}
.
├── _config.yml
├── _includes
| ├── footer.html
| └── header.html
├── _layouts
| ├── default.html
| └── post.html
├── _posts
| ├── 2007-10-29-why-every-programmer-should-play-nethack.textile
| └── 2009-04-26-barcamp-boston-4-roundup.textile
├── _site
└── index.html
{% endhighlight %}
An overview of what each of these does:
<table>
<thead>
<tr>
<th>File / Directory</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<p><code>_config.yml</code></p>
</td>
<td>
<p>Stores <a href="../configuration">configuration</a> data. A majority of these options can be specified from the command line executable but its easier to throw them in here so you dont have to remember them.</p>
</td>
</tr>
<tr>
<td>
<p><code>_includes</code></p>
</td>
<td>
<p>These are the partials that can be mixed and matched by your _layouts and _posts to facilitate reuse. The liquid tag <code>{{ "{% include file.ext " }}%}</code> can be used to include the partial in <code>_includes/file.ext</code>.</p>
</td>
</tr>
<tr>
<td>
<p><code>_layouts</code></p>
</td>
<td>
<p>These are the templates which posts are inserted into. Layouts are chosen on a post-by-post basis in the <a href="../frontmatter">YAML front matter</a>, which is described in the next section. The liquid tag <code>{{ "{{ content " }}}}</code> is used to inject data onto the page.</p>
</td>
</tr>
<tr>
<td>
<p><code>_posts</code></p>
</td>
<td>
<p>Your dynamic content, so to speak. The format of these files is important, as named as <code>YEAR-MONTH-DAY-title.MARKUP</code>. The <a href="../permalinks">permalinks</a> can be adjusted very flexibly for each post, but the date and markup language are determined solely by the file name.</p>
</td>
</tr>
<tr>
<td>
<p><code>_site</code></p>
</td>
<td>
<p>This is where the generated site will be placed once Jekyll is done transforming it. It's probably a good idea to add this to your <code>.gitignore</code> file.</p>
</td>
</tr>
<tr>
<td>
<p><code>index.html</code> and other HTML, Markdown, Textile files</p>
</td>
<td>
<p>Provided that the file has a <a href="../frontmatter">YAML Front Matter</a> section, it will be transformed by Jekyll. The same will happen for any <code>.html</code>, <code>.markdown</code>, <code>.md</code>, or <code>.textile</code> file in your site's root directory or directories not listed above.</p>
</td>
</tr>
<tr>
<td>
<p>Other Files/Folders</p>
</td>
<td>
<p>Every other directory and file except for those listed above—such as <code>css</code> and <code>images</code> folders, <code>favicon.ico</code> files, and so forth—will be transferred over verbatim to the generated site. There's plenty of sites already using Jekyll if you're curious as to how they're laid out.</p>
</td>
</tr>
</tbody>
</table>

View File

@ -0,0 +1,217 @@
---
layout: docs
title: Templates
prev_section: migrations
next_section: permalinks
---
Jekyll uses the [Liquid](http://www.liquidmarkup.org/) templating language to process templates. All of the [standard Liquid tags and filters](http://wiki.github.com/shopify/liquid/liquid-for-designers) are supported, Jekyll even adds a few handy filters and tags of its own to make common tasks easier.
## Filters
<table>
<thead>
<tr>
<th>Description</th>
<th><span class="filter">Filter</span> and <span class="output">Output</span></th>
</tr>
</thead>
<tbody>
<tr>
<td>
<p class='name'><strong>Date to XML Schema</strong></p>
<p>Convert a Date into XML Schema format.</p>
</td>
<td class='align-center'>
<p>
<code class='filter'>{{ "{{ site.time | date_to_xmlschema " }}}}</code>
</p>
<p>
<code class='output'>2008-11-17T13:07:54-08:00</code>
</p>
</td>
</tr>
<tr>
<td>
<p class='name'><strong>Date to String</strong></p>
<p>Convert a date to short format.</p>
</td>
<td class='align-center'>
<p>
<code class='filter'>{{ "{{ site.time | date_to_string " }}}}</code>
</p>
<p>
<code class='output'>17 Nov 2008</code>
</p>
</td>
</tr>
<tr>
<td>
<p class='name'><strong>Date to Long String</strong></p>
<p>Format a date to long format.</p>
</td>
<td class='align-center'>
<p>
<code class='filter'>{{ "{{ site.time | date_to_long_string " }}}}</code>
</p>
<p>
<code class='output'>17 November 2008</code>
</p>
</td>
</tr>
<tr>
<td>
<p class='name'><strong>XML Escape</strong></p>
<p>Escape some text for use in XML.</p>
</td>
<td class='align-center'>
<p>
<code class='filter'>{{ "{{ page.content | xml_escape " }}}}</code>
</p>
</td>
</tr>
<tr>
<td>
<p class='name'><strong>CGI Escape</strong></p>
<p>CGI escape a string for use in a URL. Replaces any special characters with appropriate %XX replacements.</p>
</td>
<td class='align-center'>
<p>
<code class='filter'>{{ "{{ “foo,bar;baz?” | cgi_escape " }}}}</code>
</p>
<p>
<code class='output'>foo%2Cbar%3Bbaz%3F</code>
</p>
</td>
</tr>
<tr>
<td>
<p class='name'><strong>Number of Words</strong></p>
<p>Count the number of words in some text.</p>
</td>
<td class='align-center'>
<p>
<code class='filter'>{{ "{{ page.content | number_of_words " }}}}</code>
</p>
<p>
<code class='output'>1337</code>
</p>
</td>
</tr>
<tr>
<td>
<p class='name'><strong>Array to Sentence</strong></p>
<p>Convert an array into a sentence. Useful for listing tags.</p>
</td>
<td class='align-center'>
<p>
<code class='filter'>{{ "{{ page.tags | array_to_sentence_string " }}}}</code>
</p>
<p>
<code class='output'>foo, bar, and baz</code>
</p>
</td>
</tr>
<tr>
<td>
<p class='name'><strong>Textilize</strong></p>
<p>Convert a Textile-formatted string into HTML, formatted via RedCloth</p>
</td>
<td class='align-center'>
<p>
<code class='filter'>{{ "{{ page.excerpt | textilize " }}}}</code>
</p>
</td>
</tr>
<tr>
<td>
<p class='name'><strong>Markdownify</strong></p>
<p>Convert a Markdown-formatted string into HTML.</p>
</td>
<td class='align-center'>
<p>
<code class='filter'>{{ "{{ page.excerpt | markdownify " }}}}</code>
</p>
</td>
</tr>
</tbody>
</table>
## Tags
### Includes (Partials)
If you have small page fragments that you wish to include in multiple
places on your site, you can use the `include` tag.
{% highlight ruby %}
{{ "{% include sig.textile " }}%}
{% endhighlight %}
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/your/site/_includes/sig.textile` into the calling
file.
### Code snippet highlighting
Jekyll has built in support for syntax highlighting of [over 100
languages](http://pygments.org/languages/) thanks to
[Pygments](http://pygments.org/). In order to take advantage of this
youll 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 enabled](../extras).
To render a code block with syntax highlighting, surround your code as follows:
{% highlight ruby %}
{{ "{% highlight ruby " }}%}
def foo
puts 'foo'
end
{{ "{% endhighlight " }}%}
{% endhighlight %}
The argument to the `highlight` tag (`ruby` in the example above) is the language identifier. To find the appropriate identifier to use for the language you want to highlight, look for the “short name” on the [Lexers page](http://pygments.org/docs/lexers/).
#### Line numbers
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 %}
{{ "{% highlight ruby linenos " }}%}
def foo
puts 'foo'
end
{{ "{% endhighlight " }}%}
{% endhighlight %}
#### Stylesheets for syntax highlighting
In order for the highlighting to show up, youll 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 the `.lineno` class 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, the `post_url` tag will generate the correct permalink URL for the post you specify.
{% highlight bash %}
{{ "{% post_url 2010-07-21-name-of-post " }}%}
{% endhighlight %}
There is no need to include the file extension when using the `post_url` tag.
You can also use this tag to create a link to a post in Markdown as follows:
{% highlight html %}
[Name of Link]({{ "{% post_url 2010-07-21-name-of-post " }}%})
{% endhighlight %}

View File

@ -0,0 +1,108 @@
---
layout: docs
title: Troubleshooting
prev_section: contributing
next_section: sites
---
If you ever run into problems installing or using Jekyll, heres a few tips that might be of help. If the problem youre experiencing isnt covered below, please [report an issue](https://github.com/mojombo/jekyll/issues/new) so the Jekyll community can make everyones experience better.
## Installation Problems
If you encounter errors during gem installation, you may need to install
the header files for compiling extension modules for ruby 1.9.1. This
can be done on Ubunutu or Debian by running:
{% highlight bash %}
sudo apt-get install ruby1.9.1-dev
{% endhighlight %}
On Red Hat, CentOS, and Fedora systems you can do this by running:
{% highlight bash %}
sudo yum install ruby-devel
{% endhighlight %}
On [NearlyFreeSpeech](http://nearlyfreespeech.net/) you need to run the command with the following environment variable:
{% highlight bash %}
RB_USER_INSTALL=true gem install jekyll
{% endhighlight %}
On OSX, you may need to update RubyGems:
{% highlight bash %}
sudo gem update --system
{% endhighlight %}
To install RubyGems on Gentoo:
{% highlight bash %}
sudo emerge -av dev-ruby/rubygems
{% endhighlight %}
On Windows, you may need to install [RubyInstaller
DevKit](http://wiki.github.com/oneclick/rubyinstaller/development-kit).
## Problems running Jekyll
On Debian or Ubuntu, you may need to add /var/lib/gems/1.8/bin/ to your path in order to have the `jekyll` executable be available in your Terminal.
## Base-URL Problems
If you are using base-url option like `jekyll --server --base-url '/blog'` then make sure that you access the site at `http://localhost:4000/blog/index.html`. Just accessing `http://localhost:4000/blog` will not work.
## Configuration problems
The order of precedence for conflicting [configuration settings](../configuration) is as follows:
1. Command-line flags
2. Configuration file settings
3. Defaults
That is: defaults are overridden by options specified in `_config.yml`, and flags specified at the command-line will override all other settings specified elsewhere.
## 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 youre 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 triggers the
following error:
{% highlight bash %}
'{{ "{{" }}' was not properly terminated with regexp: /\}\}/ (Liquid::SyntaxError)
{% endhighlight %}
<div class="note">
<h5>Please report issues you encounter!</h5>
<p>If you come across a bug, please <a href="https://github.com/mojombo/jekyll/issues/new">create an issue</a> on GitHub describing the problem and any work-arounds you find so we can document it here for others.</p>
</div>

View File

@ -0,0 +1,35 @@
---
layout: docs
title: Basic Usage
prev_section: installation
next_section: structure
---
The Jekyll gem makes a `jekyll` executable available to you in your Terminal window. You can use this command in a number of ways:
{% highlight bash %}
jekyll
#=> The current folder will get generated into ./_site
jekyll <destination>
#=> The current folder will get generated into <destination>
jekyll <source> <destination>
#=> The <source> folder will get generated into <destination>
{% endhighlight %}
Jekyll also comes with a built-in development server that will allow you to preview what the generated site will look like in your browser locally.
{% highlight bash %}
jekyll --server
#=> A development server will run at http://localhost:4000/
jekyll --server --auto
#=> As above, but watch for changes and regenerate automatically too.
{% endhighlight %}
These are just some of the many [configuration options](../configuration) available. All configuration options can either be specified as flags on the command line, or alternatively (and more commonly) they can be specified in a `_config.yml` file at the root of the source directory. Jekyll will automatically configuration options from this file when run, so placing the following two lines in the configuration file will mean that running `jekyll` would be equivalent to running `jekyll --server --auto`:
{% highlight yaml %}
auto: true
server: true
{% endhighlight %}
For more about the possible configuration options, see the [configuration](../configuration) page.

View File

@ -0,0 +1,166 @@
---
layout: docs
title: Variables
prev_section: pages
next_section: migrations
---
Jekyll traverses your site looking for files to process. Any files with [YAML Front Matter](../frontmatter) are subject to processing. For each of these files, Jekyll makes a variety of data available to the pages via the [Liquid templating system](http://wiki.github.com/shopify/liquid/liquid-for-designers). The following is a reference of the available data.
## Global Variables
<table>
<thead>
<tr>
<td>Variable</td>
<td>Description</td>
</tr>
</thead>
<tbody>
<tr>
<td><p><code>site</code></p></td>
<td><p>Sitewide information + Configuration settings from <code>_config.yml</code></p></td>
</tr>
<tr>
<td><p><code>page</code></p></td>
<td><p>This is just the <a href="../frontmatter">YAML Front Matter</a> with 2 additions: <code>url</code> and <code>content</code>.</p></td>
</tr>
<tr>
<td><p><code>content</code></p></td>
<td><p>In layout files, this contains the content of the subview(s). This is the variable used to insert the rendered content into the layout. This is not used in post files or page files.</p></td>
</tr>
<tr>
<td><p><code>paginator</code></p></td>
<td><p>When the <code>paginate</code> configuration option is set, this variable becomes available for use.</p></td>
</tr>
</tbody>
</table>
## Site Variables
<table>
<thead>
<tr>
<td>Variable</td>
<td>Description</td>
</tr>
</thead>
<tbody>
<tr>
<td><p><code>site.time</code></p></td>
<td><p>The current time (when you run the <code>jekyll</code> command).</p></td>
</tr>
<tr>
<td><p><code>site.posts</code></p></td>
<td><p>A reverse chronological list of all Posts.</p></td>
</tr>
<tr>
<td><p><code>site.related_posts</code></p></td>
<td><p>If the page being processed is a Post, this contains a list of up to ten related Posts. By default, these are low quality but fast to compute. For high quality but slow to compute results, run the <code>jekyll</code> command with the <code>--lsi</code> (latent semantic indexing) option.</p></td>
</tr>
<tr>
<td><p><code>site.categories.CATEGORY</code></p></td>
<td><p>The list of all Posts in category <code>CATEGORY</code>.</p></td>
</tr>
<tr>
<td><p><code>site.tags.TAG</code></p></td>
<td><p>The list of all Posts with tag <code>TAG</code>.</p></td>
</tr>
<tr>
<td><p><code>site.[CONFIGURATION_DATA]</code></p></td>
<td><p>All variables set in your <code>_config.yml</code> are available through the <code>site</code> variable. For example, if you have <code>url: http://mysite.com</code> in your configuration file, then in your posts and pages it can be accessed using <code>{{ "{{ site.url " }}}}</code>. Jekyll does not parse changes to <code>_config.yml</code> in <code>auto</code> mode, you have to restart Jekyll to see changes to variables.</p></td>
</tr>
</tbody>
</table>
## Page Variables
<table>
<thead>
<tr>
<td>Variable</td>
<td>Description</td>
</tr>
</thead>
<tbody>
<tr>
<td><p><code>page.content</code></p></td>
<td><p>The un-rendered content of the Page.</p></td>
</tr>
<tr>
<td><p><code>page.title</code></p></td>
<td><p>The title of the Post.</p></td>
</tr>
<tr>
<td><p><code>page.url</code></p></td>
<td><p>The URL of the Post without the domain. e.g. <code>/2008/12/14/my-post.html</code></p></td>
</tr>
<tr>
<td><p><code>page.date</code></p></td>
<td><p>The Date assigned to the Post. This can be overridden in a posts front matter by specifying a new date/time in the format <code>YYYY-MM-DD HH:MM:SS</code></p></td>
</tr>
<tr>
<td><p><code>page.id</code></p></td>
<td><p>An identifier unique to the Post (useful in RSS feeds). e.g. <code>/2008/12/14/my-post</code></p></td>
</tr>
<tr>
<td><p><code>page.categories</code></p></td>
<td><p>The list of categories to which this post belongs. Categories are derived from the directory structure above the <code>_posts</code> directory. For example, a post at <code>/work/code/_posts/2008-12-24-closures.textile</code> would have this field set to <code>['work', 'code']</code>. These can also be specified in the <a href="../frontmatter">YAML Front Matter</a>.</p></td>
</tr>
<tr>
<td><p><code>page.tags</code></p></td>
<td><p>The list of tags to which this post belongs. These can be specified in the <a href="../frontmatter">YAML Front Matter</a></p></td>
</tr>
</tbody>
</table>
<div class="note">
<h5>ProTip™: Use custom front-matter</h5>
<p>Any custom front matter that you specify will be available under <code>page</code>. For example, if you specify <code>custom_css: true</code> in a pages front matter, that value will be available in templates as <code>page.custom_css</code>.</p>
</div>
## Paginator
<table>
<thead>
<tr>
<td>Variable</td>
<td>Description</td>
</tr>
</thead>
<tbody>
<tr>
<td><p><code>paginator.per_page</code></p></td>
<td><p>Number of posts per page.</p></td>
</tr>
<tr>
<td><p><code>paginator.posts</code></p></td>
<td><p>Posts available for that page.</p></td>
</tr>
<tr>
<td><p><code>paginator.total_posts</code></p></td>
<td><p>Total number of posts.</p></td>
</tr>
<tr>
<td><p><code>paginator.total_pages</code></p></td>
<td><p>Total number of pages.</p></td>
</tr>
<tr>
<td><p><code>paginator.page</code></p></td>
<td><p>The number of the current page.</p></td>
</tr>
<tr>
<td><p><code>paginator.previous_page</code></p></td>
<td><p>The number of the previous page.</p></td>
</tr>
<tr>
<td><p><code>paginator.next_page</code></p></td>
<td><p>The number of the next page.</p></td>
</tr>
</tbody>
</table>
<div class="note info">
<h5>Paginator variable availability</h5>
<p>These are only available in index files, however they can be located in a subdirectory, such as <code>/blog/index.html</code>.</p>
</div>

62
site/css/grid.css Normal file
View File

@ -0,0 +1,62 @@
.content {
width: 978px;
margin: 0 auto;
}
.grid1, .grid2, .grid3, .grid4, .grid5, .grid6, .grid7, .grid8, .grid9, .grid10, .grid11 {
float: left;
display: inline;
margin-left: 30px;
}
.grid1 {
width: 54px;
}
.grid2 {
width: 138px;
}
.grid3 {
width: 222px;
}
.grid4 {
width: 306px;
}
.grid5 {
width: 390px;
}
.grid6 {
width: 474px;
}
.grid7 {
width: 558px;
}
.grid8 {
width: 642px;
}
.grid9 {
width: 726px;
}
.grid10 {
width: 810px;
}
.grid11 {
width: 894px;
}
.first {
margin-left: 0;
clear: left;
}
/* clearfix */
.clear:after {
visibility: hidden;
display: block;
font-size: 0;
content: " ";
clear: both;
height: 0;
}
* html .clear {
zoom: 1;
} /* IE6 */
*:first-child+html .clear {
zoom: 1;
} /* IE7 */

504
site/css/normalize.css vendored Executable file
View File

@ -0,0 +1,504 @@
/*! normalize.css 2012-03-11T12:53 UTC - http://github.com/necolas/normalize.css */
/* =============================================================================
HTML5 display definitions
========================================================================== */
/*
* Corrects block display not defined in IE6/7/8/9 & FF3
*/
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
nav,
section,
summary {
display: block;
}
/*
* Corrects inline-block display not defined in IE6/7/8/9 & FF3
*/
audio,
canvas,
video {
display: inline-block;
*display: inline;
*zoom: 1;
}
/*
* Prevents modern browsers from displaying 'audio' without controls
* Remove excess height in iOS5 devices
*/
audio:not([controls]) {
display: none;
height: 0;
}
/*
* Addresses styling for 'hidden' attribute not present in IE7/8/9, FF3, S4
* Known issue: no IE6 support
*/
[hidden] {
display: none;
}
/* =============================================================================
Base
========================================================================== */
/*
* 1. Corrects text resizing oddly in IE6/7 when body font-size is set using em units
* http://clagnut.com/blog/348/#c790
* 2. Prevents iOS text size adjust after orientation change, without disabling user zoom
* www.456bereastreet.com/archive/201012/controlling_text_size_in_safari_for_ios_without_disabling_user_zoom/
*/
html {
font-size: 100%; /* 1 */
-webkit-text-size-adjust: 100%; /* 2 */
-ms-text-size-adjust: 100%; /* 2 */
}
/*
* Addresses font-family inconsistency between 'textarea' and other form elements.
*/
html,
button,
input,
select,
textarea {
font-family: sans-serif;
}
/*
* Addresses margins handled incorrectly in IE6/7
*/
body {
margin: 0;
}
/* =============================================================================
Links
========================================================================== */
/*
* Addresses outline displayed oddly in Chrome
*/
a:focus {
outline: thin dotted;
}
/*
* Improves readability when focused and also mouse hovered in all browsers
* people.opera.com/patrickl/experiments/keyboard/test
*/
a:hover,
a:active {
outline: 0;
}
/* =============================================================================
Typography
========================================================================== */
/*
* Addresses font sizes and margins set differently in IE6/7
* Addresses font sizes within 'section' and 'article' in FF4+, Chrome, S5
*/
h1 {
font-size: 2em;
margin: 0.67em 0;
}
h2 {
font-size: 1.5em;
margin: 0.83em 0;
}
h3 {
font-size: 1.17em;
margin: 1em 0;
}
h4 {
font-size: 1em;
margin: 1.33em 0;
}
h5 {
font-size: 0.83em;
margin: 1.67em 0;
}
h6 {
font-size: 0.75em;
margin: 2.33em 0;
}
/*
* Addresses styling not present in IE7/8/9, S5, Chrome
*/
abbr[title] {
border-bottom: 1px dotted;
}
/*
* Addresses style set to 'bolder' in FF3+, S4/5, Chrome
*/
b,
strong {
font-weight: bold;
}
blockquote {
margin: 1em 40px;
}
/*
* Addresses styling not present in S5, Chrome
*/
dfn {
font-style: italic;
}
/*
* Addresses styling not present in IE6/7/8/9
*/
mark {
background: #ff0;
color: #000;
}
/*
* Addresses margins set differently in IE6/7
*/
p,
pre {
margin: 1em 0;
}
/*
* Corrects font family set oddly in IE6, S4/5, Chrome
* en.wikipedia.org/wiki/User:Davidgothberg/Test59
*/
pre,
code,
kbd,
samp {
font-family: monospace, serif;
_font-family: 'courier new', monospace;
font-size: 1em;
}
/*
* Improves readability of pre-formatted text in all browsers
*/
pre {
white-space: pre;
white-space: pre-wrap;
word-wrap: break-word;
}
/*
* 1. Addresses CSS quotes not supported in IE6/7
* 2. Addresses quote property not supported in S4
*/
/* 1 */
q {
quotes: none;
}
/* 2 */
q:before,
q:after {
content: '';
content: none;
}
small {
font-size: 75%;
}
/*
* Prevents sub and sup affecting line-height in all browsers
* gist.github.com/413930
*/
sub,
sup {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
}
sup {
top: -0.5em;
}
sub {
bottom: -0.25em;
}
/* =============================================================================
Lists
========================================================================== */
/*
* Addresses margins set differently in IE6/7
*/
dl,
menu,
ol,
ul {
margin: 1em 0;
}
dd {
margin: 0 0 0 40px;
}
/*
* Addresses paddings set differently in IE6/7
*/
menu,
ol,
ul {
padding: 0 0 0 40px;
}
/*
* Corrects list images handled incorrectly in IE7
*/
nav ul,
nav ol {
list-style: none;
list-style-image: none;
}
/* =============================================================================
Embedded content
========================================================================== */
/*
* 1. Removes border when inside 'a' element in IE6/7/8/9, FF3
* 2. Improves image quality when scaled in IE7
* code.flickr.com/blog/2008/11/12/on-ui-quality-the-little-things-client-side-image-resizing/
*/
img {
border: 0; /* 1 */
-ms-interpolation-mode: bicubic; /* 2 */
}
/*
* Corrects overflow displayed oddly in IE9
*/
svg:not(:root) {
overflow: hidden;
}
/* =============================================================================
Figures
========================================================================== */
/*
* Addresses margin not present in IE6/7/8/9, S5, O11
*/
figure {
margin: 0;
}
/* =============================================================================
Forms
========================================================================== */
/*
* Corrects margin displayed oddly in IE6/7
*/
form {
margin: 0;
}
/*
* Define consistent border, margin, and padding
*/
fieldset {
border: 1px solid #c0c0c0;
margin: 0 2px;
padding: 0.35em 0.625em 0.75em;
}
/*
* 1. Corrects color not being inherited in IE6/7/8/9
* 2. Corrects text not wrapping in FF3
* 3. Corrects alignment displayed oddly in IE6/7
*/
legend {
border: 0; /* 1 */
padding: 0;
white-space: normal; /* 2 */
*margin-left: -7px; /* 3 */
}
/*
* 1. Corrects font size not being inherited in all browsers
* 2. Addresses margins set differently in IE6/7, FF3+, S5, Chrome
* 3. Improves appearance and consistency in all browsers
*/
button,
input,
select,
textarea {
font-size: 100%; /* 1 */
margin: 0; /* 2 */
vertical-align: baseline; /* 3 */
*vertical-align: middle; /* 3 */
}
/*
* Addresses FF3/4 setting line-height on 'input' using !important in the UA stylesheet
*/
button,
input {
line-height: normal; /* 1 */
}
/*
* 1. Improves usability and consistency of cursor style between image-type 'input' and others
* 2. Corrects inability to style clickable 'input' types in iOS
* 3. Removes inner spacing in IE7 without affecting normal text inputs
* Known issue: inner spacing remains in IE6
*/
button,
input[type="button"],
input[type="reset"],
input[type="submit"] {
cursor: pointer; /* 1 */
-webkit-appearance: button; /* 2 */
*overflow: visible; /* 3 */
}
/*
* Re-set default cursor for disabled elements
*/
button[disabled],
input[disabled] {
cursor: default;
}
/*
* 1. Addresses box sizing set to content-box in IE8/9
* 2. Removes excess padding in IE8/9
* 3. Removes excess padding in IE7
Known issue: excess padding remains in IE6
*/
input[type="checkbox"],
input[type="radio"] {
box-sizing: border-box; /* 1 */
padding: 0; /* 2 */
*height: 13px; /* 3 */
*width: 13px; /* 3 */
}
/*
* 1. Addresses appearance set to searchfield in S5, Chrome
* 2. Addresses box-sizing set to border-box in S5, Chrome (include -moz to future-proof)
*/
input[type="search"] {
-webkit-appearance: textfield; /* 1 */
-moz-box-sizing: content-box;
-webkit-box-sizing: content-box; /* 2 */
box-sizing: content-box;
}
/*
* Removes inner padding and search cancel button in S5, Chrome on OS X
*/
input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button {
-webkit-appearance: none;
}
/*
* Removes inner padding and border in FF3+
* www.sitepen.com/blog/2008/05/14/the-devils-in-the-details-fixing-dojos-toolbar-buttons/
*/
button::-moz-focus-inner,
input::-moz-focus-inner {
border: 0;
padding: 0;
}
/*
* 1. Removes default vertical scrollbar in IE6/7/8/9
* 2. Improves readability and alignment in all browsers
*/
textarea {
overflow: auto; /* 1 */
vertical-align: top; /* 2 */
}
/* =============================================================================
Tables
========================================================================== */
/*
* Remove most spacing between table cells
*/
table {
border-collapse: collapse;
border-spacing: 0;
}

70
site/css/pygments.css Normal file
View File

@ -0,0 +1,70 @@
/*.highlight { background: #333333; color: #ffffff}*/
.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #87ceeb} /* Comment */
.highlight .err { color: #ffffff} /* Error */
.highlight .g { color: #ffffff} /* Generic */
.highlight .k { color: #f0e68c} /* Keyword */
.highlight .l { color: #ffffff} /* Literal */
.highlight .n { color: #ffffff} /* Name */
.highlight .o { color: #ffffff} /* Operator */
.highlight .x { color: #ffffff} /* Other */
.highlight .p { color: #ffffff} /* Punctuation */
.highlight .cm { color: #87ceeb} /* Comment.Multiline */
.highlight .cp { color: #cd5c5c} /* Comment.Preproc */
.highlight .c1 { color: #87ceeb} /* Comment.Single */
.highlight .cs { color: #87ceeb} /* Comment.Special */
.highlight .gd { color: #0000c0; font-weight: bold; background-color: #008080 } /* Generic.Deleted */
.highlight .ge { color: #c000c0; text-decoration: underline} /* Generic.Emph */
.highlight .gr { color: #c0c0c0; font-weight: bold; background-color: #c00000 } /* Generic.Error */
.highlight .gh { color: #cd5c5c} /* Generic.Heading */
.highlight .gi { color: #ffffff; background-color: #0000c0 } /* Generic.Inserted */
.highlight .go { color: #add8e6; font-weight: bold; background-color: #4d4d4d } /* Generic.Output */
.highlight .gp { color: #ffffff} /* Generic.Prompt */
.highlight .gs { color: #ffffff} /* Generic.Strong */
.highlight .gu { color: #cd5c5c} /* Generic.Subheading */
.highlight .gt { color: #c0c0c0; font-weight: bold; background-color: #c00000 } /* Generic.Traceback */
.highlight .kc { color: #f0e68c} /* Keyword.Constant */
.highlight .kd { color: #f0e68c} /* Keyword.Declaration */
.highlight .kn { color: #f0e68c} /* Keyword.Namespace */
.highlight .kp { color: #f0e68c} /* Keyword.Pseudo */
.highlight .kr { color: #f0e68c} /* Keyword.Reserved */
.highlight .kt { color: #bdb76b} /* Keyword.Type */
.highlight .ld { color: #ffffff} /* Literal.Date */
.highlight .m { color: #ffffff} /* Literal.Number */
.highlight .s { color: #ffffff} /* Literal.String */
.highlight .na { color: #ffffff} /* Name.Attribute */
.highlight .nb { color: #ffffff} /* Name.Builtin */
.highlight .nc { color: #ffffff} /* Name.Class */
.highlight .no { color: #ffa0a0} /* Name.Constant */
.highlight .nd { color: #ffffff} /* Name.Decorator */
.highlight .ni { color: #ffdead} /* Name.Entity */
.highlight .ne { color: #ffffff} /* Name.Exception */
.highlight .nf { color: #ffffff} /* Name.Function */
.highlight .nl { color: #ffffff} /* Name.Label */
.highlight .nn { color: #ffffff} /* Name.Namespace */
.highlight .nx { color: #ffffff} /* Name.Other */
.highlight .py { color: #ffffff} /* Name.Property */
.highlight .nt { color: #f0e68c} /* Name.Tag */
.highlight .nv { color: #98fb98} /* Name.Variable */
.highlight .ow { color: #ffffff} /* Operator.Word */
.highlight .w { color: #ffffff} /* Text.Whitespace */
.highlight .mf { color: #ffffff} /* Literal.Number.Float */
.highlight .mh { color: #ffffff} /* Literal.Number.Hex */
.highlight .mi { color: #ffffff} /* Literal.Number.Integer */
.highlight .mo { color: #ffffff} /* Literal.Number.Oct */
.highlight .sb { color: #ffffff} /* Literal.String.Backtick */
.highlight .sc { color: #ffffff} /* Literal.String.Char */
.highlight .sd { color: #ffffff} /* Literal.String.Doc */
.highlight .s2 { color: #ffffff} /* Literal.String.Double */
.highlight .se { color: #ffffff} /* Literal.String.Escape */
.highlight .sh { color: #ffffff} /* Literal.String.Heredoc */
.highlight .si { color: #ffffff} /* Literal.String.Interpol */
.highlight .sx { color: #ffffff} /* Literal.String.Other */
.highlight .sr { color: #ffffff} /* Literal.String.Regex */
.highlight .s1 { color: #ffffff} /* Literal.String.Single */
.highlight .ss { color: #ffffff} /* Literal.String.Symbol */
.highlight .bp { color: #ffffff} /* Name.Builtin.Pseudo */
.highlight .vc { color: #98fb98} /* Name.Variable.Class */
.highlight .vg { color: #98fb98} /* Name.Variable.Global */
.highlight .vi { color: #98fb98} /* Name.Variable.Instance */
.highlight .il { color: #ffffff} /* Literal.Number.Integer.Long */

697
site/css/style.css Normal file
View File

@ -0,0 +1,697 @@
/* Base */
body {
font-family: Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-size: 21px;
font-weight: 300;
color: #ddd;
background: #333;
border-top: 5px solid #fc0;
box-shadow: inset 0 3px 30px rgba(0,0,0,.3);
text-shadow: 0 1px 3px rgba(0,0,0,.5);
}
/* Sections */
body > header, body > section, body > footer {
float: left;
width: 100%;
clear: both;
}
.content {
padding: 20px 0;
}
/* Header */
body > header {
padding: 40px 0 10px;
}
body > header .content {
padding: 0;
}
body > header h1 img {
margin-left: -30px;
}
body > header h1 span {
display: none;
}
/* Navigation */
nav {
margin-top: 52px;
}
nav ul {
padding: 0;
margin: 0;
}
nav li {
display: inline-block;
margin-left: 10px;
}
nav li a {
border-radius: 5px;
font-weight: 800;
font-size: 14px;
padding: 0.5em 1em;
text-shadow: none;
text-transform: uppercase;
transition: all .25s;
-moz-transition: all .25s;
-webkit-transition: all .25s;
}
nav li a:hover {
background: #252525;
box-shadow: inset 0 1px 3px rgba(0,0,0,.5), 0 1px 0 rgba(255,255,255,.1);
text-shadow: 0 1px 3px rgba(0,0,0,.5);
}
nav li.current a {
background: #fc0;
color: #222;
box-shadow: inset 0 1px 0 rgba(255,255,255,.5), 0 1px 5px rgba(0,0,0,.5);
text-shadow: 0 1px 0 rgba(255,255,255,.3);
}
/* Footer */
body > footer {
background: #222;
font-size: 16px;
padding-bottom: 5px;
color: #888;
margin-top: 40px;
}
body > footer a {
color: #fff;
}
body > footer .align-right p, body > footer .align-right img {
display: inline-block;
}
body > footer .align-right img {
position: relative;
top: 14px;
margin-left: 5px;
}
/* Utilities */
.align-left {
text-align: left;
}
.align-right {
text-align: right;
}
.align-center {
text-align: center;
}
/* Sections */
.intro .content {
padding: 10px 0 40px;
}
.intro p {
font-size: 3.2em;
line-height: 1em;
margin: 0;
}
.features .content {
padding: 20px 0 40px;
}
.quickstart {
background: #3F1F1F;
color: #fff;
margin: 60px 0 80px;
box-shadow: inset 0 3px 10px rgba(0,0,0,.4);
}
.quickstart .content {
padding: 0px 0;
}
.quickstart .code {
margin: -30px 0;
float: right;
}
.quickstart h4 {
margin: 48px 0 0;
font-size: 28px;
text-shadow: 0 1px 3px rgba(0,0,0,.8);
}
.free-hosting .content {
/*margin-bottom: 40px;*/
position: relative;
}
.free-hosting .pane {
background: #444;
border-radius: 10px;
padding: 40px 70px 30px;
/*color: #222;*/
text-shadow: none;
}
.free-hosting img {
float: left;
margin: -20px 40px -40px -20px;
}
.free-hosting h2 {
/*font-weight: 800;*/
}
.free-hosting p,
.free-hosting a {
font-weight: inherit;
}
.free-hosting p {
margin: 0.75em;
}
.free-hosting a {
/*color: #c00;*/
}
.free-hosting .content:after {
content: " ";
float: right;
background: url(../img/footer-arrow.png) top left no-repeat;
width: 73px;
height: 186px;
position: absolute;
right: 30px;
bottom: -60px;
}
/* Code */
.quickstart .code {
display: block;
background: #3d3d3d;
border-radius: 5px;
font-family: Menlo, Consolas, "Courier New", Courier, "Liberation Mono", monospace;
line-height: 1.3em;
box-shadow: 0 5px 30px rgba(0,0,0,.3);
}
.quickstart .code .title {
display: block;
text-align: center;
margin: 0;
padding: 5px 0;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
box-shadow: box-shadow: 0 3px 10px rgba(0,0,0,.5);
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-size: 16px;
font-weight: normal;
color: #444;
text-shadow: 0 1px 0 rgba(255,255,255,.5);
background: #f7f7f7;
background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2Y3ZjdmNyIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjclIiBzdG9wLWNvbG9yPSIjY2ZjZmNmIiBzdG9wLW9wYWNpdHk9IjEiLz4KICAgIDxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iI2FhYWFhYSIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgPC9saW5lYXJHcmFkaWVudD4KICA8cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMSIgaGVpZ2h0PSIxIiBmaWxsPSJ1cmwoI2dyYWQtdWNnZy1nZW5lcmF0ZWQpIiAvPgo8L3N2Zz4=);
background: -moz-linear-gradient(top, #f7f7f7 0%, #cfcfcf 7%, #aaaaaa 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f7f7f7), color-stop(7%,#cfcfcf), color-stop(100%,#aaaaaa));
background: -webkit-linear-gradient(top, #f7f7f7 0%,#cfcfcf 7%,#aaaaaa 100%);
background: -o-linear-gradient(top, #f7f7f7 0%,#cfcfcf 7%,#aaaaaa 100%);
background: -ms-linear-gradient(top, #f7f7f7 0%,#cfcfcf 7%,#aaaaaa 100%);
background: linear-gradient(top, #f7f7f7 0%,#cfcfcf 7%,#aaaaaa 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f7f7f7', endColorstr='#aaaaaa',GradientType=0 );
border-bottom: 1px solid #111;
}
.quickstart .code .shell {
padding: 20px;
text-shadow: none;
}
.quickstart .code .line {
display: block;
margin: 0;
padding: 0;
}
.quickstart .code .line span {
display: inline-block;
}
.quickstart .code .path {
color: #87ceeb;
}
.quickstart .code .prompt {
color: #cd5c5c;
}
.quickstart .code .command {
color: #f0e68c;
}
.quickstart .code .output {
color: #888;
}
/* Documentation */
.docs .content {
padding: 0;
}
.docs article {
background: #444;
border-radius: 10px;
padding: 40px 40px 30px;
box-shadow: 0 3px 10px rgba(0,0,0,.1);
min-height: 800px;
}
.docs aside {
padding-top: 30px;
}
.docs aside h4 {
text-transform: uppercase;
font-size: 14px;
font-weight: 700;
padding: 0 0 10px 30px;
margin-left: -30px;
display: inline-block;
border-bottom: 1px solid #c00;
}
.docs aside ul {
padding-left: 0;
}
.docs aside li {
list-style-type: none;
}
.docs aside li a {
font-size: 16px;
position: relative
}
.docs aside li.current a:before {
content: "";
border-color: transparent transparent transparent #444;
border-style: solid;
border-width: 10px;
width: 0;
height: 0;
position: absolute;
top: 0;
left: -30px;
}
.section-nav {
text-align: center;
padding-top: 40px;
position: relative;
background: url(../img/article-footer.png) top center no-repeat;
}
.section-nav > div {
width: 49.5%;
}
.section-nav a, .section-nav span {
color: #fff;
font-size: 16px;
text-transform: uppercase;
font-weight: 700;
padding: 8px 12px 10px;
border-radius: 5px;
/*border: 1px solid #333;*/
background: #999;
box-shadow: 0 1px 3px rgba(0,0,0,.3), inset 0 1px 1px rgba(255,255,255,.5);
background: #777;
}
.section-nav a:hover {
color: #fff;
background: #888;
}
.section-nav .next, .section-nav .prev {
position: relative;
}
.section-nav .next:after, .section-nav .prev:before {
font-size: 36px;
color: #222;
font-weight: 800;
text-shadow: 0 1px 0 rgba(255,255,255,.4);
position: absolute;
top: -7px;
}
.section-nav .next:after {
content: "";
right: 10px;
}
.section-nav .prev:before {
content: "";
left: 10px;
}
.section-nav .prev, .section-nav .prev:hover {
/*float: left;*/
padding-left: 30px;
}
.section-nav .next, .section-nav .next:hover {
/*float: right;*/
padding-right: 30px;
}
.section-nav .disabled {
opacity: .5;
/*filter: alpha*/
cursor: default;
}
/* Code Highlighting */
pre, code {
white-space: pre;
display: inline-block;
margin: 0;
padding: 0;
font-family: Menlo, Consolas, "Courier New", Courier, "Liberation Mono", monospace;
font-size: 16px;
padding: 0 .5em;
line-height: 1.8em;
}
.highlight, p > pre, p > code {
background: #333;
color: #fff;
border-radius: 5px;
box-shadow: inset 0 1px 10px rgba(0,0,0,.3),
0 1px 0 rgba(255,255,255,.1),
0 -1px 0 rgba(0,0,0,.5);
}
.highlight {
padding: 10px 0;
width: 100%;
overflow: scroll;
}
/* HTML Elements */
h1, h2, h3, h4, h5, h6 {
margin: 0;
}
a {
color: #fc0;
text-decoration: none;
transition: all .25s;
-moz-transition: all .25s;
-webkit-transition: all .25s;
}
a:hover {
color: #f90;
}
strong {
font-weight: 700;
}
p {
line-height: 1.5em;
}
.left { float: left; }
.right { float: right; }
.align-right { text-align: right; }
.align-left { text-align: left; }
.align-center { text-align: center; }
/* Article HTML */
article h2,
article h3,
article h4,
article h5,
article h6 {
margin: 1em 0;
}
article h4 {
color: #fff;
}
h5, h6 {
font-size: 1em;
font-style: italic;
}
article ul li p {
margin: 0;
}
article ul li, article ol li {
line-height: 1.5em;
margin-bottom: 0.5em;
}
article ul li blockquote {
margin: 10px 0;
}
blockquote {
border-left: 2px solid #777;
padding-left: 20px;
font-style: italic;
font-size: 18px;
font-weight: 500;
}
/* Tables */
table {
width: 100%;
background: #555;
margin: .5em 0;
border-radius: 5px;
box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
thead {
border-top-left-radius: 5px;
border-top-right-radius: 5px;
color: #fff;
background: #3a3a3a;
background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iIzNhM2EzYSIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiMxZTFlMWUiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+);
background: -moz-linear-gradient(top, #3a3a3a 0%, #1e1e1e 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#3a3a3a), color-stop(100%,#1e1e1e));
background: -webkit-linear-gradient(top, #3a3a3a 0%,#1e1e1e 100%);
background: -o-linear-gradient(top, #3a3a3a 0%,#1e1e1e 100%);
background: -ms-linear-gradient(top, #3a3a3a 0%,#1e1e1e 100%);
background: linear-gradient(to bottom, #3a3a3a 0%,#1e1e1e 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#3a3a3a', endColorstr='#1e1e1e',GradientType=0 );
}
thead th {
position: relative;
box-shadow: inset 0 1px 0 rgba(255,255,255,.1);
}
thead th:first-child {
border-top-left-radius: 5px;
}
thead th:last-child {
border-top-right-radius: 5px;
}
td {
padding: .5em .75em;
}
td p {
margin: 0;
}
th {
text-transform: uppercase;
font-size: 16px;
padding: .5em .75em;
text-shadow: 0 -1px 0 rgba(0,0,0,.9);
color: #888;
}
tbody td {
border-top: 1px solid rgba(0,0,0,.1);
box-shadow: inset 0 1px 0 rgba(255,255,255,.1);
background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2ZmZmZmZiIgc3RvcC1vcGFjaXR5PSIwLjEiLz4KICAgIDxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iI2ZmZmZmZiIgc3RvcC1vcGFjaXR5PSIwIi8+CiAgPC9saW5lYXJHcmFkaWVudD4KICA8cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMSIgaGVpZ2h0PSIxIiBmaWxsPSJ1cmwoI2dyYWQtdWNnZy1nZW5lcmF0ZWQpIiAvPgo8L3N2Zz4=);
background: -moz-linear-gradient(top, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(255,255,255,0.1)), color-stop(100%,rgba(255,255,255,0)));
background: -webkit-linear-gradient(top, rgba(255,255,255,0.1) 0%,rgba(255,255,255,0) 100%);
background: -o-linear-gradient(top, rgba(255,255,255,0.1) 0%,rgba(255,255,255,0) 100%);
background: -ms-linear-gradient(top, rgba(255,255,255,0.1) 0%,rgba(255,255,255,0) 100%);
background: linear-gradient(to bottom, rgba(255,255,255,0.1) 0%,rgba(255,255,255,0) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#1affffff', endColorstr='#00ffffff',GradientType=0 );
}
td p {
font-size: 16px;
}
td p code {
font-size: 14px;
}
code.option, th .option, code.filter, th .filter {
color: #50B600;
}
code.flag, th .flag, code.output, th .output {
color: #049DCE;
}
code.option, code.flag, code.filter, code.output {
margin-bottom: 2px;
}
/* Note types */
.note {
margin: 30px 0;
margin-left: -50px;
padding: 20px 20px 24px;
padding-left: 50px;
border-radius: 0px 5px 5px 0px;
position: relative;
box-shadow: 0 1px 5px rgba(0, 0, 0, .3), inset 0 1px 0 rgba(255,255,255,.2), inset 0 -1px 0 rgba(0,0,0,.3);
background: #7e6d42;
background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iIzdlNmQ0MiIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiM1YzRlMzUiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+);
background: -moz-linear-gradient(top, #7e6d42 0%, #5c4e35 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#7e6d42), color-stop(100%,#5c4e35));
background: -webkit-linear-gradient(top, #7e6d42 0%,#5c4e35 100%);
background: -o-linear-gradient(top, #7e6d42 0%,#5c4e35 100%);
background: -ms-linear-gradient(top, #7e6d42 0%,#5c4e35 100%);
background: linear-gradient(to bottom, #7e6d42 0%,#5c4e35 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#7e6d42', endColorstr='#5c4e35',GradientType=0 );
}
.note:before {
content: "";
position: absolute;
top: -10px;
left: 0px;
border-color: transparent #222 #222 transparent;
border-style: solid;
border-width: 5px;
width: 0;
height: 0;
}
.note h5, .note p {
margin: 0;
color: #fff;
}
.note h5 {
line-height: 1.5em;
font-weight: 800;
font-style: normal;
}
.note p {
font-weight: 400;
font-size: .75em;
}
.info {
background: #0389aa;
background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iIzAzODlhYSIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiMwMDYxN2YiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+);
background: -moz-linear-gradient(top, #0389aa 0%, #00617f 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#0389aa), color-stop(100%,#00617f));
background: -webkit-linear-gradient(top, #0389aa 0%,#00617f 100%);
background: -o-linear-gradient(top, #0389aa 0%,#00617f 100%);
background: -ms-linear-gradient(top, #0389aa 0%,#00617f 100%);
background: linear-gradient(to bottom, #0389aa 0%,#00617f 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#0389aa', endColorstr='#00617f',GradientType=0 );
}
.warning {
background: #9e2812;
background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iIzllMjgxMiIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiM2ZjBkMGQiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+);
background: -moz-linear-gradient(top, #9e2812 0%, #6f0d0d 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#9e2812), color-stop(100%,#6f0d0d));
background: -webkit-linear-gradient(top, #9e2812 0%,#6f0d0d 100%);
background: -o-linear-gradient(top, #9e2812 0%,#6f0d0d 100%);
background: -ms-linear-gradient(top, #9e2812 0%,#6f0d0d 100%);
background: linear-gradient(to bottom, #9e2812 0%,#6f0d0d 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#9e2812', endColorstr='#6f0d0d',GradientType=0 );
}
.info:before {
border-color: transparent #00617f #00617f transparent;
}
.warning:before {
border-color: transparent #6f0d0d #6f0d0d transparent;
}
.note:after {
content: "★";
color: #fc0;
position: absolute;
top: 14px;
left: 14px;
font-size: 28px;
font-weight: bold;
text-shadow: 0 -1px 0 rgba(0,0,0,.5);
}
.info:after {
content: "ⓘ";
color: #fff;
position: absolute;
top: 15px;
left: 15px;
font-size: 28px;
font-weight: bold;
text-shadow: 0 -1px 0 rgba(0,0,0,.5);
}
.warning:after {
content: "‼";
color: #fc0;
position: absolute;
top: 15px;
left: 15px;
font-size: 32px;
font-weight: bold;
text-shadow: 0 -1px 0 rgba(0,0,0,.5);
}

11
site/docs/index.html Normal file
View File

@ -0,0 +1,11 @@
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<meta http-equiv="refresh" content="0;url=home">
<title>Jekyll</title>
</head>
<body style="background: #333;">
</body>
</html>

BIN
site/favicon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
site/img/article-footer.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

BIN
site/img/footer-arrow.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
site/img/footer-logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
site/img/logo-2x.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

BIN
site/img/octojekyll.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
site/img/tube.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
site/img/tube1x.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

77
site/index.html Normal file
View File

@ -0,0 +1,77 @@
---
layout: default
title: Jekyll • Simple, blog-aware, static sites
overview: true
---
<section class="intro">
<div class="content">
<p class="first">Transform your plain text into static websites and blogs. <br />So easy, <strong>it&rsquo;s scary</strong>.</p>
</div>
</section>
<section class="features">
<div class="content">
<div class="grid4 first">
<h2>Simple</h2>
<p>
No more databases, comment moderation, or pesky updates to install—just <em>your content</em>.
</p>
<a href="https://github.com/mojombo/jekyll/wiki/Usage" class="">How Jekyll works &rarr;</a>
</div>
<div class="grid4">
<h2>Static</h2>
<p><a href="http://daringfireball.net/projects/markdown/">Markdown</a> (or <a href="http://textile.sitemonks.com/">Textile</a>), <a href="http://liquidmarkup.org/">Liquid</a>, HTML <span class="amp">&amp;</span> CSS go in. Static sites come out ready for deployment.</p>
<a href="https://github.com/mojombo/jekyll/wiki/Template-Data" class="">Jekyll template guide &rarr;</a>
</div>
<div class="grid4">
<h2>Blog-aware</h2>
<p>
Permalinks, categories, pages, posts, and custom layouts are all first-class citizens here.
</p>
<a href="https://github.com/mojombo/jekyll/wiki/Blog-Migrations" class="">Migrate your blog &rarr;</a>
</div>
<div class="clear"></div>
</div>
</section>
<section class="quickstart">
<div class="content">
<div class="grid5 first">
<h4>Get up and running <em>in seconds</em>.</h4>
</div>
<div class="code">
<p class="title">Quick-start Instructions</p>
<div class="shell">
<p class="line">
<span class="path">~</span>
<span class="prompt">$</span>
<span class="command">gem install jekyll</span>
</p>
<p class="line">
<span class="path">~</span>
<span class="prompt">$</span>
<span class="command">cd my/awesome/site</span>
</p>
<p class="line">
<span class="path">~/my/awesome/site</span>
<span class="prompt">$</span>
<span class="command">jekyll --server</span>
</p>
<p class="line">
<span class="output"># => Now browse to http://localhost:4000</span>
</p>
</div>
</div>
<div class="clear"></div>
</div>
</section>
<section class="free-hosting">
<div class="content">
<img src="img/octojekyll.png" alt="Free Jekyll hosting on GitHub Pages">
<div class="pane">
<h2><strong>Free hosting</strong> with GitHub Pages</h2>
<p>Sick of dealing with hosting companies? <a href="http://pages.github.com/">GitHub Pages</a> are <em>powered by Jekyll</em>, so you can easily deploy your site using GitHub for free&mdash;<a href="https://help.github.com/articles/setting-up-a-custom-domain-with-pages">custom domain name</a> and all.</p>
<a href="http://pages.github.com/" class="">Learn more about GitHub Pages &rarr;</a>
<div class="clear"></div>
</div>
</div>
</section>

4
site/js/modernizr-2.5.3.min.js vendored Executable file

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,5 @@
# Some stuff on the first line
---
test: good
---
Real content starts here

View File

@ -0,0 +1,4 @@
---
bad yaml: [
---
Real content starts here

View File

@ -0,0 +1,7 @@
---
test: good
---
Real content starts here
Ðóññêèé òåêñò

4
test/fixtures/front_matter.erb vendored Normal file
View File

@ -0,0 +1,4 @@
---
test: good
---
Real content starts here

View File

@ -31,4 +31,14 @@ class Test::Unit::TestCase
def clear_dest
FileUtils.rm_rf(dest_dir)
end
def capture_stdout
$old_stdout = $stdout
$stdout = StringIO.new
yield
$stdout.rewind
return $stdout.string
ensure
$stdout = $old_stdout
end
end

44
test/test_convertible.rb Normal file
View File

@ -0,0 +1,44 @@
require 'helper'
require 'ostruct'
class TestConvertible < Test::Unit::TestCase
context "yaml front-matter" do
setup do
@convertible = OpenStruct.new
@convertible.extend Jekyll::Convertible
@base = File.expand_path('../fixtures', __FILE__)
end
should "parse the front-matter correctly" do
ret = @convertible.read_yaml(@base, 'front_matter.erb')
assert_equal({'test' => 'good'}, ret)
end
should "not parse if the front-matter is not at the start of the file" do
ret = @convertible.read_yaml(@base, 'broken_front_matter1.erb')
assert_equal({}, ret)
end
should "not parse if there is syntax error in front-matter" do
name = 'broken_front_matter2.erb'
out = capture_stdout do
ret = @convertible.read_yaml(@base, name)
assert_equal({}, ret)
end
assert_match(/YAML Exception|syntax error/, out)
assert_match(/#{File.join(@base, name)}/, out)
end
if RUBY_VERSION >= '1.9.2'
should "not parse if there is encoding error in file" do
name = 'broken_front_matter3.erb'
out = capture_stdout do
ret = @convertible.read_yaml(@base, name)
assert_equal({}, ret)
end
assert_match(/invalid byte sequence in UTF-8/, out)
assert_match(/#{File.join(@base, name)}/, out)
end
end
end
end

View File

@ -4,7 +4,7 @@ class TestRedcarpet < Test::Unit::TestCase
context "redcarpet" do
setup do
config = {
'redcarpet' => { 'extensions' => ['smart'] },
'redcarpet' => { 'extensions' => ['smart', 'strikethrough', 'filter_html'] },
'markdown' => 'redcarpet'
}
@markdown = MarkdownConverter.new config
@ -14,8 +14,26 @@ class TestRedcarpet < Test::Unit::TestCase
assert_equal "<h1>Some Header</h1>", @markdown.convert('# Some Header #').strip
end
should "pass redcarpet extensions" do
should "pass redcarpet SmartyPants options" do
assert_equal "<p>&ldquo;smart&rdquo;</p>", @markdown.convert('"smart"').strip
end
should "pass redcarpet extensions" do
assert_equal "<p><del>deleted</del></p>", @markdown.convert('~~deleted~~').strip
end
should "pass redcarpet render options" do
assert_equal "<p><strong>bad code not here</strong>: i am bad</p>", @markdown.convert('**bad code not here**: <script>i am bad</script>').strip
end
should "render fenced code blocks" do
assert_equal "<div class=\"highlight\"><pre><code class=\"ruby\"><span class=\"nb\">puts</span> <span class=\"s2\">&quot;Hello world&quot;</span>\n</code></pre></div>", @markdown.convert(
<<-EOS
```ruby
puts "Hello world"
```
EOS
).strip
end
end
end

View File

@ -166,13 +166,33 @@ class TestSite < Test::Unit::TestCase
assert_equal files, @site.filter_entries(files)
end
context 'error handling' do
should "raise if destination is included in source" do
stub(Jekyll).configuration do
Jekyll::DEFAULTS.merge({'source' => source_dir, 'destination' => source_dir})
end
assert_raise Jekyll::FatalException do
site = Site.new(Jekyll.configuration)
end
end
should "raise if destination is source" do
stub(Jekyll).configuration do
Jekyll::DEFAULTS.merge({'source' => source_dir, 'destination' => File.join(source_dir, "..")})
end
assert_raise Jekyll::FatalException do
site = Site.new(Jekyll.configuration)
end
end
end
context 'with orphaned files in destination' do
setup do
clear_dest
@site.process
# generate some orphaned files:
# hidden file
File.open(dest_dir('.htpasswd'), 'w')
# single file
File.open(dest_dir('obsolete.html'), 'w')
# single file in sub directory
@ -190,7 +210,6 @@ class TestSite < Test::Unit::TestCase
end
teardown do
FileUtils.rm_f(dest_dir('.htpasswd'))
FileUtils.rm_f(dest_dir('obsolete.html'))
FileUtils.rm_rf(dest_dir('qux'))
FileUtils.rm_f(dest_dir('quux'))
@ -201,7 +220,6 @@ class TestSite < Test::Unit::TestCase
should 'remove orphaned files in destination' do
@site.process
assert !File.exist?(dest_dir('.htpasswd'))
assert !File.exist?(dest_dir('obsolete.html'))
assert !File.exist?(dest_dir('qux'))
assert !File.exist?(dest_dir('quux'))