Class: Mint::EPub
Class Method Summary collapse
Methods inherited from Plugin
after_render, before_render, commandline_name, commandline_options_file, config_directory, inherited, template_directory, underscore
Class Method Details
.after_publish(document) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/mint/plugins/epub.rb', line 28 def self.after_publish(document) # This check doesn't currently follow symlinks if document.destination_directory == Dir.getwd raise InvalidDocumentError end Dir.chdir document.destination_directory do = document chapters = document.chapters locals = { chapters: chapters }.merge prepare_directory! create_chapters! chapters, :locals => create! do |container| container.type = "container" container.locals = locals end create! do |content| content.type = "content" content.locals = locals end create! do |toc| toc.type = "toc" toc.locals = locals end create! do |title| title.type = "title" title.locals = locals end end FileUtils.rm document.destination_file self.zip! document.destination_directory, :mimetype => "application/epub+zip", :extension => "epub" FileUtils.rm_r document.destination_directory end |