jekyll_aspec 1.0.7 → 1.0.8

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
  SHA1:
3
- metadata.gz: 0afc1da878314d89be5c796fa7267d6c6b398db2
4
- data.tar.gz: 719b5c319e30eb964ed3ccba41ea12d66a29fa56
3
+ metadata.gz: 0e64513f8119c3b6a54b206808fe4061aed4a1e6
4
+ data.tar.gz: 3d574f4b337b6bd11189ff2aead1b3c7f5240181
5
5
  SHA512:
6
- metadata.gz: bf4f4e382abf729f92a5ec609e03edb1ecdff09205e495b1e758b829241004c085407ff3c5ca89c5dedd8223bee66de66a79a355116f21d55dcb22dbc40f0478
7
- data.tar.gz: dc00fb2199e5c32a2dd10feda3421d741a8bd7d57ca81699f3b7dcc77c396cd7104ab8604c7d63f718a44e2ca0d622afeee8047819b1588314543a977047d49c
6
+ metadata.gz: bf2f1b4017dfd7e558c087b24e39bd3dc1d64ff22e5b00107e2029e947aa4e3d734390255418d271aa39955d62ddf02902c7bb5a14829d4f9fb901f0c23f7dcd
7
+ data.tar.gz: 286f49684d8b767419a2b4333427b158f2294ea4291907de78e051a349ce18e022d062688269ee7541c11bb4df7e65ad2c1117c7d5cc2d26f104bc65a6e82a92
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- jekyll_aspec (1.0.7)
4
+ jekyll_aspec (1.0.8)
5
5
  asciidoctor (>= 1.5.0)
6
6
 
7
7
  GEM
@@ -5,13 +5,9 @@ include ::Asciidoctor
5
5
  # Find all Adoc Files
6
6
  adoc_files = Dir.glob('**/*.adoc')
7
7
  exts = "(\.adoc|\.md|\.html)"
8
- # make some empty vars globally available
9
- rpath = nil
10
- rtext = nil
11
- reqs = []
12
- inc_reqs = []
13
- incs = []
14
- xrefs = []
8
+
9
+ rpath, rtext = nil
10
+ reqs, inc_reqs, incs, xrefs = [], [], [], []
15
11
  xref_base = ''
16
12
 
17
13
  # Retrieve this via document attribute
@@ -23,12 +19,9 @@ def trim(s)
23
19
  end
24
20
 
25
21
  adoc_files.each do |file_name|
26
- lc = 0
27
22
  inc = false
28
23
 
29
24
  File.read(file_name).each_line do |li|
30
- lc += 1
31
-
32
25
  inc = true if li[/published: false/]
33
26
 
34
27
  # Match Requirement Blocks [req,ABC-123,version=n]
@@ -37,7 +30,7 @@ adoc_files.each do |file_name|
37
30
  rid = li.chop.match(/id\s*=\s*\w+-?([0-9]+)/i).captures[0]
38
31
  path = file_name.sub(/^#{docsdir}\//, '')
39
32
  path = path.sub!(/#{exts}/, '')
40
- item = [rid, li.chop, path, file_name, lc]
33
+ item = [rid, li.chop, path, file_name]
41
34
 
42
35
  if inc
43
36
  inc_reqs.push item
@@ -51,7 +44,7 @@ adoc_files.each do |file_name|
51
44
  xref = li.chop.match(/\<\<(\S.+?)(\,\S)?\>\>/i)
52
45
  path = file_name.sub(/^#{docsdir}\//, '')
53
46
  path = path.sub!(/#{exts}/, '')
54
- item = [xref, path, file_name, lc]
47
+ item = [xref, path, file_name]
55
48
  xrefs.push item
56
49
 
57
50
  # Collect all includes
@@ -61,7 +54,7 @@ adoc_files.each do |file_name|
61
54
  path = inc_file.sub(/^#{docsdir}\//, '')
62
55
  path = path.sub(/#{exts}/, '')
63
56
  parent = file_name
64
- item = [inc_file, path, parent, lc]
57
+ item = [inc_file, path, parent]
65
58
  incs.push item
66
59
 
67
60
  end
@@ -70,10 +63,10 @@ end
70
63
 
71
64
  # Sort included reqs and correct the path to the include parent
72
65
  inc_reqs.each do |rid, rli, rpath, _rfile, _rline|
73
- incs.each do |incfile, incpath, parent, lc|
66
+ incs.each do |incfile, incpath, parent|
74
67
  next unless rpath == incpath
75
68
  trim(parent)
76
- item = [rid, rli, parent, incfile, lc]
69
+ item = [rid, rli, parent, incfile]
77
70
  reqs.push item
78
71
  end
79
72
  end
@@ -81,16 +74,21 @@ end
81
74
  # Sort (in-place) by numberic ID
82
75
  reqs.sort_by!(&:first)
83
76
 
84
- # Preprocessor that strips the << tags - NOTE: may break conversion if line ends with >>
77
+ # Preprocessor that strips the << tags
85
78
  Extensions.register do
86
79
  preprocessor do
87
80
  process do |_document, reader|
88
81
  Reader.new reader.readlines.map { |li|
89
82
  if li[/\<\<Req-.+?\>\>/]
90
- openb = li.match(/(\<\<)Req-.+?\>\>/).captures[0]
91
- closeb = li.match(/\<\<Req-.+?(\>\>)/).captures[0]
92
- li.gsub!(/#{openb}/, ' ')
93
- li.gsub!(/#{closeb}/, ' ')
83
+ # Handle multiple reqs per line
84
+ spl = li.split(/ /)
85
+ spl.each {|x|
86
+ if x[/\<\<Req-.+?\>\>/]
87
+ x.gsub!(/<</, ' ')
88
+ x.gsub!(/>>/, ' ')
89
+ end
90
+ }
91
+ spl.join(' ')
94
92
  else
95
93
  li
96
94
  end
@@ -122,7 +120,7 @@ Extensions.register do
122
120
  xref_base = (parent.document.attr 'xref-base')
123
121
  uri = "#{xref_base}/#{rpath}/index.html##{link}"
124
122
  o = ' <span class="label label-info">'
125
- c = ' </span>'
123
+ c = ' </span> '
126
124
 
127
125
  (create_anchor parent, %(#{o} Req. #{rtext} #{c}), type: :link, target: uri).convert
128
126
  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.7'.freeze
5
+ VERSION = '1.0.8'.freeze
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll_aspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.7
4
+ version: 1.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - bsmith-n4