Class: Mint::Plugin
- Inherits:
-
Object
- Object
- Mint::Plugin
- Defined in:
- lib/mint/plugin.rb
Direct Known Subclasses
Class Method Summary collapse
-
.after_publish(document) ⇒ Object
Supports: - Change file, filesystem once written - Automatic cleanup of intermediate files, including all edge cases currently covered by transformation library.
-
.after_render(html_document) ⇒ Object
Supports: - Change preview HTML.
-
.before_render(text_document) ⇒ Object
Supports: - Change raw text.
- .commandline_name ⇒ Object
- .commandline_options_file ⇒ Object
- .config_directory ⇒ Object
- .inherited(plugin) ⇒ Object
- .template_directory ⇒ Object
- .underscore(opts = {}) ⇒ Object
Class Method Details
.after_publish(document) ⇒ Object
Supports:
-
Change file, filesystem once written
-
Automatic cleanup of intermediate files, including all edge cases currently covered by transformation library. (For example, if I generated a CSS file but am ultimately generating a PDF, I would want to have an automatic way to delete that CSS file.)
Use cases:
-
Zip set of documents into ePub and create manifest
-
Change file extension
-
Generate PDF from emitted HTML and get rid of intermediate files
-
Generate .doc (or any other OO UNO format) and get rid of intermediate files
NOTE: Unlike the other two callbacks, this doesn’t use the result of
the callback expression for anything. This callback is purely for
side effects like rearranging the file system.
133 134 |
# File 'lib/mint/plugin.rb', line 133 def self.after_publish(document) end |
.after_render(html_document) ⇒ Object
Supports:
-
Change preview HTML
Use cases:
-
Transform elements based on position or other HTML attributes For example: Add a class to the first paragraph of a document if it is italicized
Questions:
-
Could I allow jQuery use here?
113 114 115 |
# File 'lib/mint/plugin.rb', line 113 def self.after_render(html_document) html_document end |
.before_render(text_document) ⇒ Object
Supports:
-
Change raw text
Use cases:
-
Add footnote syntax on top of Markdown
-
Perform text analysis for use in later callbacks (?)
99 100 101 |
# File 'lib/mint/plugin.rb', line 99 def self.before_render(text_document) text_document end |
.commandline_name ⇒ Object
89 90 91 |
# File 'lib/mint/plugin.rb', line 89 def self.commandline_name Mint.commandline_name(self) end |
.commandline_options_file ⇒ Object
85 86 87 |
# File 'lib/mint/plugin.rb', line 85 def self. Mint.(self) end |
.config_directory ⇒ Object
81 82 83 |
# File 'lib/mint/plugin.rb', line 81 def self.config_directory Mint.config_directory(self) end |
.inherited(plugin) ⇒ Object
68 69 70 |
# File 'lib/mint/plugin.rb', line 68 def self.inherited(plugin) Mint.register_plugin! plugin end |
.template_directory ⇒ Object
77 78 79 |
# File 'lib/mint/plugin.rb', line 77 def self.template_directory Mint.template_directory(self) end |
.underscore(opts = {}) ⇒ Object
72 73 74 75 |
# File 'lib/mint/plugin.rb', line 72 def self.underscore(opts={}) opts[:ignore_prefix] ||= true Helpers.underscore self.name, :ignore_prefix => opts[:ignore_prefix] end |