Renderer: #output_ext should check to make sure the output extension of the permalink isn't empty

This commit is contained in:
Parker Moore 2016-01-18 14:09:14 -08:00
parent a351a70b03
commit 4de1873b56
1 changed files with 24 additions and 15 deletions

View File

@ -22,21 +22,7 @@ module Jekyll
# #
# Returns the output extname including the leading period. # Returns the output extname including the leading period.
def output_ext def output_ext
@output_ext ||= if document.permalink @output_ext ||= (permalink_ext || converter_output_ext)
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
end end
###################### ######################
@ -178,5 +164,28 @@ module Jekyll
output output
end 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
end end