Browse Source
2. Improved Blockquote comment header 3. Added Include File and Pullquote plugins 4. Improved blog typography 5. Simplified "Read more" linkunreleased_contents
Brandon Mathis
14 years ago
14 changed files with 191 additions and 59 deletions
@ -0,0 +1,31 @@ |
|||
require 'pathname' |
|||
|
|||
module Jekyll |
|||
|
|||
class IncludePartialTag < Liquid::Tag |
|||
def initialize(tag_name, file, tokens) |
|||
super |
|||
@file = file.strip |
|||
end |
|||
|
|||
def render(context) |
|||
file_dir = (context.registers[:site].source || 'source') |
|||
file_path = Pathname.new(file_dir).expand_path |
|||
file = file_path + @file |
|||
|
|||
unless file.file? |
|||
return "File #{file} could not be found" |
|||
end |
|||
|
|||
Dir.chdir(file_path) do |
|||
partial = Liquid::Template.parse(file.read) |
|||
context.stack do |
|||
partial.render(context) |
|||
end |
|||
end |
|||
end |
|||
end |
|||
end |
|||
|
|||
Liquid::Template.register_tag('include_partial', Jekyll::IncludePartialTag) |
|||
|
@ -0,0 +1,42 @@ |
|||
# |
|||
# Author: Brandon Mathis |
|||
# Based on the sematic pullquote technique by Maykel Loomans at http://miekd.com/articles/pull-quotes-with-html5-and-css/ |
|||
# |
|||
# Outputs a span with a data-pullquote attribute set from the marked pullquote. Example: |
|||
# |
|||
# {% pullquote %} |
|||
# When writing longform posts, I find it helpful to include pullquotes, which help those scanning a post discern whether or not a post is helpful. |
|||
# It is important to note, {" pullquotes are merely visual in presentation and should not appear twice in the text. "} That is why it is prefered |
|||
# to use a CSS only technique for styling pullquotes. |
|||
# {% endpullquote %} |
|||
# ...will output... |
|||
# <p> |
|||
# <span data-pullquote="pullquotes are merely visual in presentation and should not appear twice in the text."> |
|||
# When writing longform posts, I find it helpful to include pullquotes, which help those scanning a post discern whether or not a post is helpful. |
|||
# It is important to note, pullquotes are merely visual in presentation and should not appear twice in the text. This is why a CSS only approach # for styling pullquotes is prefered. |
|||
# </span> |
|||
# </p> |
|||
# |
|||
|
|||
module Jekyll |
|||
|
|||
class PullquoteTag < Liquid::Block |
|||
PullQuoteMarkup = /\{(.+)\}/i |
|||
|
|||
def initialize(tag_name, markup, tokens) |
|||
super |
|||
end |
|||
|
|||
def render(context) |
|||
output = super |
|||
if output.join =~ /\{"\s*(.+)\s*"\}/ |
|||
@quote = $1 |
|||
"<span class='has-pullquote' data-pullquote='#{@quote}'>#{output.join.gsub(/\{"\s*|\s*"\}/, '')}</span>" |
|||
else |
|||
return "Surround your pullquote like this {! text to be quoted !}" |
|||
end |
|||
end |
|||
end |
|||
end |
|||
|
|||
Liquid::Template.register_tag('pullquote', Jekyll::PullquoteTag) |
@ -0,0 +1,7 @@ |
|||
{% if page.date %} |
|||
<time datetime="{{ page.date | datetime }}" pubdate {% if page.updated %} updated {% endif %}>{{ page.date | ordinalize }}</time> |
|||
{% endif %} |
|||
{% if page.updated %} |
|||
<time class="updated" datetime="{{ page.updated | datetime }}"></time> |
|||
{% endif %} |
|||
{% if author %}<span class="byline author vcard"><span class="fn">{{ author }}</span></span>{% endif %} |
Loading…
Reference in new issue