Class: Jekyll::Mentioji
- Inherits:
-
Object
- Object
- Jekyll::Mentioji
- Defined in:
- lib/jekyll-mentioji.rb
Constant Summary collapse
- MENTIONPATTERNS =
%r~(?:^|\B)@((?>[\w][\w-]*))(?!/)(?=\.+[ \t\W]|\.+$|[^\w.]|$)~i.freeze
- OPENING_BODY_TAG_REGEX =
%r!<body(.*?)>\s*!.freeze
- IGNORE_MENTION_PARENTS =
%w(pre code a script style).freeze
- IGNORE_EMOJI_PARENTS =
%w(pre code tt).freeze
Class Method Summary collapse
Class Method Details
.transform(doc) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/jekyll-mentioji.rb', line 16 def transform(doc) content = doc.output return unless prelim_check_regex.match?(content) setup_transformer(doc.site.config) doc.output = if content.include?("<body") process_html_body(content) else process(content) end end |
.transformable?(doc) ⇒ Boolean
28 29 30 31 |
# File 'lib/jekyll-mentioji.rb', line 28 def transformable?(doc) (doc.is_a?(Jekyll::Page) || doc.write?) && doc.output_ext == ".html" || (doc.permalink&.end_with?("/")) end |