Class: Pandocomatic::FileInfoPreprocessor
- Defined in:
- lib/pandocomatic/processors/fileinfo_preprocessor.rb
Overview
FileInfoPreprocessor collects information about a file to be converted and mixes that information into that file’s metadata. It is a default preprocessor.
Class Method Summary collapse
-
.run(input, path, src_path, options) ⇒ Object
Run this FileInfoPreprocessor.
Class Method Details
.run(input, path, src_path, options) ⇒ Object
Run this FileInfoPreprocessor
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/pandocomatic/processors/fileinfo_preprocessor.rb', line 37 def self.run(input, path, src_path, ) created_at = File.stat(path).ctime modified_at = File.stat(path).mtime output = input output << "\n\n---\n" output << "pandocomatic-fileinfo:\n" output << " from: #{options['from']}\n" if .key? 'from' output << " to: #{options['to']}\n" if .key? 'to' output << " template: #{options['template']}\n" if .key? 'template' output << " path: '#{path}'\n" output << " src_path: '#{src_path}'\n" output << " created: #{created_at.strftime '%Y-%m-%d'}\n" output << " modified: #{modified_at.strftime '%Y-%m-%d'}\n" output << "...\n\n" end |