Class: Jekyll::UJCommentsTag
- Inherits:
-
Liquid::Tag
- Object
- Liquid::Tag
- Jekyll::UJCommentsTag
- Defined in:
- lib/tags/fake_comments.rb
Instance Method Summary collapse
-
#initialize(tag_name, markup, tokens) ⇒ UJCommentsTag
constructor
A new instance of UJCommentsTag.
- #render(context) ⇒ Object
Constructor Details
#initialize(tag_name, markup, tokens) ⇒ UJCommentsTag
6 7 8 9 |
# File 'lib/tags/fake_comments.rb', line 6 def initialize(tag_name, markup, tokens) super @markup = markup.strip end |
Instance Method Details
#render(context) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/tags/fake_comments.rb', line 11 def render(context) # Get the content to analyze content = resolve_content(context) return '0' unless content # Strip HTML tags stripped_content = strip_html(content) # Count words words = count_words(stripped_content) # Generate comment count based on word count modulo 13 comments = words % 13 comments.to_s end |