just-the-docs 0.2.9 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/_includes/nav.html +55 -51
- data/_layouts/default.html +133 -103
- data/_sass/code.scss +2 -3
- data/_sass/color_schemes/dark.scss +1 -0
- data/_sass/content.scss +2 -2
- data/_sass/layout.scss +45 -50
- data/_sass/modules.scss +1 -0
- data/_sass/navigation.scss +129 -53
- data/_sass/print.scss +40 -0
- data/_sass/search.scss +202 -48
- data/_sass/support/_variables.scss +8 -3
- data/assets/js/just-the-docs.js +362 -204
- data/assets/js/zzzz-search-data.json +58 -0
- data/lib/tasks/search.rake +54 -9
- metadata +4 -9
- data/assets/js/search-data.json +0 -12
@@ -0,0 +1,58 @@
|
|
1
|
+
---
|
2
|
+
permalink: /assets/js/search-data.json
|
3
|
+
---
|
4
|
+
{
|
5
|
+
{%- assign i = 0 -%}
|
6
|
+
{% for page in site.html_pages %}
|
7
|
+
{%- if page.title and page.search_exclude != true -%}
|
8
|
+
{%- assign page_content = page.content -%}
|
9
|
+
{%- assign heading_level = site.search.heading_level | default: 2 -%}
|
10
|
+
{%- for j in (2..heading_level) -%}
|
11
|
+
{%- assign tag = '<h' | append: j -%}
|
12
|
+
{%- assign closing_tag = '</h' | append: j -%}
|
13
|
+
{%- assign page_content = page_content | replace: tag, '<h1' | replace: closing_tag, '</h1' -%}
|
14
|
+
{%- endfor -%}
|
15
|
+
{%- assign parts = page_content | split: '<h1' -%}
|
16
|
+
{%- assign title_found = false -%}
|
17
|
+
{% for part in parts offset: 1 %}
|
18
|
+
{%- assign titleAndContent = part | split: '</h1>' -%}
|
19
|
+
{%- assign title = titleAndContent[0] | replace_first: '>', '<h1>' | split: '<h1>' -%}
|
20
|
+
{%- assign title = title[1] | strip_html -%}
|
21
|
+
{%- assign content = titleAndContent[1] -%}
|
22
|
+
{%- assign url = page.url -%}
|
23
|
+
{%- if title == page.title and parts[0] == '' -%}
|
24
|
+
{%- assign title_found = true -%}
|
25
|
+
{%- else -%}
|
26
|
+
{%- assign id = titleAndContent[0] -%}
|
27
|
+
{%- assign id = id | split: 'id="' -%}
|
28
|
+
{%- if id.size == 2 -%}
|
29
|
+
{%- assign id = id[1] -%}
|
30
|
+
{%- assign id = id | split: '"' -%}
|
31
|
+
{%- assign id = id[0] -%}
|
32
|
+
{%- capture url -%}{{ url | append: '#' | append: id }}{%- endcapture -%}
|
33
|
+
{%- endif -%}
|
34
|
+
{%- endif -%}
|
35
|
+
{%- unless i == 0 -%},{%- endunless -%}
|
36
|
+
"{{ i }}": {
|
37
|
+
"doc": {{ page.title | jsonify }},
|
38
|
+
"title": {{ title | jsonify }},
|
39
|
+
"content": {{ content | replace: '</h', ' . </h' | replace: '<hr', ' . <hr' | replace: '</p', ' . </p' | replace: '<ul', ' . <ul' | replace: '</ul', ' . </ul' | replace: '<ol', ' . <ol' | replace: '</ol', ' . </ol' | replace: '</tr', ' . </tr' | replace: '<li', ' | <li' | replace: '</li', ' | </li' | replace: '</td', ' | </td' | replace: '<td', ' | <td' | replace: '</th', ' | </th' | replace: '<th', ' | <th' | strip_html | remove: 'Table of contents' | normalize_whitespace | replace: '. . .', '.' | replace: '. .', '.' | replace: '| |', '|' | append: ' ' | jsonify }},
|
40
|
+
"url": "{{ url | absolute_url }}",
|
41
|
+
"relUrl": "{{ url }}"
|
42
|
+
}
|
43
|
+
{%- assign i = i | plus: 1 -%}
|
44
|
+
{%- endfor -%}
|
45
|
+
{%- unless title_found -%}
|
46
|
+
{%- unless i == 0 -%},{%- endunless -%}
|
47
|
+
"{{ i }}": {
|
48
|
+
"doc": {{ page.title | jsonify }},
|
49
|
+
"title": {{ page.title | jsonify }},
|
50
|
+
"content": {{ parts[0] | replace: '</h', ' . </h' | replace: '<hr', ' . <hr' | replace: '</p', ' . </p' | replace: '<ul', ' . <ul' | replace: '</ul', ' . </ul' | replace: '<ol', ' . <ol' | replace: '</ol', ' . </ol' | replace: '</tr', ' . </tr' | replace: '<li', ' | <li' | replace: '</li', ' | </li' | replace: '</td', ' | </td' | replace: '<td', ' | <td' | replace: '</th', ' | </th' | replace: '<th', ' | <th' | strip_html | remove: 'Table of contents' | normalize_whitespace | replace: '. . .', '.' | replace: '. .', '.' | replace: '| |', '|' | append: ' ' | jsonify }},
|
51
|
+
"url": "{{ page.url | absolute_url }}",
|
52
|
+
"relUrl": "{{ page.url }}"
|
53
|
+
}
|
54
|
+
{%- assign i = i | plus: 1 -%}
|
55
|
+
{%- endunless -%}
|
56
|
+
{%- endif -%}
|
57
|
+
{% endfor %}
|
58
|
+
}
|
data/lib/tasks/search.rake
CHANGED
@@ -3,23 +3,68 @@ namespace :search do
|
|
3
3
|
task :init do
|
4
4
|
puts 'Creating search data json file...'
|
5
5
|
mkdir_p 'assets/js'
|
6
|
-
touch 'assets/js/search-data.json'
|
7
|
-
content = %Q[{{ page.content | markdownify | replace: '</h', ' . </h' | replace: '<hr', ' . <hr' | replace: '</p', ' . </p' | replace: '</ul', ' . </ul' | replace: '</tr', ' . </tr' | replace: '</li', ' | </li' | replace: '</td', ' | </td' | strip_html | escape_once | remove: 'Table of contents' | remove: '```' | remove: '---' | replace: '\\', ' ' | replace: ' . . . ', ' . ' | replace: ' . . ', ' . ' | normalize_whitespace }}]
|
6
|
+
touch 'assets/js/zzzz-search-data.json'
|
8
7
|
puts 'Done.'
|
9
8
|
puts 'Generating content...'
|
10
9
|
|
11
|
-
File.open('assets/js/search-data.json', 'w') do |f|
|
10
|
+
File.open('assets/js/zzzz-search-data.json', 'w') do |f|
|
12
11
|
f.puts '---
|
12
|
+
permalink: /assets/js/search-data.json
|
13
13
|
---
|
14
14
|
{
|
15
|
-
{
|
16
|
-
{% for page in site.html_pages %}
|
17
|
-
|
18
|
-
|
15
|
+
{%- assign i = 0 -%}
|
16
|
+
{% for page in site.html_pages %}
|
17
|
+
{%- if page.title and page.search_exclude != true -%}
|
18
|
+
{%- assign page_content = page.content -%}
|
19
|
+
{%- assign heading_level = site.search.heading_level | default: 2 -%}
|
20
|
+
{%- for j in (2..heading_level) -%}
|
21
|
+
{%- assign tag = \'<h\' | append: j -%}
|
22
|
+
{%- assign closing_tag = \'</h\' | append: j -%}
|
23
|
+
{%- assign page_content = page_content | replace: tag, \'<h1\' | replace: closing_tag, \'</h1\' -%}
|
24
|
+
{%- endfor -%}
|
25
|
+
{%- assign parts = page_content | split: \'<h1\' -%}
|
26
|
+
{%- assign title_found = false -%}
|
27
|
+
{% for part in parts offset: 1 %}
|
28
|
+
{%- assign titleAndContent = part | split: \'</h1>\' -%}
|
29
|
+
{%- assign title = titleAndContent[0] | replace_first: \'>\', \'<h1>\' | split: \'<h1>\' -%}
|
30
|
+
{%- assign title = title[1] | strip_html -%}
|
31
|
+
{%- assign content = titleAndContent[1] -%}
|
32
|
+
{%- assign url = page.url -%}
|
33
|
+
{%- if title == page.title and parts[0] == \'\' -%}
|
34
|
+
{%- assign title_found = true -%}
|
35
|
+
{%- else -%}
|
36
|
+
{%- assign id = titleAndContent[0] -%}
|
37
|
+
{%- assign id = id | split: \'id="\' -%}
|
38
|
+
{%- if id.size == 2 -%}
|
39
|
+
{%- assign id = id[1] -%}
|
40
|
+
{%- assign id = id | split: \'"\' -%}
|
41
|
+
{%- assign id = id[0] -%}
|
42
|
+
{%- capture url -%}{{ url | append: \'#\' | append: id }}{%- endcapture -%}
|
43
|
+
{%- endif -%}
|
44
|
+
{%- endif -%}
|
45
|
+
{%- unless i == 0 -%},{%- endunless -%}
|
46
|
+
"{{ i }}": {
|
47
|
+
"doc": {{ page.title | jsonify }},
|
48
|
+
"title": {{ title | jsonify }},
|
49
|
+
"content": {{ content | replace: \'</h\', \' . </h\' | replace: \'<hr\', \' . <hr\' | replace: \'</p\', \' . </p\' | replace: \'<ul\', \' . <ul\' | replace: \'</ul\', \' . </ul\' | replace: \'<ol\', \' . <ol\' | replace: \'</ol\', \' . </ol\' | replace: \'</tr\', \' . </tr\' | replace: \'<li\', \' | <li\' | replace: \'</li\', \' | </li\' | replace: \'</td\', \' | </td\' | replace: \'<td\', \' | <td\' | replace: \'</th\', \' | </th\' | replace: \'<th\', \' | <th\' | strip_html | remove: \'Table of contents\' | normalize_whitespace | replace: \'. . .\', \'.\' | replace: \'. .\', \'.\' | replace: \'| |\', \'|\' | append: \' \' | jsonify }},
|
50
|
+
"url": "{{ url | absolute_url }}",
|
51
|
+
"relUrl": "{{ url }}"
|
52
|
+
}
|
53
|
+
{%- assign i = i | plus: 1 -%}
|
54
|
+
{%- endfor -%}
|
55
|
+
{%- unless title_found -%}
|
56
|
+
{%- unless i == 0 -%},{%- endunless -%}
|
57
|
+
"{{ i }}": {
|
58
|
+
"doc": {{ page.title | jsonify }},
|
59
|
+
"title": {{ page.title | jsonify }},
|
60
|
+
"content": {{ parts[0] | replace: \'</h\', \' . </h\' | replace: \'<hr\', \' . <hr\' | replace: \'</p\', \' . </p\' | replace: \'<ul\', \' . <ul\' | replace: \'</ul\', \' . </ul\' | replace: \'<ol\', \' . <ol\' | replace: \'</ol\', \' . </ol\' | replace: \'</tr\', \' . </tr\' | replace: \'<li\', \' | <li\' | replace: \'</li\', \' | </li\' | replace: \'</td\', \' | </td\' | replace: \'<td\', \' | <td\' | replace: \'</th\', \' | </th\' | replace: \'<th\', \' | <th\' | strip_html | remove: \'Table of contents\' | normalize_whitespace | replace: \'. . .\', \'.\' | replace: \'. .\', \'.\' | replace: \'| |\', \'|\' | append: \' \' | jsonify }},
|
19
61
|
"url": "{{ page.url | absolute_url }}",
|
20
62
|
"relUrl": "{{ page.url }}"
|
21
|
-
}
|
22
|
-
|
63
|
+
}
|
64
|
+
{%- assign i = i | plus: 1 -%}
|
65
|
+
{%- endunless -%}
|
66
|
+
{%- endif -%}
|
67
|
+
{% endfor %}
|
23
68
|
}'
|
24
69
|
end
|
25
70
|
puts 'Done.'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: just-the-docs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Patrick Marsceill
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-06-
|
11
|
+
date: 2020-06-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -31,9 +31,6 @@ dependencies:
|
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 3.8.5
|
34
|
-
- - "<"
|
35
|
-
- !ruby/object:Gem::Version
|
36
|
-
version: 4.1.0
|
37
34
|
type: :runtime
|
38
35
|
prerelease: false
|
39
36
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -41,9 +38,6 @@ dependencies:
|
|
41
38
|
- - ">="
|
42
39
|
- !ruby/object:Gem::Version
|
43
40
|
version: 3.8.5
|
44
|
-
- - "<"
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version: 4.1.0
|
47
41
|
- !ruby/object:Gem::Dependency
|
48
42
|
name: jekyll-seo-tag
|
49
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -115,6 +109,7 @@ files:
|
|
115
109
|
- _sass/layout.scss
|
116
110
|
- _sass/modules.scss
|
117
111
|
- _sass/navigation.scss
|
112
|
+
- _sass/print.scss
|
118
113
|
- _sass/search.scss
|
119
114
|
- _sass/support/_functions.scss
|
120
115
|
- _sass/support/_variables.scss
|
@@ -140,8 +135,8 @@ files:
|
|
140
135
|
- assets/images/just-the-docs.png
|
141
136
|
- assets/images/search.svg
|
142
137
|
- assets/js/just-the-docs.js
|
143
|
-
- assets/js/search-data.json
|
144
138
|
- assets/js/vendor/lunr.min.js
|
139
|
+
- assets/js/zzzz-search-data.json
|
145
140
|
- bin/just-the-docs
|
146
141
|
- lib/tasks/search.rake
|
147
142
|
homepage: https://github.com/pmarsceill/just-the-docs
|
data/assets/js/search-data.json
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
---
|
2
|
-
---
|
3
|
-
{
|
4
|
-
{% assign comma = false %}
|
5
|
-
{% for page in site.html_pages %}{% if page.search_exclude != true %}{% if comma == true%},{% endif %}"{{ forloop.index0 }}": {
|
6
|
-
"title": "{{ page.title | replace: '&', '&' }}",
|
7
|
-
"content": "{{ page.content | markdownify | replace: '</h', ' . </h' | replace: '<hr', ' . <hr' | replace: '</p', ' . </p' | replace: '</ul', ' . </ul' | replace: '</tr', ' . </tr' | replace: '</li', ' | </li' | replace: '</td', ' | </td' | strip_html | escape_once | remove: 'Table of contents' | remove: '```' | remove: '---' | replace: '\', ' ' | replace: ' . . . ', ' . ' | replace: ' . . ', ' . ' | normalize_whitespace }}",
|
8
|
-
"url": "{{ page.url | absolute_url }}",
|
9
|
-
"relUrl": "{{ page.url }}"
|
10
|
-
}{% assign comma = true %}
|
11
|
-
{% endif %}{% endfor %}
|
12
|
-
}
|