just-the-docs 0.2.6 → 0.3.1

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.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/_includes/css/custom.scss.liquid +1 -0
  4. data/_includes/css/just-the-docs.scss.liquid +7 -0
  5. data/_includes/head.html +4 -4
  6. data/_includes/nav.html +55 -40
  7. data/_includes/title.html +5 -1
  8. data/_includes/vendor/anchor_headings.html +2 -2
  9. data/_layouts/default.html +146 -73
  10. data/_layouts/table_wrappers.html +1 -1
  11. data/_sass/base.scss +16 -18
  12. data/_sass/code.scss +209 -71
  13. data/_sass/color_schemes/dark.scss +1 -1
  14. data/_sass/color_schemes/light.scss +0 -0
  15. data/_sass/content.scss +53 -5
  16. data/_sass/custom/custom.scss +0 -129
  17. data/_sass/labels.scss +5 -4
  18. data/_sass/layout.scss +67 -55
  19. data/_sass/modules.scss +20 -0
  20. data/_sass/navigation.scss +129 -53
  21. data/_sass/print.scss +40 -0
  22. data/_sass/search.scss +204 -48
  23. data/_sass/support/_functions.scss +2 -3
  24. data/_sass/support/_variables.scss +15 -9
  25. data/_sass/support/mixins/_layout.scss +1 -3
  26. data/_sass/support/mixins/_typography.scss +6 -1
  27. data/_sass/typography.scss +9 -7
  28. data/_sass/utilities/_layout.scss +74 -17
  29. data/_sass/utilities/_lists.scss +7 -1
  30. data/_sass/utilities/_spacing.scss +69 -25
  31. data/assets/css/just-the-docs-dark.scss +3 -0
  32. data/assets/css/just-the-docs-default.scss +8 -0
  33. data/assets/css/just-the-docs-light.scss +3 -0
  34. data/assets/js/just-the-docs.js +374 -197
  35. data/assets/js/zzzz-search-data.json +58 -0
  36. data/lib/tasks/search.rake +54 -9
  37. metadata +36 -24
  38. data/assets/css/dark-mode-preview.scss +0 -41
  39. data/assets/css/just-the-docs.scss +0 -44
  40. data/assets/js/search-data.json +0 -11
@@ -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
+ }
@@ -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 | strip_html | escape_once | remove: 'Table of contents' | remove: '```' | remove: '---' | 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
- {% for page in site.html_pages %}{% if page.search_exclude != true %}"{{ forloop.index0 }}": {
16
- "id": "{{ forloop.index0 }}",
17
- "title": "{{ page.title | replace: \'&amp;\', \'&\' }}",
18
- "content": "'+content+'",
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
- }{% unless forloop.last %},{% endunless %}
22
- {% endif %}{% endfor %}
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,27 +1,41 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: just-the-docs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrick Marsceill
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-14 00:00:00.000000000 Z
11
+ date: 2020-07-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: jekyll
14
+ name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 2.1.4
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 2.1.4
27
+ - !ruby/object:Gem::Dependency
28
+ name: jekyll
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
18
32
  - !ruby/object:Gem::Version
19
33
  version: 3.8.5
20
34
  type: :runtime
21
35
  prerelease: false
22
36
  version_requirements: !ruby/object:Gem::Requirement
23
37
  requirements:
24
- - - "~>"
38
+ - - ">="
25
39
  - !ruby/object:Gem::Version
26
40
  version: 3.8.5
27
41
  - !ruby/object:Gem::Dependency
@@ -42,30 +56,22 @@ dependencies:
42
56
  name: rake
43
57
  requirement: !ruby/object:Gem::Requirement
44
58
  requirements:
45
- - - "~>"
59
+ - - ">="
46
60
  - !ruby/object:Gem::Version
47
61
  version: 12.3.1
62
+ - - "<"
63
+ - !ruby/object:Gem::Version
64
+ version: 13.1.0
48
65
  type: :runtime
49
66
  prerelease: false
50
67
  version_requirements: !ruby/object:Gem::Requirement
51
68
  requirements:
52
- - - "~>"
69
+ - - ">="
53
70
  - !ruby/object:Gem::Version
54
71
  version: 12.3.1
55
- - !ruby/object:Gem::Dependency
56
- name: bundler
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: 2.0.1
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
72
+ - - "<"
67
73
  - !ruby/object:Gem::Version
68
- version: 2.0.1
74
+ version: 13.1.0
69
75
  description:
70
76
  email:
71
77
  - patrick.marsceill@gmail.com
@@ -77,6 +83,8 @@ files:
77
83
  - LICENSE.txt
78
84
  - README.md
79
85
  - Rakefile
86
+ - _includes/css/custom.scss.liquid
87
+ - _includes/css/just-the-docs.scss.liquid
80
88
  - _includes/head.html
81
89
  - _includes/head_custom.html
82
90
  - _includes/js/custom.js
@@ -94,11 +102,14 @@ files:
94
102
  - _sass/buttons.scss
95
103
  - _sass/code.scss
96
104
  - _sass/color_schemes/dark.scss
105
+ - _sass/color_schemes/light.scss
97
106
  - _sass/content.scss
98
107
  - _sass/custom/custom.scss
99
108
  - _sass/labels.scss
100
109
  - _sass/layout.scss
110
+ - _sass/modules.scss
101
111
  - _sass/navigation.scss
112
+ - _sass/print.scss
102
113
  - _sass/search.scss
103
114
  - _sass/support/_functions.scss
104
115
  - _sass/support/_variables.scss
@@ -118,13 +129,14 @@ files:
118
129
  - _sass/vendor/normalize.scss/README.md
119
130
  - _sass/vendor/normalize.scss/normalize.scss
120
131
  - _sass/vendor/normalize.scss/package.json
121
- - assets/css/dark-mode-preview.scss
122
- - assets/css/just-the-docs.scss
132
+ - assets/css/just-the-docs-dark.scss
133
+ - assets/css/just-the-docs-default.scss
134
+ - assets/css/just-the-docs-light.scss
123
135
  - assets/images/just-the-docs.png
124
136
  - assets/images/search.svg
125
137
  - assets/js/just-the-docs.js
126
- - assets/js/search-data.json
127
138
  - assets/js/vendor/lunr.min.js
139
+ - assets/js/zzzz-search-data.json
128
140
  - bin/just-the-docs
129
141
  - lib/tasks/search.rake
130
142
  homepage: https://github.com/pmarsceill/just-the-docs
@@ -149,6 +161,6 @@ requirements: []
149
161
  rubygems_version: 3.0.3
150
162
  signing_key:
151
163
  specification_version: 4
152
- summary: A modern, high customizable, responsive Jekyll theme for documention with
153
- built-in search.
164
+ summary: A modern, highly customizable, and responsive Jekyll theme for documention
165
+ with built-in search.
154
166
  test_files: []
@@ -1,41 +0,0 @@
1
- ---
2
- # this ensures Jekyll reads the file to be transformed into CSS later
3
- # only Main files contain this front matter, not partials.
4
- ---
5
-
6
- //
7
- // Import external dependencies
8
- //
9
-
10
- @import "./vendor/normalize.scss/normalize.scss";
11
-
12
- //
13
- // Import Just the Docs scss
14
- //
15
-
16
- // Support
17
- @import "./support/support";
18
-
19
- //
20
- // Import custom color scheme scss
21
- //
22
-
23
- @import "./color_schemes/dark.scss";
24
-
25
- // Modules
26
- @import "./base";
27
- @import "./layout";
28
- @import "./content";
29
- @import "./navigation";
30
- @import "./typography";
31
- @import "./labels";
32
- @import "./buttons";
33
- @import "./search";
34
- @import "./tables";
35
- @import "./code";
36
- @import "./utilities/utilities";
37
-
38
- //
39
- // Import custom overrides
40
- //
41
- @import "./custom/custom";
@@ -1,44 +0,0 @@
1
- ---
2
- # this ensures Jekyll reads the file to be transformed into CSS later
3
- # only Main files contain this front matter, not partials.
4
- ---
5
-
6
- //
7
- // Import external dependencies
8
- //
9
-
10
- @import "./vendor/normalize.scss/normalize.scss";
11
-
12
- //
13
- // Import Just the Docs scss
14
- //
15
-
16
- // Support
17
- @import "./support/support";
18
-
19
- //
20
- // Import custom overrides
21
- //
22
-
23
- @import "./custom/custom";
24
-
25
- //
26
- // Import custom color scheme scss
27
- //
28
-
29
- {% if site.color_scheme == "dark" %}
30
- @import "./color_schemes/dark.scss";
31
- {% endif %}
32
-
33
- // Modules
34
- @import "./base";
35
- @import "./layout";
36
- @import "./content";
37
- @import "./navigation";
38
- @import "./typography";
39
- @import "./labels";
40
- @import "./buttons";
41
- @import "./search";
42
- @import "./tables";
43
- @import "./code";
44
- @import "./utilities/utilities";
@@ -1,11 +0,0 @@
1
- ---
2
- ---
3
- {
4
- {% for page in site.html_pages %}{% if page.search_exclude != true %}"{{ forloop.index0 }}": {
5
- "title": "{{ page.title | replace: '&amp;', '&' }}",
6
- "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 }}",
7
- "url": "{{ page.url | absolute_url }}",
8
- "relUrl": "{{ page.url }}"
9
- }{% unless forloop.last %},{% endunless %}
10
- {% endif %}{% endfor %}
11
- }