From 02dac280d0c74a0109e09b613b0a0714caebaf35 Mon Sep 17 00:00:00 2001 From: David Tchepak <dave@davesquared.net> Date: Thu, 2 Feb 2012 23:06:47 +1100 Subject: Extract category_link filter from category_generator.rb plugin Allows category_link to be used as a filter to display a link to any category. --- plugins/category_generator.rb | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'plugins') diff --git a/plugins/category_generator.rb b/plugins/category_generator.rb index bb5fd329..77e06afb 100644 --- a/plugins/category_generator.rb +++ b/plugins/category_generator.rb @@ -141,10 +141,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.gsub(/_|\P{Word}/, '-').gsub(/-{2,}/, '-').downcase}/'>#{item}</a>" - end + categories = categories.sort!.map { |c| category_link c } case categories.length when 0 @@ -156,6 +153,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.gsub(/_|\P{Word}/, '-').gsub(/-{2,}/, '-').downcase}/'>#{category}</a>" + end + # Outputs the post.date as formatted html, with hooks for CSS styling. # # +date+ is the date object to format as HTML. -- cgit v1.2.1 From 6029981e35eef840207bfcab423a8056e648ae3f Mon Sep 17 00:00:00 2001 From: Ivo Wever <ivo.wever@gmail.com> Date: Thu, 9 Aug 2012 23:34:41 +0300 Subject: Fix for issue #622 The filters bundled with Octopress are not applied to files ending in `.md`, because the match in octopress_filters.rb does not match `.md`. --- plugins/octopress_filters.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'plugins') 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 -- cgit v1.2.1 From 0ccd0679fdfd13da34b0236361abbd149a42a777 Mon Sep 17 00:00:00 2001 From: Liang Sun <i@liangsun.org> Date: Tue, 27 Nov 2012 10:18:12 +0800 Subject: To support url without domain name like /path/file You need to know if you would like to support this, each word in the title can not start with "/". --- plugins/backtick_code_block.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/backtick_code_block.rb b/plugins/backtick_code_block.rb index 40e7900b..0e7cee41 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+(.+?)(https?:\/\/\S+|\/\S+)\s*(.+)?/i LangCaption = /([^\s]+)\s*(.+)?/i def render_code_block(input) @options = nil -- cgit v1.2.1 From 72b4e8d5621dbb3c110fe2c273bcc3ac408ffc32 Mon Sep 17 00:00:00 2001 From: Brandon Mathis <brandon@imathis.com> Date: Tue, 18 Dec 2012 11:38:37 -0600 Subject: gist tag plugin now works with the latest changes GitHub gists and does not fail if you do not specify a filename. --- plugins/gist_tag.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'plugins') 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) -- cgit v1.2.1 From c18de558759dff2c77e6e0fc3ce2ad7a9f3fea99 Mon Sep 17 00:00:00 2001 From: Brandon Mathis <brandon@imathis.com> Date: Wed, 26 Dec 2012 17:18:29 -0600 Subject: Titles in code plugins can have slashes in them. Closes #892 --- plugins/backtick_code_block.rb | 2 +- plugins/code_block.rb | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'plugins') diff --git a/plugins/backtick_code_block.rb b/plugins/backtick_code_block.rb index 0e7cee41..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+)\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/code_block.rb b/plugins/code_block.rb index 44e34945..62c551a4 100644 --- a/plugins/code_block.rb +++ b/plugins/code_block.rb @@ -49,8 +49,8 @@ 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 + CaptionUrl = /(\S[\S\s]*)\s+(https?:\/\/\S+|\/\S+)/i Caption = /(\S[\S\s]*)/ def initialize(tag_name, markup, tokens) @title = nil @@ -63,10 +63,10 @@ module Jekyll end if markup =~ CaptionUrlTitle @file = $1 - @caption = "<figcaption><span>#{$1}</span><a href='#{$2 + $3}'>#{$4}</a></figcaption>" + @caption = "<figcaption><span>#{$1}</span><a href='#{$2}'>#{$3}</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}'>link</a></figcaption>" elsif markup =~ Caption @file = $1 @caption = "<figcaption><span>#{$1}</span></figcaption>\n" -- cgit v1.2.1 From 55fa9b3d8e82e5e2699e4d30a77a71bac26ba443 Mon Sep 17 00:00:00 2001 From: Brandon Mathis <brandon@imathis.com> Date: Wed, 26 Dec 2012 17:33:48 -0600 Subject: Removed unnecessary regex in code block plugin --- plugins/code_block.rb | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'plugins') diff --git a/plugins/code_block.rb b/plugins/code_block.rb index 62c551a4..660f73d7 100644 --- a/plugins/code_block.rb +++ b/plugins/code_block.rb @@ -50,7 +50,6 @@ module Jekyll include HighlightCode include TemplateWrapper CaptionUrlTitle = /(\S[\S\s]*)\s+(https?:\/\/\S+|\/\S+)\s*(.+)?/i - CaptionUrl = /(\S[\S\s]*)\s+(https?:\/\/\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}</a></figcaption>" - elsif markup =~ CaptionUrl - @file = $1 - @caption = "<figcaption><span>#{$1}</span><a href='#{$2}'>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" -- cgit v1.2.1 From 5b332f5c95f825221e2447ca4909136a162dbaae Mon Sep 17 00:00:00 2001 From: richo <richo@psych0tik.net> Date: Fri, 11 Jan 2013 23:10:08 +1100 Subject: Whitespace --- plugins/date.rb | 2 +- plugins/jsfiddle.rb | 2 +- plugins/preview_unpublished.rb | 2 +- plugins/sitemap_generator.rb | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) (limited to 'plugins') 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/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/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' -- cgit v1.2.1 From d774630d3eb77a1efa7eb6636b147b9b4cc97028 Mon Sep 17 00:00:00 2001 From: Brandon Mathis <brandon@imathis.com> Date: Sat, 12 Jan 2013 16:20:31 -0600 Subject: Improved error message for category_generator plugin. Addresses #116 --- plugins/category_generator.rb | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/category_generator.rb b/plugins/category_generator.rb index 77e06afb..d4840a8d 100644 --- a/plugins/category_generator.rb +++ b/plugins/category_generator.rb @@ -111,7 +111,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 -- cgit v1.2.1 From d686105bda06d05b7b7310d9ba9ad3f1e23c2cbf Mon Sep 17 00:00:00 2001 From: Sean Kerr <sean@code-box.org> Date: Wed, 9 Jan 2013 09:24:43 -0500 Subject: Fixed blockquote plugin (author alone would not show up without title) --- plugins/blockquote.rb | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'plugins') diff --git a/plugins/blockquote.rb b/plugins/blockquote.rb index 62e7d143..a5efde78 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) @@ -34,13 +35,11 @@ module Jekyll elsif markup =~ FullCite @by = $1 @source = $2 + $3 + elsif markup =~ AuthorTitle + @by = $1 + @title = $2.titlecase elsif markup =~ Author - if $1 =~ /([^,]+),([^,]+)/ - @by = $1 - @title = $2.titlecase - else - @by = $1 - end + @by = $1 end super end -- cgit v1.2.1 From cd6926e41bdd9b7170518648dae551b605ffbe73 Mon Sep 17 00:00:00 2001 From: Brandon Mathis <brandon@imathis.com> Date: Sat, 12 Jan 2013 16:36:15 -0600 Subject: Striped whitespace from titles in blockquote plugin --- plugins/blockquote.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/blockquote.rb b/plugins/blockquote.rb index a5efde78..ebdc0e89 100644 --- a/plugins/blockquote.rb +++ b/plugins/blockquote.rb @@ -31,13 +31,13 @@ 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 + @title = $2.titlecase.strip elsif markup =~ Author @by = $1 end -- cgit v1.2.1 From 8bf09b178d513a264b900186d20f5c0b928c7287 Mon Sep 17 00:00:00 2001 From: Brandon Mathis <brandon@imathis.com> Date: Sat, 12 Jan 2013 19:23:34 -0600 Subject: Video tag plugin now supports mp4,ogv,webm formats, closes #931 --- plugins/video_tag.rb | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'plugins') 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 -- cgit v1.2.1