lib/intranet/pandoc/responder.rb in intranet-pandoc-1.0.0 vs lib/intranet/pandoc/responder.rb in intranet-pandoc-1.1.0
- old
+ new
@@ -61,11 +61,11 @@
# @param query [Hash<String,String>] The URI variable/value pairs, if any.
# @return [Integer, String, String] The HTTP return code, the MIME type and the answer body.
def generate_page(path, query)
case path
when %r{^/.+\.html$} then serve_page(path.gsub(%r{^/(.+)\.html$}, '\\1'))
- when %r{^/.+\.(jpg|png)$} then serve_media(path.gsub(%r{^/(.+)$}, '\\1'))
+ when %r{^/.+\.(jpg|png|svg)$} then serve_media(path.gsub(%r{^/(.+)$}, '\\1'))
else super(path, query)
end
end
# The title of the module instance, as displayed on the web page.
@@ -85,11 +85,11 @@
def scripts
[]
end
# Provides the list of Lua filters to be passed to Pandoc when converting mardown to HTML.
- # @return [Array<String>] The list of Lua filters, relative to the .
+ # @return [Array<String>] The list of Lua filters.
def lua_filters
[
File.join(resources_dir, 'filters', 'titles-shift-levels.lua'),
File.join(resources_dir, 'filters', 'links-open-external-in-new-tab.lua')
]
@@ -102,10 +102,10 @@
# Convert a single markdown file to HTML format and returns the markup.
# @param path [String] The path to the markdown file, relative to the module root directory
# and without extension.
# @raise [RuntimeError] If pandoc fails for whatever reason.
def convert_to_html(path)
- input = "\"#{File.join(@rootdir, "#{path}.md")}\""
+ input = File.join(@rootdir, "#{path}.md")
filters = lua_filters.map { |filter| "--lua-filter=\"#{filter}\"" }
options = ['--standalone', "--template=\"#{@template}\""] unless @template.to_s.empty?
PandocRuby.new([input], filters, options).to_html
end