Merge branch 'master' of github.com:imathis/octopress

Conflicts:
	plugins/category_generator.rb
This commit is contained in:
Leonardo Saraiva 2013-02-24 20:51:31 -03:00
commit 2fe9da91f5
27 changed files with 3374 additions and 1572 deletions

View file

@ -2,7 +2,7 @@ require './plugins/pygments_code'
module BacktickCodeBlock
include HighlightCode
AllOptions = /([^\s]+)\s+(.+?)(https?:\/\/\S+)\s*(.+)?/i
AllOptions = /([^\s]+)\s+(.+?)\s+(https?:\/\/\S+|\/\S+)\s*(.+)?/i
LangCaption = /([^\s]+)\s*(.+)?/i
def render_code_block(input)
@options = nil

View file

@ -21,6 +21,7 @@ module Jekyll
class Blockquote < Liquid::Block
FullCiteWithTitle = /(\S.*)\s+(https?:\/\/)(\S+)\s+(.+)/i
FullCite = /(\S.*)\s+(https?:\/\/)(\S+)/i
AuthorTitle = /([^,]+),([^,]+)/
Author = /(.+)/
def initialize(tag_name, markup, tokens)
@ -30,17 +31,15 @@ module Jekyll
if markup =~ FullCiteWithTitle
@by = $1
@source = $2 + $3
@title = $4.titlecase
@title = $4.titlecase.strip
elsif markup =~ FullCite
@by = $1
@source = $2 + $3
elsif markup =~ AuthorTitle
@by = $1
@title = $2.titlecase.strip
elsif markup =~ Author
if $1 =~ /([^,]+),([^,]+)/
@by = $1
@title = $2.titlecase
else
@by = $1
end
@by = $1
end
super
end

View file

@ -113,7 +113,17 @@ module Jekyll
# Throw an exception if the layout couldn't be found.
else
throw "No 'category_index' layout found."
raise <<-ERR
===============================================
Error for category_generator.rb plugin
-----------------------------------------------
No 'category_index.hmtl' in source/_layouts/
Perhaps you haven't installed a theme yet.
===============================================
ERR
end
end
@ -143,10 +153,7 @@ module Jekyll
# Returns string
#
def category_links(categories)
dir = @context.registers[:site].config['category_dir']
categories = categories.sort!.map do |item|
"<a class='category' href='/#{dir}/#{item.to_url}/'>#{item}</a>"
end
categories = categories.sort!.map { |c| category_link c }
case categories.length
when 0
@ -158,6 +165,17 @@ module Jekyll
end
end
# Outputs a single category as an <a> link.
#
# +category+ is a category string to format as an <a> link
#
# Returns string
#
def category_link(category)
dir = @context.registers[:site].config['category_dir']
"<a class='category' href='/#{dir}/#{category.to_url}/'>#{category}</a>"
end
# Outputs the post.date as formatted html, with hooks for CSS styling.
#
# +date+ is the date object to format as HTML.

View file

@ -49,8 +49,7 @@ module Jekyll
class CodeBlock < Liquid::Block
include HighlightCode
include TemplateWrapper
CaptionUrlTitle = /(\S[\S\s]*)\s+(https?:\/\/)(\S+)\s+(.+)/i
CaptionUrl = /(\S[\S\s]*)\s+(https?:\/\/)(\S+)/i
CaptionUrlTitle = /(\S[\S\s]*)\s+(https?:\/\/\S+|\/\S+)\s*(.+)?/i
Caption = /(\S[\S\s]*)/
def initialize(tag_name, markup, tokens)
@title = nil
@ -63,10 +62,7 @@ module Jekyll
end
if markup =~ CaptionUrlTitle
@file = $1
@caption = "<figcaption><span>#{$1}</span><a href='#{$2 + $3}'>#{$4}</a></figcaption>"
elsif markup =~ CaptionUrl
@file = $1
@caption = "<figcaption><span>#{$1}</span><a href='#{$2 + $3}'>link</a></figcaption>"
@caption = "<figcaption><span>#{$1}</span><a href='#{$2}'>#{$3 || 'link'}</a></figcaption>"
elsif markup =~ Caption
@file = $1
@caption = "<figcaption><span>#{$1}</span></figcaption>\n"

View file

@ -95,4 +95,4 @@ module Jekyll
self.data['updated_formatted'] = format_date(self.data['updated'], date_format) if self.data.has_key?('updated')
end
end
end
end

View file

@ -40,7 +40,9 @@ module Jekyll
end
def script_url_for(gist_id, filename)
"https://gist.github.com/#{gist_id}.js?file=#{filename}"
url = "https://gist.github.com/#{gist_id}.js"
url = "#{url}?file=#{filename}" unless filename.nil? or filename.empty?
url
end
def get_gist_url_for(gist, file)

View file

@ -37,4 +37,4 @@ module Jekyll
end
end
Liquid::Template.register_tag('jsfiddle', Jekyll::JsFiddle)
Liquid::Template.register_tag('jsfiddle', Jekyll::JsFiddle)

View file

@ -24,12 +24,12 @@ module Jekyll
class ContentFilters < PostFilter
include OctopressFilters
def pre_render(post)
if post.ext.match('html|textile|markdown|haml|slim|xml')
if post.ext.match('html|textile|markdown|md|haml|slim|xml')
post.content = pre_filter(post.content)
end
end
def post_render(post)
if post.ext.match('html|textile|markdown|haml|slim|xml')
if post.ext.match('html|textile|markdown|md|haml|slim|xml')
post.content = post_filter(post.content)
end
end

View file

@ -45,4 +45,4 @@ module Jekyll
self.posts = self.posts[-limit_posts, limit_posts] if limit_posts
end
end
end
end

View file

@ -1,6 +1,6 @@
# Sitemap.xml Generator is a Jekyll plugin that generates a sitemap.xml file by
# traversing all of the available posts and pages.
#
#
# How To Use:
# 1) Copy source file into your _plugins folder within your Jekyll project.
# 2) Change modify the url variable in _config.yml to reflect your domain name.
@ -28,12 +28,12 @@
# system modified date of the page or post, system modified date of
# included layout, system modified date of included layout within that
# layout, ...
#
#
# Author: Michael Levin
# Site: http://www.kinnetica.com
# Distributed Under A Creative Commons License
# - http://creativecommons.org/licenses/by/3.0/
#
#
# Modified for Octopress by John W. Long
#
require 'rexml/document'

View file

@ -22,22 +22,31 @@ module Jekyll
@width = ''
def initialize(tag_name, markup, tokens)
if markup =~ /((https?:\/\/|\/)(\S+))(\s+(\d+)\s(\d+))?(\s+(https?:\/\/|\/)(\S+))?/i
@video = $1
@width = $5
@height = $6
@poster = $7
if markup =~ /(https?:\S+)(\s+(https?:\S+))?(\s+(https?:\S+))?(\s+(\d+)\s(\d+))?(\s+(https?:\S+))?/i
@video = [$1, $3, $5].compact
@width = $7
@height = $8
@poster = $10
end
super
end
def render(context)
output = super
if @video
type = {
'mp4' => "type='video/mp4; codecs=\"avc1.42E01E, mp4a.40.2\"'",
'ogv' => "type='video/ogg; codecs=theora, vorbis'",
'webm' => "type='video/webm; codecs=vp8, vorbis'"
}
if @video.size > 0
video = "<video width='#{@width}' height='#{@height}' preload='none' controls poster='#{@poster}'>"
video += "<source src='#{@video}' type='video/mp4; codecs=\"avc1.42E01E, mp4a.40.2\"'/></video>"
@video.each do |v|
t = v.match(/([^\.]+)$/)[1]
video += "<source src='#{v}' #{type[t]}>"
end
video += "</video>"
else
"Error processing input, expected syntax: {% video url/to/video [width height] [url/to/poster] %}"
"Error processing input, expected syntax: {% video url/to/video [url/to/video] [url/to/video] [width height] [url/to/poster] %}"
end
end
end