jekyll_aspec 1.0.5 → 1.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ee4c7c851c368babd8041e9abf52173d54436ede
4
- data.tar.gz: 0efa7e337687113a78915cb83c1071f56389efab
3
+ metadata.gz: 74bc1e1a248d3671df75c73837618c84f6af4343
4
+ data.tar.gz: 6c0e8b24415954e6b8d1fba0d3790649b7f2b67b
5
5
  SHA512:
6
- metadata.gz: 1ad52cbe7be607276deb122f9ca244e0a2a91252fe579f82c238635dcda8eff64bd9ab9c7b4d4464745ba97e27952ee1610c9bac47925f3fa78fc8f0aff9bbb0
7
- data.tar.gz: ad989f42bd716aef0920c7099cd8a5432dedcac0f587fe4c63dac1ca5d84899fbd7fbf9b8153c92e2b80a189ef8742f7a4c0b6bf02fd7d670b5f94fa22fe7afe
6
+ metadata.gz: 34690448559fd2b64a3e8cc7038345673b6a0b51c8b02a0332f49adceaa8557f5d980b1064c2f13060c39098f19ea5ff11553f1c4f976c2e3f50d08b2630a80e
7
+ data.tar.gz: 7d004d0a4c9ba6042657f111c75944171855aca0486fb8b449b6a08b9035dba5514698d95eb06761077be19bec879b5f63eb688666542029baa4cc4101c5be30
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- jekyll_aspec (1.0.5)
4
+ jekyll_aspec (1.0.6)
5
5
  asciidoctor (>= 1.5.0)
6
6
 
7
7
  GEM
@@ -0,0 +1,49 @@
1
+ require 'asciidoctor/extensions' unless RUBY_ENGINE == 'opal'
2
+
3
+ include ::Asciidoctor
4
+
5
+ Extensions.register do
6
+ block do
7
+ named :def
8
+ on_contexts :open, :paragraph, :example, :listing, :sidebar, :pass
9
+
10
+ process do |parent, reader, attrs|
11
+ # Add pass characters here to prevent html character replacements for < > tags
12
+ pass = '+++'
13
+ attrs['name'] = 'definition'
14
+ attrs['caption'] = 'Definition: '
15
+ nl = ''
16
+
17
+ begin
18
+ # downcase the title and replace spaces with underscores.
19
+ # Also replacing special HTML entities:
20
+ # &quot; = "
21
+ # &amp; = &
22
+ downcased_title = attrs['title'].downcase.tr(' ', '_').gsub('"', '&quot;')
23
+ san_title = attrs['title'].gsub(/&/, '&amp;').gsub(/\`/, '').gsub(/\'/, '').gsub(/\*/, '')
24
+ rescue Exception => msg
25
+ puts msg
26
+ # If no title exists on the Def block, throw an exception
27
+ puts '[ERROR] Definition block title missing'
28
+ end
29
+
30
+ alt = %(
31
+ <div class=\"panel panel-primary\">
32
+ <div class=\"panel-heading\">
33
+ <h3 class=\"panel-title\">
34
+ <a class=\"anchor\" href=\"##{san_title}\"></a>
35
+ <a class=\"link\" href=\"##{san_title}\"><emphasis role=\"strong\">Definition: </emphasis> #{san_title} </a>
36
+ </h3>
37
+ </div>
38
+ <div class=\"panel-body\">)
39
+
40
+ close = '</div></div>'
41
+
42
+ # concatenate all generated lines and prepend before the original content
43
+ concat_lines = reader.lines.unshift(pass, alt, pass, nl)
44
+ concat_lines.push(nl, pass, close, pass)
45
+
46
+ create_block parent, :open, concat_lines, attrs, content_model: :compound
47
+ end
48
+ end
49
+ end
@@ -45,7 +45,7 @@ Extensions.register do
45
45
  concat_lines = reader.lines.unshift(pass, alt, pass, nl)
46
46
  concat_lines.push(nl, pass, close, pass)
47
47
 
48
- create_block parent, :admonition, concat_lines, attrs, content_model: :compound
48
+ create_block parent, :open, concat_lines, attrs, content_model: :compound
49
49
  end
50
50
  end
51
51
  end
@@ -2,5 +2,5 @@
2
2
  module JekyllAspec
3
3
  # After updating the version, publishing can be done by running
4
4
  # rake release in the project root
5
- VERSION = '1.0.5'.freeze
5
+ VERSION = '1.0.6'.freeze
6
6
  end
data/lib/jekyll_aspec.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require_relative 'extensions/html_postprocessor'
2
2
  require_relative 'extensions/autoxrefs'
3
+ require_relative 'extensions/definition_block'
3
4
  require_relative 'extensions/inline_callout_macro'
4
5
  require_relative 'extensions/inline_cwiki_macro'
5
6
  require_relative 'extensions/inline_repo_macro'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll_aspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - bsmith-n4
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-10-06 00:00:00.000000000 Z
11
+ date: 2017-10-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -89,6 +89,7 @@ files:
89
89
  - bin/setup
90
90
  - jekyll_aspec.gemspec
91
91
  - lib/extensions/autoxrefs.rb
92
+ - lib/extensions/definition_block.rb
92
93
  - lib/extensions/html_postprocessor.rb
93
94
  - lib/extensions/inline_callout_macro.rb
94
95
  - lib/extensions/inline_cwiki_macro.rb