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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/extensions/definition_block.rb +49 -0
- data/lib/extensions/requirement_block.rb +1 -1
- data/lib/jekyll_aspec/version.rb +1 -1
- data/lib/jekyll_aspec.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 74bc1e1a248d3671df75c73837618c84f6af4343
|
4
|
+
data.tar.gz: 6c0e8b24415954e6b8d1fba0d3790649b7f2b67b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 34690448559fd2b64a3e8cc7038345673b6a0b51c8b02a0332f49adceaa8557f5d980b1064c2f13060c39098f19ea5ff11553f1c4f976c2e3f50d08b2630a80e
|
7
|
+
data.tar.gz: 7d004d0a4c9ba6042657f111c75944171855aca0486fb8b449b6a08b9035dba5514698d95eb06761077be19bec879b5f63eb688666542029baa4cc4101c5be30
|
data/Gemfile.lock
CHANGED
@@ -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
|
+
# " = "
|
21
|
+
# & = &
|
22
|
+
downcased_title = attrs['title'].downcase.tr(' ', '_').gsub('"', '"')
|
23
|
+
san_title = attrs['title'].gsub(/&/, '&').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, :
|
48
|
+
create_block parent, :open, concat_lines, attrs, content_model: :compound
|
49
49
|
end
|
50
50
|
end
|
51
51
|
end
|
data/lib/jekyll_aspec/version.rb
CHANGED
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.
|
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-
|
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
|