Sha256: e3ed1e8004de4e09f81468c0de063e781bc6a8128af5493c5adb539aaab61fa6
Contents?: true
Size: 1.13 KB
Versions: 1
Compression:
Stored size: 1.13 KB
Contents
module Jekyll module Zettel # Enrich page front matter with object meta data class References < Jekyll::Generator priority :highest attr_reader :site def generate(site) @site = site @site.config['citeproc'] = CiteProc::Processor.new locale: 'de-AT', style: 'apa', format: 'html' site.pages.each do |page| next unless page.path.to_s.end_with?('index.html') || page.path.to_s.end_with?('index.md') tie_reference(page) end end def tie_reference(doc) dir = File.dirname(doc.path) file = @site.in_source_dir(dir, 'reference.json') return unless File.exist?(file) doc.data['reference'] = SafeYAML.load_file(file) register_reference(doc, file) end def register_reference(doc, file) if doc.data['reference'].include?('id') @site.config['citeproc'].register doc.data['reference'] doc.data['citekey'] = doc.data['reference']['id'] else Jekyll.logger.warn LOG_KEY, 'missing property @id' Jekyll.logger.warn '', "./#{file}" end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
jekyll-zettel-0.2.0 | lib/jekyll/zettel/references.rb |