diff options
author | Brandon Mathis <brandon@imathis.com> | 2011-06-22 18:53:17 -0400 |
---|---|---|
committer | Brandon Mathis <brandon@imathis.com> | 2011-06-22 18:53:17 -0400 |
commit | da514a65594ee9f2be0bcd0aa3325acc7720ffac (patch) | |
tree | 292a0f059f049210a12ac2f7cb9d34bfaab2d425 /themes/classic/_plugins | |
parent | a2ab1d48021b225921eeeffe76a956633a7f99ac (diff) | |
download | my_new_personal_website-da514a65594ee9f2be0bcd0aa3325acc7720ffac.tar.xz my_new_personal_website-da514a65594ee9f2be0bcd0aa3325acc7720ffac.zip |
1. Updated typography for blockquotes
2. Improved blockquote Liquid tag
3. Added custom layout Sass for making layout changes simple
Diffstat (limited to '')
-rw-r--r-- | themes/classic/_plugins/blockquote.rb | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/themes/classic/_plugins/blockquote.rb b/themes/classic/_plugins/blockquote.rb index 094e4bc3..2f0712bd 100644 --- a/themes/classic/_plugins/blockquote.rb +++ b/themes/classic/_plugins/blockquote.rb @@ -11,7 +11,7 @@ # <blockquote> # <p>Wheeee!</p> # <footer> -# <strong>John Paul Jones</strong><cite><a href="http://google.com/blah">The Search For Bobby's Mom</a> +# <strong>Bobby Willis</strong><cite><a href="http://google.com/blah">The Search For Bobby's Mom</a> # </blockquote> # require './_plugins/titlecase.rb' @@ -40,18 +40,33 @@ module Jekyll end def render(context) - output = super - author = "<strong>#{@by}</strong>" - cite = "<cite><a class='source' href='#{@source}'>#{(@title || 'source')}</a></cite>" + output = paragraphize(super.map(&:strip).join) + author = "<strong>#{@by.strip}</strong>" + if @source + url = @source.match(/https?:\/\/(.+)/)[1].split('/') + parts = [] + url.each do |part| + if (parts + [part]).join('/').length < 32 + parts << part + end + end + source = parts.join('/') + source << '/…' unless source == @source + end + cite = "<cite><a href='#{@source}'>#{(@title || source)}</a></cite>" reply = if @by.nil? - "<p>#{output.join.gsub(/\n\n/, '</p><p>')}</p>" + output elsif !@source.nil? - "<p>#{output.join.gsub(/\n\n/, '</p><p>')}</p><footer>#{author + cite}</footer>" + "#{output}<footer>#{author + cite}</footer>" else - "<p>#{output.join.gsub(/\n\n/, '</p><p>')}</p><footer>#{author}</footer>" + "#{output}<footer>#{author}</footer>" end "<blockquote>#{reply}</blockquote>" end + + def paragraphize(input) + "<p>#{input.gsub(/\n\n/, '</p><p>').gsub(/\n/, '<br/>')}</p>" + end end end |