Renderer: #output_ext should check to make sure the output extension of the permalink isn't empty
This commit is contained in:
parent
a351a70b03
commit
4de1873b56
|
@ -22,21 +22,7 @@ module Jekyll
|
|||
#
|
||||
# Returns the output extname including the leading period.
|
||||
def output_ext
|
||||
@output_ext ||= if document.permalink
|
||||
File.extname(document.permalink)
|
||||
else
|
||||
if output_exts.size == 1
|
||||
output_exts.last
|
||||
else
|
||||
output_exts[-2]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def output_exts
|
||||
@output_exts ||= converters.map do |c|
|
||||
c.output_ext(document.extname)
|
||||
end.compact
|
||||
@output_ext ||= (permalink_ext || converter_output_ext)
|
||||
end
|
||||
|
||||
######################
|
||||
|
@ -178,5 +164,28 @@ module Jekyll
|
|||
|
||||
output
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def permalink_ext
|
||||
if document.permalink
|
||||
permalink_ext = File.extname(document.permalink)
|
||||
permalink_ext unless permalink_ext.empty?
|
||||
end
|
||||
end
|
||||
|
||||
def converter_output_ext
|
||||
if output_exts.size == 1
|
||||
output_exts.last
|
||||
else
|
||||
output_exts[-2]
|
||||
end
|
||||
end
|
||||
|
||||
def output_exts
|
||||
@output_exts ||= converters.map do |c|
|
||||
c.output_ext(document.extname)
|
||||
end.compact
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue