Class: Yuzu::PostProcessors::ContentsWithoutFirstParagraphPostProcessor

Inherits:
PostProcessor
  • Object
show all
Defined in:
lib/yuzu/postprocessors/contents_without_first_paragraph.rb

Instance Attribute Summary

Attributes inherited from PostProcessor

#name

Instance Method Summary collapse

Methods inherited from PostProcessor

postprocessors, registry, #value

Constructor Details

#initializeContentsWithoutFirstParagraphPostProcessor

Returns a new instance of ContentsWithoutFirstParagraphPostProcessor.



5
6
7
8
# File 'lib/yuzu/postprocessors/contents_without_first_paragraph.rb', line 5

def initialize
  @name = :contents_without_first_paragraph
  @directive = "CONTENTSWITHOUTFIRSTPARAGRAPH"
end

Instance Method Details

#match(contents) ⇒ Object



14
15
16
# File 'lib/yuzu/postprocessors/contents_without_first_paragraph.rb', line 14

def match(contents)
  contents.sub(regex, "")
end

#regexObject



10
11
12
# File 'lib/yuzu/postprocessors/contents_without_first_paragraph.rb', line 10

def regex
  /<p\b[^>]*?>(.*?)<\/p>/n
end