mirror of
https://github.com/WatchOutNewsAgency/wona.github.com.git
synced 2026-01-01 01:16:26 +00:00
1. Removed pullquote and improved semantics of blockquote plugin.
2. Removed iterator plugin as it was not being used. 3. Added initial support for html5 video with flash fallback. 4. Added responsive scaling for embedded youtube and vimeo videos. 5. Improved footer styleing.
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
#
|
||||
# Author: Josediaz Gonzalez - https://github.com/josegonzalez
|
||||
# Source URL: https://github.com/josegonzalez/josediazgonzalez.com/blob/master/_plugins/blockquote.rb
|
||||
# Modified by Brandon Mathis
|
||||
# Modified by Brandon Mathis removed pullquotes and added simple cite paramaters
|
||||
#
|
||||
require './_plugins/titlecase.rb'
|
||||
module Jekyll
|
||||
@ -45,65 +45,14 @@ module Jekyll
|
||||
if @by.nil?
|
||||
'<blockquote><p>' + output.join + '</p></blockquote>'
|
||||
elsif !@title.nil?
|
||||
'<blockquote><p>' + output.join + '</p></blockquote>' + '<p><cite><strong>' + @by + '</strong>' + '<a class="source" href="' + @source + '">' + @title + '</a></cite></p>'
|
||||
'<blockquote><p>' + output.join + '</p>' + '<p><strong>' + @by + '</strong>' + '<cite><a class="source" href="' + @source + '">' + @title + '</a></cite></p></blockquote>'
|
||||
elsif !@source.nil?
|
||||
'<blockquote><p>' + output.join + '</p></blockquote>' + '<p><cite><strong>' + @by + '</strong>' + '<a class="source" href="' + @source + '">source</a></cite></p>'
|
||||
'<blockquote><p>' + output.join + '</p>' + '<p><strong>' + @by + '</strong>' + '<cite><a class="source" href="' + @source + '">source</a></cite></p></blockquote>'
|
||||
else
|
||||
'<blockquote><p>' + output.join + '</p></blockquote>' + '<p><cite><strong>' + @by + '</strong></cite></p>'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Outputs a string with a given attribution as a pullquote
|
||||
#
|
||||
# {% blockquote John Paul Jones %}
|
||||
# Monkeys!
|
||||
# {% endblockquote %}
|
||||
# ...
|
||||
# <blockquote class="pullquote">
|
||||
# Monkeys!
|
||||
# <br />
|
||||
# John Paul Jones
|
||||
# </blockquote>
|
||||
#
|
||||
class Pullquote < Liquid::Block
|
||||
FullCiteWithTitle = /([\w\s]+)(http:\/\/|https:\/\/)(\S+)([\w\s]+)/i
|
||||
FullCite = /([\w\s]+)(http:\/\/|https:\/\/)(\S+)/i
|
||||
Author = /([\w\s]+)/
|
||||
|
||||
def initialize(tag_name, markup, tokens)
|
||||
@by = nil
|
||||
@source = nil
|
||||
@title = nil
|
||||
if markup =~ FullCiteWithTitle
|
||||
@by = $1
|
||||
@source = $2 + $3
|
||||
@title = $4
|
||||
elsif markup =~ FullCite
|
||||
@by = $1
|
||||
@source = $2 + $3
|
||||
elsif markup =~ Author
|
||||
@by = $1
|
||||
end
|
||||
super
|
||||
end
|
||||
|
||||
def render(context)
|
||||
output = super
|
||||
if @by.nil?
|
||||
'<blockquote class="pullquote"><p>' + output.join + '</p></blockquote>'
|
||||
elsif @title
|
||||
'<blockquote class="pullquote"><p>' + output.join + '</p></blockquote>' + '<p><cite><strong>' + @by + '</strong>' + ' <a class="source" href="' + @source + '">' + @title + '</a></cite></p>'
|
||||
elsif @source
|
||||
'<blockquote class="pullquote"><p>' + output.join + '</p></blockquote>' + '<p><cite><strong>' + @by + '</strong>' + ' <a class="source" href="' + @source + '">source</a></cite></p>'
|
||||
elsif @by
|
||||
'<blockquote class="pullquote"><p>' + output.join + '</p></blockquote>' + '<p><cite><strong>' + @by + '</strong></cite></p>'
|
||||
'<blockquote><p>' + output.join + '</p>' + '<p><strong>' + @by + '</strong></p></blockquote>'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Liquid::Template.register_tag('blockquote', Jekyll::Blockquote)
|
||||
Liquid::Template.register_tag('pullquote', Jekyll::Pullquote)
|
||||
|
||||
|
||||
|
||||
@ -1,49 +0,0 @@
|
||||
##
|
||||
## Author: Jose Gonzalez - https://github.com/josegonzalez
|
||||
## Source URL: https://github.com/josegonzalez/josediazgonzalez.com/blob/master/_plugins/iterator.rb
|
||||
##
|
||||
|
||||
#module Jekyll
|
||||
#class Site
|
||||
#alias_method :orig_site_payload, :site_payload
|
||||
|
||||
## Constuct an array of hashes that will allow the user, using Liquid, to
|
||||
## iterate through the keys of _kv_hash_ and be able to iterate through the
|
||||
## elements under each key.
|
||||
##
|
||||
## Example:
|
||||
## categories = { 'Ruby' => [<Post>, <Post>] }
|
||||
## make_iterable(categories, :index => 'name', :items => 'posts')
|
||||
## Will allow the user to iterate through all categories and then iterate
|
||||
## though each post in the current category like so:
|
||||
## {% for category in site.categories %}
|
||||
## h1. {{ category.name }}
|
||||
## <ul>
|
||||
## {% for post in category.posts %}
|
||||
## <li>{{ post.title }}</li>
|
||||
## {% endfor %}
|
||||
## </ul>
|
||||
## {% endfor %}
|
||||
##
|
||||
## Returns [ {<index> => <kv_hash_key>, <items> => kv_hash[<kv_hash_key>]}, ... ]
|
||||
|
||||
#def make_iterable(kv_hash, options)
|
||||
#options = {:index => 'name', :items => 'items'}.merge(options)
|
||||
#result = []
|
||||
#kv_hash.sort.each do |key, value|
|
||||
#result << { options[:index] => key, options[:items] => value }
|
||||
#end
|
||||
#result
|
||||
#end
|
||||
|
||||
#def site_payload
|
||||
#payload = orig_site_payload
|
||||
#payload['site']['iterable'].merge!({
|
||||
#'categories' => make_iterable(self.categories, :index => 'name', :items => 'posts'),
|
||||
#'tags' => make_iterable(self.tags, :index => 'name', :items => 'posts')
|
||||
#})
|
||||
#payload
|
||||
#end
|
||||
|
||||
#end
|
||||
#end
|
||||
Reference in New Issue
Block a user