aspec_rb 0.0.13 → 0.0.14

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d2a1b3abea25b1809963996414935a74ba305e1a39b6ceabf4d9d1d766221501
4
- data.tar.gz: b6cf95dd90879fc7c6c634c7f2af4a44239d9f682d3958770644324dfb92871c
3
+ metadata.gz: 6f014b57aa727ad15d411f27453bf4533243be7751b07e9159da96680490738f
4
+ data.tar.gz: 3e2cb40c81dd7cc8c7b4d6c28338e48e9925f6f952411f2f48bcac69939cefc8
5
5
  SHA512:
6
- metadata.gz: 25a21dc3e280b85c37b50aa2dea3d5da6d97f6ac5b5a25ebb545a739455f7c53e83e50c9b9af0740039f567c3915bdf225067bb7182393afb97629409af670c0
7
- data.tar.gz: 952538cec2c9062ad300b65b3a1536ceb81b0254f53336a3d5840cdbb6212e9330434ffeec79c72c7b946a66437ba6abeb350272aaef0408abdb310a9f46bc89
6
+ metadata.gz: 3fff756036c5604ee7a5008ba1c451eb670e50cd09e5314ffa7eb42b82dc71bf8f3a3506680d520d70cf3472c98fb4211e29d471671fb927d753c73aa0b69081
7
+ data.tar.gz: 875e7b32dd7634e703330a42a2ca184f0d064f82c2d4bdbad309c0a3064cb403928a331a2b954b13c2aaae84422ce318fc1e59f527d46fa6bd3a528ec99e3e11
data/Gemfile.lock CHANGED
@@ -1,13 +1,13 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- aspec_rb (0.0.13)
4
+ aspec_rb (0.0.14)
5
5
  asciidoctor
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- asciidoctor (1.5.6.2)
10
+ asciidoctor (1.5.7.1)
11
11
  docile (1.3.0)
12
12
  json (2.1.0)
13
13
  power_assert (1.1.1)
@@ -17,7 +17,7 @@ GEM
17
17
  json (>= 1.8, < 3)
18
18
  simplecov-html (~> 0.10.0)
19
19
  simplecov-html (0.10.2)
20
- test-unit (3.2.7)
20
+ test-unit (3.2.8)
21
21
  power_assert
22
22
 
23
23
  PLATFORMS
data/lib/aspec_rb.rb CHANGED
@@ -7,6 +7,7 @@ require_relative 'extensions/inline_callout_macro'
7
7
  require_relative 'extensions/inline_cwiki_macro'
8
8
  require_relative 'extensions/inline_repo_macro'
9
9
  require_relative 'extensions/inline_task_macro'
10
+ require_relative 'extensions/inline_version_macro'
10
11
  require_relative 'extensions/req_refs'
11
12
  require_relative 'extensions/requirement_block'
12
13
  require_relative 'extensions/source_block'
@@ -7,5 +7,5 @@ module AspecRb
7
7
  # For this deploy config, see https://github.com/tcob/aspec_rb/blob/master/.travis.yml
8
8
  #
9
9
  # Manual release can be performed by running 'bundle install && rake release'
10
- VERSION = '0.0.13'
10
+ VERSION = '0.0.14'
11
11
  end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'asciidoctor/extensions'
4
+ require_relative 'utils/labels'
5
+ require_relative 'utils/block'
6
+
7
+ include ::Asciidoctor
8
+
9
+ Extensions.register do
10
+ inline_macro do
11
+ named :version
12
+
13
+ process do |parent, target, attrs|
14
+ attrs[:version] = true
15
+ label = Labels.getstatus(attrs)
16
+ html = Context.format(attrs, target, target, label)
17
+ (create_pass_block parent, html, attrs).render
18
+ end
19
+ end
20
+ end
@@ -10,22 +10,23 @@ module Context
10
10
  # @param label [String] an optional status label, used to display if a task/issue is open or closed
11
11
  # @return [String] the raw HTML to be included in the target document
12
12
  def self.format(attributes, target, pattern, label)
13
- block = false
14
- block = true if attributes.key? 'block'
13
+ block = false unless attributes.key? 'block'
15
14
 
16
15
  if target[0] == "\:"
17
16
  block = true
18
17
  target[0] = ''
19
18
  end
20
-
19
+
21
20
  url = "#{pattern}/#{target}"
22
-
23
21
  html = if block
24
22
  if pattern == 'unknown'
25
23
  "<div style=\"float:right;padding-left:0.1em;\"><span class=\"label label-#{label}\" data-toggle=\"tooltip\" title=\"Missing config\">#{target}</span></div>"
26
24
  else
27
25
  "<div style=\"float:right;padding-left:0.1em;\"><a href=\"#{url}\"><span class=\"label label-#{label} task\">#{target}</span></a></div>"
28
26
  end
27
+ elsif attributes[:version]
28
+ url = "search.html?q=Version+#{target}"
29
+ "<div style=\"float:right;padding-left:0.1em;\"><a href=\"#{url}\" class=\"btn btn-primary btn-sm active\" role=\"button\" aria-pressed=\"true\">Version <span class=\"badge\">#{target}</span></a></div>"
29
30
  else
30
31
  if pattern == 'unknown'
31
32
  "<span class=\"label label-#{label}\" data-toggle=\"tooltip\" title=\"Missing config\">#{target}</span>"
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Search
4
4
  # Some special handling for sanitizing the search json
5
- def self.sanitize_json(str)
5
+ def self.sanitize_json(str)
6
6
  special_chars = /"|\n|«|»
|\{|\}|…/
7
7
  str.gsub!(special_chars, ' ')
8
8
  str.gsub!(/\s+/, ' ')
@@ -27,10 +27,10 @@ html_files.each do |file|
27
27
  page.xpath("//div[@class='sect1']").each do |section|
28
28
  if section.at_css('div.sect2')
29
29
 
30
- section.xpath("//div[@class='sect2' or @class='sect2 language-n4js']").each do |subsection|
30
+ section.xpath("//div[@class='sect2' or @class='sect2 language-n4js']").each do |subsection|
31
31
  if subsection.at_css('div.sect3')
32
32
 
33
- section.xpath("//div[@class='sect3']").each do |subsection|
33
+ section.xpath("//div[@class='sect3']").each do |subsection|
34
34
  if subsection.at_css('div.sect4')
35
35
  add_heading(subsection, url, 'h5')
36
36
  else
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aspec_rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.13
4
+ version: 0.0.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - tcob
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-05-02 00:00:00.000000000 Z
11
+ date: 2018-05-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -98,6 +98,7 @@ files:
98
98
  - lib/extensions/inline_cwiki_macro.rb
99
99
  - lib/extensions/inline_repo_macro.rb
100
100
  - lib/extensions/inline_task_macro.rb
101
+ - lib/extensions/inline_version_macro.rb
101
102
  - lib/extensions/postprocessor.rb
102
103
  - lib/extensions/req_refs.rb
103
104
  - lib/extensions/requirement_appendix.rb