Class: Bookify::Markdown
- Inherits:
-
Redcarpet::Render::HTML
- Object
- Redcarpet::Render::HTML
- Bookify::Markdown
- Defined in:
- lib/bookify/markdown.rb
Constant Summary collapse
- @@preprocessors =
[]
- @@postprocessors =
[]
Class Method Summary collapse
- .add_postprocessor(postprocessor) ⇒ Object
- .add_preprocessor(preprocessor) ⇒ Object
- .postprocessors ⇒ Object
- .preprocessors ⇒ Object
- .reset_postprocessors ⇒ Object
- .reset_preprocessors ⇒ Object
Instance Method Summary collapse
Class Method Details
.add_postprocessor(postprocessor) ⇒ Object
33 34 35 |
# File 'lib/bookify/markdown.rb', line 33 def self.add_postprocessor(postprocessor) @@postprocessors << postprocessor end |
.add_preprocessor(preprocessor) ⇒ Object
21 22 23 |
# File 'lib/bookify/markdown.rb', line 21 def self.add_preprocessor(preprocessor) @@preprocessors << preprocessor end |
.postprocessors ⇒ Object
41 42 43 |
# File 'lib/bookify/markdown.rb', line 41 def self.postprocessors @@postprocessors end |
.preprocessors ⇒ Object
29 30 31 |
# File 'lib/bookify/markdown.rb', line 29 def self.preprocessors @@preprocessors end |
.reset_postprocessors ⇒ Object
37 38 39 |
# File 'lib/bookify/markdown.rb', line 37 def self.reset_postprocessors @@postprocessors = [] end |
.reset_preprocessors ⇒ Object
25 26 27 |
# File 'lib/bookify/markdown.rb', line 25 def self.reset_preprocessors @@preprocessors = [] end |
Instance Method Details
#postprocess(string) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/bookify/markdown.rb', line 13 def postprocess(string) Bookify::Markdown.postprocessors.each do |postproc| string = postproc.call(string) end string end |
#preprocess(string) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/bookify/markdown.rb', line 5 def preprocess(string) Bookify::Markdown.preprocessors.each do |preproc| string = preproc.call(string) end string end |