aspec_rb 0.0.11 → 0.0.12
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/aspec_rb/version.rb +1 -1
- data/lib/extensions/requirement_appendix.rb +2 -2
- data/lib/extensions/utils/block.rb +1 -1
- data/lib/extensions/utils/search.rb +13 -0
- data/lib/extensions/utils/utils.rb +1 -0
- data/lib/postprocessors/fulltext_search.rb +35 -16
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6243468a5b596117cdcada689105e7e49657f9dc2bdb25e75d7b25464e46b20e
|
4
|
+
data.tar.gz: f6f33c72752b20bd12b1f5beaeced038d32fa818320d48c2d30df8278758e63e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ba50b1e54f9e2a3df06abf095422c9e3d0c9636dcd173f5308736a629dd2280ab5087529c0eb6f4deeb57c40e9af5264604b271dd34601884f73441951609ce
|
7
|
+
data.tar.gz: 01b04622209bd03ce0ac6ab7a35c2f9939be5ea19fb9fc08600b10f0143650732795283da15182db821c157429881934b9847169e5745a2a2ad3fdc69a88f45f
|
data/Gemfile.lock
CHANGED
data/lib/aspec_rb/version.rb
CHANGED
@@ -89,7 +89,7 @@ reqs.each do |req, f, title, chapter, doctitle|
|
|
89
89
|
breadcrumb = "<a href=\"#{f}\">#{chapter} / #{doctitle}</a>"
|
90
90
|
# anchor = "<a class=\"link\" href=\"#Req-#{rid}\">#{rid}</a>"
|
91
91
|
row = %(<tr id="Req-#{rid}"> <th scope="row">#{i}</th> <td style="white-space:pre;">#{rid}</td>
|
92
|
-
<td>#{version}</td> <td>#{ref}</td> <td>#{f}</td> </tr>)
|
92
|
+
<td><span class="badge badge-primary badge-pill">#{version}</span></td> <td>#{ref}</td> <td>#{f}</td> </tr>)
|
93
93
|
|
94
94
|
rows.push(row)
|
95
95
|
end
|
@@ -99,7 +99,7 @@ Asciidoctor::Extensions.register do
|
|
99
99
|
process do |parent, _target, _attrs|
|
100
100
|
content = %(<h2 id="requirements"><a class="anchor" href="#requirements"></a>
|
101
101
|
<a class="link" href="#requirements">Requirements</a></h2>
|
102
|
-
<div class="panel panel-default"> <div class="panel-heading"><h4>Requirements</h4></div>
|
102
|
+
<div class="panel panel-default reqlist"> <div class="panel-heading"><h4>Requirements</h4></div>
|
103
103
|
<table class="table"> <thead> <tr>
|
104
104
|
<th>#</th> <th>ID</th><th>Version</th> <th>Title</th> <th>Source Document</th>
|
105
105
|
</tr> </thead>
|
@@ -24,7 +24,7 @@ module Context
|
|
24
24
|
if pattern == 'unknown'
|
25
25
|
"<div style=\"float:right;padding-left:0.1em;\"><span class=\"label label-#{label}\" data-toggle=\"tooltip\" title=\"Missing config\">#{target}</span></div>"
|
26
26
|
else
|
27
|
-
"<div style=\"float:right;padding-left:0.1em;\"><a href=\"#{url}\"><span class=\"label label-#{label}\">#{target}</span></a></div>"
|
27
|
+
"<div style=\"float:right;padding-left:0.1em;\"><a href=\"#{url}\"><span class=\"label label-#{label} task\">#{target}</span></a></div>"
|
28
28
|
end
|
29
29
|
else
|
30
30
|
if pattern == 'unknown'
|
@@ -3,38 +3,57 @@
|
|
3
3
|
require 'nokogiri'
|
4
4
|
require 'fileutils'
|
5
5
|
require 'open-uri'
|
6
|
+
require_relative '../extensions/utils/utils'
|
6
7
|
|
7
|
-
json = ''
|
8
|
+
@json = ''
|
8
9
|
gendir = 'generated-docs' # TODO: - do not hardcode
|
9
|
-
replacements = /"|\n|«|»
|\s
|
10
|
+
replacements = /"|\n|«|»
|\s+|\{|\}|…/
|
10
11
|
|
11
12
|
html_files = Dir.glob("#{gendir}/**/*.html")
|
12
13
|
|
13
14
|
html_files.each do |file|
|
14
|
-
# Skip the search results and index pages
|
15
15
|
next if file == "#{gendir}/search.html" || file[%r{^#{gendir}\/index}]
|
16
16
|
|
17
17
|
page = Nokogiri::HTML(open(file))
|
18
|
-
file.sub!(%r{^#{gendir}\/}, '')
|
18
|
+
url = file.sub!(%r{^#{gendir}\/}, '')
|
19
19
|
slug = file.sub(/\.html$/, '')
|
20
|
+
title = page.css('h2').text
|
20
21
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
22
|
+
page.xpath("//div[@class='sect1']").each do |section|
|
23
|
+
if section.at_css('div.sect2')
|
24
|
+
|
25
|
+
section.xpath("//div[@class='sect2']").each do |subsection|
|
26
|
+
if subsection.at_css('div.sect3')
|
27
|
+
title = subsection.at('h4').text
|
28
|
+
id = "\##{subsection.at('h4').attr('id')}"
|
29
|
+
sub_url = url + id
|
30
|
+
text = subsection.text.gsub(replacements, ' ')
|
31
|
+
@json += Search.add_to_index(sub_url, id, title, text)
|
32
|
+
else
|
33
|
+
|
34
|
+
title = subsection.at('h3').text
|
35
|
+
id = "\##{subsection.at('h3').attr('id')}"
|
36
|
+
sub_url = url + id
|
37
|
+
text = subsection.text.gsub(replacements, ' ')
|
38
|
+
@json += Search.add_to_index(sub_url, id, title, text)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
else
|
43
|
+
text = section.xpath("//div[@class='sect1']").css('p').text.gsub(replacements, ' ')
|
44
|
+
@json += Search.add_to_index(url, slug, title, text)
|
45
|
+
end
|
46
|
+
end
|
32
47
|
end
|
33
48
|
|
49
|
+
@json.gsub!(/\</, '<')
|
50
|
+
@json.gsub!(/\>/, '>')
|
51
|
+
|
52
|
+
puts @json
|
34
53
|
jsonindex = %(<script>
|
35
54
|
window.data = {
|
36
55
|
|
37
|
-
#{json}
|
56
|
+
#{@json}
|
38
57
|
|
39
58
|
};
|
40
59
|
</script>)
|
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.
|
4
|
+
version: 0.0.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- tcob
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-04-
|
11
|
+
date: 2018-04-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -108,6 +108,7 @@ files:
|
|
108
108
|
- lib/extensions/utils/index.rb
|
109
109
|
- lib/extensions/utils/labels.rb
|
110
110
|
- lib/extensions/utils/scanner.rb
|
111
|
+
- lib/extensions/utils/search.rb
|
111
112
|
- lib/extensions/utils/utils.rb
|
112
113
|
- lib/html_chunker.rb
|
113
114
|
- lib/postprocessors/fulltext_search.rb
|