jekyll-mentions 1.1.1 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/jekyll-mentions.rb +11 -1
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 134847e01e6b89b46835f4c6a65648fff0196c15
4
- data.tar.gz: 027012744c29e2cb839d55724152200365dfcce6
3
+ metadata.gz: b89fcfb1371b8e8a9ab22a97de0dfcb30008003e
4
+ data.tar.gz: f819872d3158adb4dd5a275711c937818945417c
5
5
  SHA512:
6
- metadata.gz: 8588ee5517b27026cb7752b65420d0f833be9793bdcbcd63d09c79e4c7fca385fd5a0134b5c0edbfaedb0b6121ee661059e7a622f83dbe762f476fec343cfa7e
7
- data.tar.gz: 26fd3d512aebb09474f9148196b9a9502e0e56179d77272927640faec9e2b157cd100fe734920f82cb0fd140575be4622ae809ea2eb71d0addbfb9b46f5a86f3
6
+ metadata.gz: 34c89dbec393270f5a214ceafbe54666191b3c70b32b9ef2711b7e59512cb374318bd23e96b86663986fe25310dd2e8d389846afd55b7620604f4d9f9fbea2c9
7
+ data.tar.gz: 009ca11e78e441653a7d8883f6e679bf1174deb95eac451480d7bbc3083de0e652efddfabf9b8c161635184c41e90d0f793c07074c1765f5af755f10fcff9049
@@ -4,13 +4,23 @@ require 'html/pipeline'
4
4
  module Jekyll
5
5
  class Mentions
6
6
  GITHUB_DOT_COM = "https://github.com".freeze
7
+ BODY_START_TAG = "<body".freeze
8
+
7
9
 
8
10
  InvalidJekyllMentionConfig = Class.new(Jekyll::Errors::FatalException)
9
11
 
10
12
  class << self
11
13
  def mentionify(doc)
14
+ return unless doc.output.include?("@")
12
15
  src = mention_base(doc.site.config)
13
- doc.output = filter_with_mention(src).call(doc.output)[:output].to_s
16
+ if doc.output.include? BODY_START_TAG
17
+ parsed_doc = Nokogiri::HTML::Document.parse(doc.output)
18
+ body = parsed_doc.at_css('body')
19
+ body.children = filter_with_mention(src).call(body.inner_html)[:output].to_s
20
+ doc.output = parsed_doc.to_html
21
+ else
22
+ doc.output = filter_with_mention(src).call(doc.output)[:output].to_s
23
+ end
14
24
  end
15
25
 
16
26
  # Public: Create or fetch the filter for the given {{src}} base URL.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-mentions
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitHub, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-09 00:00:00.000000000 Z
11
+ date: 2016-03-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll