Allow setting default mimetype for --server. Useful if permalinks don't end in .html
This commit is contained in:
parent
b3634b522a
commit
2f9d4f5be6
|
@ -44,6 +44,10 @@ opts = OptionParser.new do |opts|
|
||||||
options['baseurl'] = baseurl
|
options['baseurl'] = baseurl
|
||||||
end
|
end
|
||||||
|
|
||||||
|
opts.on("--default-mimetype [MT]", "Mimetype to use when no file extension (if --server)") do |mt|
|
||||||
|
options['default-mimetype'] = mt
|
||||||
|
end
|
||||||
|
|
||||||
opts.on("--[no-]lsi", "Use LSI for better related posts") do |lsi|
|
opts.on("--[no-]lsi", "Use LSI for better related posts") do |lsi|
|
||||||
options['lsi'] = lsi
|
options['lsi'] = lsi
|
||||||
end
|
end
|
||||||
|
@ -177,6 +181,9 @@ if options['server']
|
||||||
|
|
||||||
mime_types = WEBrick::HTTPUtils::DefaultMimeTypes
|
mime_types = WEBrick::HTTPUtils::DefaultMimeTypes
|
||||||
mime_types.store 'js', 'application/javascript'
|
mime_types.store 'js', 'application/javascript'
|
||||||
|
if options['default-mimetype']
|
||||||
|
mime_types.store nil, options['default-mimetype']
|
||||||
|
end
|
||||||
|
|
||||||
s = HTTPServer.new(
|
s = HTTPServer.new(
|
||||||
:Port => options['server_port'],
|
:Port => options['server_port'],
|
||||||
|
|
Loading…
Reference in New Issue