Module: Jekyll::ReadMore::Filter
Constant Summary collapse
- EXCERPT_BREAK_TAG =
uses the markdown format <!— (three dashes)
"<!---excerpt-break-->"
Instance Method Summary collapse
- #get_post_excerpt(post) ⇒ Object
- #post_contains_excerpt_tag(post) ⇒ Object
- #strip_footnotes(content) ⇒ Object
Instance Method Details
#get_post_excerpt(post) ⇒ Object
31 32 33 34 35 36 37 38 39 |
# File 'lib/jekyll-read-more/filter.rb', line 31 def get_post_excerpt(post) if !post_contains_excerpt_tag?(post) return post end post_split = post.split(EXCERPT_BREAK_TAG) strip_footnotes(post_split[0]) end |
#post_contains_excerpt_tag(post) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/jekyll-read-more/filter.rb', line 19 def post_contains_excerpt_tag(post) if (!post) return false end if (post.strip.empty?) return false end post.include?(EXCERPT_BREAK_TAG) end |
#strip_footnotes(content) ⇒ Object
41 42 43 44 45 46 |
# File 'lib/jekyll-read-more/filter.rb', line 41 def strip_footnotes(content) # Example: <sup>...</sup> # Regex: <sup>.*?<\/sup>/mi content.gsub(/<sup>.*?<\/sup>/mi, '') end |