From 8dd6aab52b14e1485168e169203db31cc331c42e Mon Sep 17 00:00:00 2001 From: Jason Weathered Date: Sun, 15 Jan 2012 13:55:06 +1030 Subject: [PATCH] Whitespace. --- _plugins/asset_tags.rb | 20 +++++++++++--------- _plugins/header_anchors.rb | 1 - _plugins/semantic_code_blocks.rb | 24 +++++++++--------------- _plugins/slugged_posts.rb | 2 -- _plugins/timeless_posts.rb | 8 +++----- _plugins/updated_posts.rb | 2 -- 6 files changed, 23 insertions(+), 34 deletions(-) diff --git a/_plugins/asset_tags.rb b/_plugins/asset_tags.rb index e679db5..f4eafc9 100644 --- a/_plugins/asset_tags.rb +++ b/_plugins/asset_tags.rb @@ -2,7 +2,6 @@ require 'active_support/core_ext/module/aliasing' module Jekyll - class Site attr_accessor :current_page end @@ -95,18 +94,20 @@ class StylesheetTag < AssetTag def path_prefix "stylesheets/" end - + def extensions %w(.css .sass .scss) end - + def calculate_timestamp(context) super + # find the page this tag is being rendered in site = context.registers[:site] page = site.pages.detect do |p| @local_path == p.instance_eval { File.join(@base, @dir, @name) } end + # if we have a page object (i.e. we are dynamically renderered) if page # render the page if it isn't already rendered @@ -114,13 +115,15 @@ def calculate_timestamp(context) page = page.clone # we need a clone as rendering isn't idempotent page.render site.layouts, site.site_payload end + # extract timestamps out of rendered page asset_timestamps = page.output.scan(%r[url\(["'][^"']+\?(\d+)["']\)]).map(&:first).map(&:to_i) + # pick the latest timestamp @timestamp = ([@timestamp] + asset_timestamps).max end end - + def render_tag %Q{} end @@ -130,11 +133,11 @@ class ImageTag < AssetTag def path_prefix "images/" end - + def extensions %w(.png .jpg .jpeg) end - + def render_tag %Q{} end @@ -144,16 +147,15 @@ class JavascriptTag < AssetTag def path_prefix "javascripts/" end - + def extensions %w(.js) end - + def render_tag %Q{} end end - end Liquid::Template.register_tag('asset', Jekyll::AssetTag) diff --git a/_plugins/header_anchors.rb b/_plugins/header_anchors.rb index 931d338..17f2a80 100644 --- a/_plugins/header_anchors.rb +++ b/_plugins/header_anchors.rb @@ -2,7 +2,6 @@ require 'active_support/core_ext/module/aliasing' # convert `## Foo Bar [example]` to `

Foo Bar

` - class Jekyll::MarkdownConverter def convert_with_header_anchors(content) html = convert_without_header_anchors(content) diff --git a/_plugins/semantic_code_blocks.rb b/_plugins/semantic_code_blocks.rb index b1deb75..007f893 100644 --- a/_plugins/semantic_code_blocks.rb +++ b/_plugins/semantic_code_blocks.rb @@ -2,50 +2,45 @@ require 'active_support/core_ext/module/aliasing' class Albino - def colorize(options = {}) - # disable the built in
and
 wrappers
     options[:O] = "#{@options[:O]},nowrap=true"
-    
+
     # call the colorizer
     html = execute([@@bin] + convert_options(options))
-    
+
     # move whole of  onto single line
     html.gsub! %r[()([^\n]*)(\n)()], '\1\2\4\3'
-    
+
     # wrap each line in  so we can style them easier
     html.gsub!(/^.*$/, '\0')
-    
+
     # convert  into  and add styling hook to 
     html.gsub! %r[^(.*)$], '\1'
-    
+
     # wrap the result in a 
 with our desired CSS classes
     "
#{html}
" - end alias_method :to_s, :colorize - + def convert_options(options = {}) @options.merge(options).inject [] do |args, (flag, value)| args += ["-#{flag}", "#{value}"] end end - end class Jekyll::HighlightBlock - def add_code_tags(code, lang) code # noop end - + remove_const :SYNTAX SYNTAX = /\A(\w+)(?:\s(.+))?\s\z/ - + def initialize_with_hl_lines(tag_name, markup, tokens) initialize_without_hl_lines(tag_name, markup, tokens) - + @options['O'].gsub!(/(hl_lines=)([0-9,-]+)/) do |match| prefix = $1 lines = [] @@ -60,5 +55,4 @@ def initialize_with_hl_lines(tag_name, markup, tokens) end unless @options['O'].nil? end alias_method_chain :initialize, :hl_lines - end diff --git a/_plugins/slugged_posts.rb b/_plugins/slugged_posts.rb index 3ccfc26..67dffa9 100644 --- a/_plugins/slugged_posts.rb +++ b/_plugins/slugged_posts.rb @@ -2,10 +2,8 @@ require 'active_support/core_ext/module/aliasing' class Jekyll::Post - def to_liquid_with_slug to_liquid_without_slug.merge('slug' => self.slug) end alias_method_chain :to_liquid, :slug - end diff --git a/_plugins/timeless_posts.rb b/_plugins/timeless_posts.rb index 8452a3c..7fb97af 100644 --- a/_plugins/timeless_posts.rb +++ b/_plugins/timeless_posts.rb @@ -1,23 +1,21 @@ raise 'Post not loaded' unless defined?(Jekyll::Post) class Jekyll::Post - # dates in filenames are now optional # if omitted, dates must be set in the metadata for published posts - + remove_const :MATCHER MATCHER = /^(.+\/)*(?:(\d+-\d+-\d+)-)?(.*)(\.[^.]+)$/ - + def process(name) m, cats, date, slug, ext = *name.match(MATCHER) self.date = date && Time.parse(date) self.slug = slug self.ext = ext end - + def initialize_with_timeless(site, source, dir, name) initialize_without_timeless(site, source, dir, name) self.published = false if self.date.nil? end alias_method_chain :initialize, :timeless - end diff --git a/_plugins/updated_posts.rb b/_plugins/updated_posts.rb index 9dd0961..4f4634a 100644 --- a/_plugins/updated_posts.rb +++ b/_plugins/updated_posts.rb @@ -2,7 +2,6 @@ require 'active_support/core_ext/module/aliasing' class Jekyll::Post - def initialize_with_updated(site, source, dir, name) initialize_without_updated(site, source, dir, name) self.data['updated'] = if self.data.has_key? 'updated' @@ -11,5 +10,4 @@ def initialize_with_updated(site, source, dir, name) self.data['last_modified'] = self.data['updated'] || self.date end alias_method_chain :initialize, :updated - end