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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/extensions/req_refs.rb +19 -21
- data/lib/jekyll_aspec/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0e64513f8119c3b6a54b206808fe4061aed4a1e6
|
4
|
+
data.tar.gz: 3d574f4b337b6bd11189ff2aead1b3c7f5240181
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf2f1b4017dfd7e558c087b24e39bd3dc1d64ff22e5b00107e2029e947aa4e3d734390255418d271aa39955d62ddf02902c7bb5a14829d4f9fb901f0c23f7dcd
|
7
|
+
data.tar.gz: 286f49684d8b767419a2b4333427b158f2294ea4291907de78e051a349ce18e022d062688269ee7541c11bb4df7e65ad2c1117c7d5cc2d26f104bc65a6e82a92
|
data/Gemfile.lock
CHANGED
data/lib/extensions/req_refs.rb
CHANGED
@@ -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
|
-
|
9
|
-
rpath = nil
|
10
|
-
|
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
|
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
|
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
|
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
|
66
|
+
incs.each do |incfile, incpath, parent|
|
74
67
|
next unless rpath == incpath
|
75
68
|
trim(parent)
|
76
|
-
item = [rid, rli, parent, incfile
|
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
|
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
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
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
|
data/lib/jekyll_aspec/version.rb
CHANGED