Class: Gollum::Filter
- Inherits:
-
Object
- Object
- Gollum::Filter
- Includes:
- Helpers
- Defined in:
- lib/gollum-lib/filter.rb
Direct Known Subclasses
BibTeX, Code, CriticMarkup, Emoji, Macro, PandocBib, PlainText, PlantUML, RemoteCode, Render, Sanitize, TOC, Tags, YAML
Defined Under Namespace
Classes: BibTeX, Code, CriticMarkup, Emoji, Macro, PandocBib, PlainText, PlantUML, RemoteCode, Render, Sanitize, TOC, Tags, YAML
Constant Summary collapse
- PLACEHOLDER_PATTERN =
/%(\S+)%.+=\1=/
Instance Attribute Summary collapse
-
#close_pattern ⇒ Object
readonly
Returns the value of attribute close_pattern.
-
#open_pattern ⇒ Object
readonly
Returns the value of attribute open_pattern.
Instance Method Summary collapse
- #extract(data) ⇒ Object
-
#initialize(markup) ⇒ Filter
constructor
Setup the object.
- #process(data) ⇒ Object
Methods included from Helpers
#path_to_link_text, #trim_leading_slashes
Constructor Details
#initialize(markup) ⇒ Filter
Setup the object. Sets ‘@markup` to be the instance of Gollum::Markup that is running this filter chain, and sets `@map` to be an empty hash (for use in your extract/process operations).
56 57 58 59 60 61 |
# File 'lib/gollum-lib/filter.rb', line 56 def initialize(markup) @markup = markup @map = {} @open_pattern = "%#{self.class.to_s.split('::').last}%" @close_pattern = "=#{self.class.to_s.split('::').last}=" end |
Instance Attribute Details
#close_pattern ⇒ Object (readonly)
Returns the value of attribute close_pattern.
63 64 65 |
# File 'lib/gollum-lib/filter.rb', line 63 def close_pattern @close_pattern end |
#open_pattern ⇒ Object (readonly)
Returns the value of attribute open_pattern.
63 64 65 |
# File 'lib/gollum-lib/filter.rb', line 63 def open_pattern @open_pattern end |
Instance Method Details
#extract(data) ⇒ Object
65 66 67 68 |
# File 'lib/gollum-lib/filter.rb', line 65 def extract(data) raise RuntimeError, "#{self.class} has not implemented ##extract!" end |
#process(data) ⇒ Object
70 71 72 73 |
# File 'lib/gollum-lib/filter.rb', line 70 def process(data) raise RuntimeError, "#{self.class} has not implemented ##process!" end |