jekyll-gfm-admonitions 0.1.1 → 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 +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9856856fa9908d633101b625732baafbb7f3c0cf73cfcbef406dc7b8632e9789
4
- data.tar.gz: 20e2d07f90fbcfb6d497fbb4b4253b1a8cc42822a9ae37a382cd9a32dab7e002
3
+ metadata.gz: 219a16407153ff4afd7586cd7f06bd865db5eacbb11c2ccd42f4567777b8813c
4
+ data.tar.gz: 9e72824ed765b818af835f074be64ba7786a2248d4df9b6f433c2c9aee949cf6
5
5
  SHA512:
6
- metadata.gz: cb773040f974fe2e1e6da8ef9b2964b621c1641fbbfc5b4ec4c744cf422d13734829784f798eec6e4549a3fa0b0e302ebb493c3412c2812094cd6b159f4ec908
7
- data.tar.gz: ae50729c18a1c4084d0e333282b8c7a47025edde3dd7bef466c73378e07b63d82c9fe26ae8e891fdc536b4c05ecca305f1003e0b2f827d9b81bdc279eaae2dac
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.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robin De Schepper