aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorLeonardo Saraiva <vyper@maneh.org>2013-02-24 20:51:31 -0300
committerLeonardo Saraiva <vyper@maneh.org>2013-02-24 20:51:31 -0300
commit2fe9da91f5a4b5ba3edaee47ee24dbce523e739e (patch)
treecca3792ae030b550015633b4b855451fa8455bc3 /plugins
parente1020ed888439a480cb13af2585f9fea5283c609 (diff)
parent4790b939807be4d9abcc567f02773ff24b99320d (diff)
downloadmy_new_personal_website-2fe9da91f5a4b5ba3edaee47ee24dbce523e739e.tar.xz
my_new_personal_website-2fe9da91f5a4b5ba3edaee47ee24dbce523e739e.zip
Merge branch 'master' of github.com:imathis/octopress
Conflicts: plugins/category_generator.rb
Diffstat (limited to '')
-rw-r--r--plugins/backtick_code_block.rb2
-rw-r--r--plugins/blockquote.rb13
-rw-r--r--plugins/category_generator.rb28
-rw-r--r--plugins/code_block.rb8
-rw-r--r--plugins/date.rb2
-rw-r--r--plugins/gist_tag.rb4
-rw-r--r--plugins/jsfiddle.rb2
-rw-r--r--plugins/octopress_filters.rb4
-rw-r--r--plugins/preview_unpublished.rb2
-rw-r--r--plugins/sitemap_generator.rb6
-rw-r--r--plugins/video_tag.rb25
11 files changed, 60 insertions, 36 deletions
diff --git a/plugins/backtick_code_block.rb b/plugins/backtick_code_block.rb
index 40e7900b..8e2c1141 100644
--- a/plugins/backtick_code_block.rb
+++ b/plugins/backtick_code_block.rb
@@ -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
diff --git a/plugins/blockquote.rb b/plugins/blockquote.rb
index 62e7d143..ebdc0e89 100644
--- a/plugins/blockquote.rb
+++ b/plugins/blockquote.rb
@@ -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
diff --git a/plugins/category_generator.rb b/plugins/category_generator.rb
index 2a7a6731..a49c4296 100644
--- a/plugins/category_generator.rb
+++ b/plugins/category_generator.rb
@@ -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.
diff --git a/plugins/code_block.rb b/plugins/code_block.rb
index 44e34945..660f73d7 100644
--- a/plugins/code_block.rb
+++ b/plugins/code_block.rb
@@ -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"
diff --git a/plugins/date.rb b/plugins/date.rb
index b864f3e9..49fb79a3 100644
--- a/plugins/date.rb
+++ b/plugins/date.rb
@@ -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 \ No newline at end of file
+end
diff --git a/plugins/gist_tag.rb b/plugins/gist_tag.rb
index 74dd3b37..5f590e96 100644
--- a/plugins/gist_tag.rb
+++ b/plugins/gist_tag.rb
@@ -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)
diff --git a/plugins/jsfiddle.rb b/plugins/jsfiddle.rb
index 3ae173eb..a80becb3 100644
--- a/plugins/jsfiddle.rb
+++ b/plugins/jsfiddle.rb
@@ -37,4 +37,4 @@ module Jekyll
end
end
-Liquid::Template.register_tag('jsfiddle', Jekyll::JsFiddle) \ No newline at end of file
+Liquid::Template.register_tag('jsfiddle', Jekyll::JsFiddle)
diff --git a/plugins/octopress_filters.rb b/plugins/octopress_filters.rb
index 2ba93e9e..091f75aa 100644
--- a/plugins/octopress_filters.rb
+++ b/plugins/octopress_filters.rb
@@ -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
diff --git a/plugins/preview_unpublished.rb b/plugins/preview_unpublished.rb
index 321ffd6f..28cbdfe7 100644
--- a/plugins/preview_unpublished.rb
+++ b/plugins/preview_unpublished.rb
@@ -45,4 +45,4 @@ module Jekyll
self.posts = self.posts[-limit_posts, limit_posts] if limit_posts
end
end
-end \ No newline at end of file
+end
diff --git a/plugins/sitemap_generator.rb b/plugins/sitemap_generator.rb
index b63e9423..a08590bf 100644
--- a/plugins/sitemap_generator.rb
+++ b/plugins/sitemap_generator.rb
@@ -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'
diff --git a/plugins/video_tag.rb b/plugins/video_tag.rb
index 6b93be82..c6e67b77 100644
--- a/plugins/video_tag.rb
+++ b/plugins/video_tag.rb
@@ -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