jekyll-gfm-admonitions 0.1.0 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/jekyll-gfm-admonitions.rb +12 -1
  3. metadata +29 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 73f62b9375b8f6b7d657aba5597cab2d612a70350d044af9807bbee619774aa1
4
- data.tar.gz: 06e4c485c9d50d38fdb22e9ac7228ea431f8f55e41c808af6a73837cf34037fa
3
+ metadata.gz: 219a16407153ff4afd7586cd7f06bd865db5eacbb11c2ccd42f4567777b8813c
4
+ data.tar.gz: 9e72824ed765b818af835f074be64ba7786a2248d4df9b6f433c2c9aee949cf6
5
5
  SHA512:
6
- metadata.gz: 299f06fe2684ed5b9f792decd2c1d666af9f17906f4c65413de499f526f5636eb834101ef95be18a93d9ec28e79cea4b0d49eafc8001792b1a0c8859b7f9be01
7
- data.tar.gz: 11e51faa997ee7d745814a2d8761a36020273c559c5b492dbbcab07e4379e4d0d8469dd8b56e5429522258084b533e0bdcbb6581f26a4348933b07eea93e79e5
6
+ metadata.gz: d8c5bb02c6c4c8724233f44eaf8dc8ca6a1e20b402e68a7bf2433ca9bb74e429d6ca3d5df868c4769201e693fcb5261d01a5ae6bc9ec420f56b53e1a1a39b76d
7
+ data.tar.gz: a17141f9008abb7a5aa289201677e99168f1932486c87d6e76d474920d82f5a79d950959a657a114665cff2645c0e306315f8e35902d08b9c284e8244cfbb46c
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'octicons'
4
4
  require 'cssminify'
5
+ require 'liquid/template'
5
6
 
6
7
  ADMONITION_ICONS = {
7
8
  'important' => 'report',
@@ -29,13 +30,21 @@ module JekyllGFMAdmonitions
29
30
  end
30
31
 
31
32
  def generate(site)
33
+ @markdown = site.converters.find { |c| c.is_a?(Jekyll::Converters::Markdown) }
34
+ unless @markdown
35
+ raise "Markdown converter not found. Please ensure that you have a markdown converter configured in your Jekyll site."
36
+ end
37
+
32
38
  # Process admonitions in posts
33
39
  site.posts.docs.each do |doc|
40
+ Jekyll.logger.debug 'GFMA:', "Processing post '#{doc.path}' (#{doc.content.length} characters)."
34
41
  process(doc)
35
42
  end
36
43
 
37
44
  # Process admonitions in pages
38
45
  site.pages.each do |page|
46
+ Jekyll.logger.debug 'GFMA:', "Processing page '#{page.path}' (#{page.content.length} characters)."
47
+ Jekyll.logger.debug 'GFMA:', "#{page.content.inspect}"
39
48
  process(page)
40
49
  end
41
50
 
@@ -58,15 +67,17 @@ module JekyllGFMAdmonitions
58
67
  title = type.capitalize
59
68
  text = ::Regexp.last_match(2).gsub(/^>\s*/, '').strip
60
69
  icon = Octicons::Octicon.new(ADMONITION_ICONS[type]).to_svg
70
+ Jekyll.logger.debug 'GFMA:', "Converting #{type} admonition."
61
71
 
62
72
  "<div class='markdown-alert markdown-alert-#{type}'>
63
73
  <p class='markdown-alert-title'>#{icon} #{title}</p>
64
- <p>#{text}</p>
74
+ <p>#{@markdown.convert(text)}</p>
65
75
  </div>"
66
76
  end
67
77
  end
68
78
 
69
79
  def inject_css(doc)
80
+ Jekyll.logger.debug 'GFMA:', "Appending admonition style to '#{doc.path}'."
70
81
  css = File.read(File.expand_path('../assets/admonitions.css', __dir__))
71
82
  doc.content += "<style>#{CSSminify.compress(css)}</style>"
72
83
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-gfm-admonitions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robin De Schepper
@@ -24,6 +24,34 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '3.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: cssminify
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: octicons
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '19.11'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '19.11'
27
55
  - !ruby/object:Gem::Dependency
28
56
  name: bundler
29
57
  requirement: !ruby/object:Gem::Requirement