zeus.ugent.be/lib/data_sources/katex.rb

17 lines
514 B
Ruby
Raw Normal View History

2021-02-26 15:24:40 +01:00
require 'katex'
class KatexDataSource < ::Nanoc::DataSource
identifier :katex
def items
katex_css_path = File.join(Katex.gem_path, 'vendor', 'katex', 'stylesheets', 'katex.css')
2021-03-18 22:12:15 +01:00
katex_font_paths = Dir[File.join(Katex.gem_path, 'vendor', 'katex', 'fonts', '*')]
2021-02-26 15:24:40 +01:00
2021-03-18 22:12:15 +01:00
font_items = katex_font_paths.map do |e|
font_name = File.split(e)[-1]
new_item(File.open(e).read, {}, "/fonts/#{font_name}")
end
[new_item(File.open(katex_css_path).read, {}, "/katex.css")] + font_items
2021-02-26 15:24:40 +01:00
end
end