mirror of
https://github.com/moparisthebest/android.moparisthebest.org
synced 2024-12-24 08:28:50 -05:00
Fixed a bug where blockquotes broke without an author, also refactored a bit for reability
This commit is contained in:
parent
98cfd74d9a
commit
a71a709cb3
@ -41,8 +41,8 @@ module Jekyll
|
|||||||
end
|
end
|
||||||
|
|
||||||
def render(context)
|
def render(context)
|
||||||
output = paragraphize(super.map(&:strip).join)
|
quote = paragraphize(super.map(&:strip).join)
|
||||||
author = "<strong>#{@by.strip}</strong>"
|
author = "<strong>#{@by.strip}</strong>" if @by
|
||||||
if @source
|
if @source
|
||||||
url = @source.match(/https?:\/\/(.+)/)[1].split('/')
|
url = @source.match(/https?:\/\/(.+)/)[1].split('/')
|
||||||
parts = []
|
parts = []
|
||||||
@ -55,14 +55,14 @@ module Jekyll
|
|||||||
source << '/…' unless source == @source
|
source << '/…' unless source == @source
|
||||||
end
|
end
|
||||||
cite = "<cite><a href='#{@source}'>#{(@title || source)}</a></cite>"
|
cite = "<cite><a href='#{@source}'>#{(@title || source)}</a></cite>"
|
||||||
result = if @by.nil?
|
quote_only = if @by.nil?
|
||||||
output
|
quote
|
||||||
elsif !@source.nil?
|
elsif !@source.nil?
|
||||||
"#{output}<footer>#{author + cite}</footer>"
|
"#{quote}<footer>#{author + cite}</footer>"
|
||||||
else
|
else
|
||||||
"#{output}<footer>#{author}</footer>"
|
"#{quote}<footer>#{author}</footer>"
|
||||||
end
|
end
|
||||||
"<blockquote>#{result}</blockquote>"
|
"<blockquote>#{quote_only}</blockquote>"
|
||||||
end
|
end
|
||||||
|
|
||||||
def paragraphize(input)
|
def paragraphize(input)
|
||||||
|
Loading…
Reference in New Issue
Block a user