just-the-docs 0.2.7 → 0.3.2

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 (41) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +5 -1
  3. data/_includes/css/custom.scss.liquid +1 -0
  4. data/_includes/css/just-the-docs.scss.liquid +7 -0
  5. data/_includes/fix_linenos.html +65 -0
  6. data/_includes/head.html +7 -7
  7. data/_includes/nav.html +97 -37
  8. data/_includes/vendor/anchor_headings.html +53 -9
  9. data/_layouts/default.html +157 -75
  10. data/_layouts/table_wrappers.html +1 -1
  11. data/_sass/base.scss +14 -17
  12. data/_sass/code.scss +285 -74
  13. data/_sass/color_schemes/dark.scss +1 -1
  14. data/_sass/color_schemes/light.scss +0 -0
  15. data/_sass/content.scss +44 -5
  16. data/_sass/custom/custom.scss +0 -129
  17. data/_sass/labels.scss +5 -4
  18. data/_sass/layout.scss +48 -52
  19. data/_sass/modules.scss +20 -0
  20. data/_sass/navigation.scss +149 -50
  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 +33 -9
  25. data/_sass/support/mixins/_layout.scss +1 -3
  26. data/_sass/support/mixins/_typography.scss +25 -22
  27. data/_sass/typography.scss +13 -7
  28. data/_sass/utilities/_layout.scss +74 -17
  29. data/_sass/utilities/_spacing.scss +69 -25
  30. data/assets/css/just-the-docs-dark.scss +3 -0
  31. data/assets/css/just-the-docs-default.scss +8 -0
  32. data/assets/css/just-the-docs-light.scss +3 -0
  33. data/assets/js/just-the-docs.js +374 -202
  34. data/assets/js/zzzz-search-data.json +72 -0
  35. data/lib/tasks/search.rake +69 -10
  36. metadata +35 -24
  37. data/_sass/overrides.scss +0 -3
  38. data/assets/css/dark-mode-preview.scss +0 -45
  39. data/assets/css/just-the-docs.scss +0 -49
  40. data/assets/js/dark-mode-preview.js +0 -23
  41. data/assets/js/search-data.json +0 -12
@@ -0,0 +1,72 @@
1
+ ---
2
+ permalink: /assets/js/search-data.json
3
+ ---
4
+ {
5
+ {%- assign i = 0 -%}
6
+ {%- assign pages_array = '' | split: '' -%}
7
+ {%- assign pages_array = pages_array | push: site.html_pages -%}
8
+ {%- if site.just_the_docs.collections -%}
9
+ {%- for collection_entry in site.just_the_docs.collections -%}
10
+ {%- assign collection_key = collection_entry[0] -%}
11
+ {%- assign collection_value = collection_entry[1] -%}
12
+ {%- assign collection = site[collection_key] -%}
13
+ {%- if collection_value.search_exclude != true -%}
14
+ {%- assign pages_array = pages_array | push: collection -%}
15
+ {%- endif -%}
16
+ {%- endfor -%}
17
+ {%- endif -%}
18
+ {%- for pages in pages_array -%}
19
+ {%- for page in pages -%}
20
+ {%- if page.title and page.search_exclude != true -%}
21
+ {%- assign page_content = page.content -%}
22
+ {%- assign heading_level = site.search.heading_level | default: 2 -%}
23
+ {%- for j in (2..heading_level) -%}
24
+ {%- assign tag = '<h' | append: j -%}
25
+ {%- assign closing_tag = '</h' | append: j -%}
26
+ {%- assign page_content = page_content | replace: tag, '<h1' | replace: closing_tag, '</h1' -%}
27
+ {%- endfor -%}
28
+ {%- assign parts = page_content | split: '<h1' -%}
29
+ {%- assign title_found = false -%}
30
+ {%- for part in parts offset: 1 -%}
31
+ {%- assign titleAndContent = part | split: '</h1>' -%}
32
+ {%- assign title = titleAndContent[0] | replace_first: '>', '<h1>' | split: '<h1>' -%}
33
+ {%- assign title = title[1] | strip_html -%}
34
+ {%- assign content = titleAndContent[1] -%}
35
+ {%- assign url = page.url -%}
36
+ {%- if title == page.title and parts[0] == '' -%}
37
+ {%- assign title_found = true -%}
38
+ {%- else -%}
39
+ {%- assign id = titleAndContent[0] -%}
40
+ {%- assign id = id | split: 'id="' -%}
41
+ {%- if id.size == 2 -%}
42
+ {%- assign id = id[1] -%}
43
+ {%- assign id = id | split: '"' -%}
44
+ {%- assign id = id[0] -%}
45
+ {%- capture url -%}{{ url | append: '#' | append: id }}{%- endcapture -%}
46
+ {%- endif -%}
47
+ {%- endif -%}
48
+ {%- unless i == 0 -%},{%- endunless -%}
49
+ "{{ i }}": {
50
+ "doc": {{ page.title | jsonify }},
51
+ "title": {{ title | jsonify }},
52
+ "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 }},
53
+ "url": "{{ url | absolute_url }}",
54
+ "relUrl": "{{ url }}"
55
+ }
56
+ {%- assign i = i | plus: 1 -%}
57
+ {%- endfor -%}
58
+ {%- unless title_found -%}
59
+ {%- unless i == 0 -%},{%- endunless -%}
60
+ "{{ i }}": {
61
+ "doc": {{ page.title | jsonify }},
62
+ "title": {{ page.title | jsonify }},
63
+ "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 }},
64
+ "url": "{{ page.url | absolute_url }}",
65
+ "relUrl": "{{ page.url }}"
66
+ }
67
+ {%- assign i = i | plus: 1 -%}
68
+ {%- endunless -%}
69
+ {%- endif -%}
70
+ {%- endfor -%}
71
+ {%- endfor %}
72
+ }
@@ -3,23 +3,82 @@ 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
- {% assign comma = false %}
16
- {% for page in site.html_pages %}{% if page.search_exclude != true %}{% if comma == true%},{% endif %}"{{ forloop.index0 }}": {
17
- "title": "{{ page.title | replace: '&amp;', '&' }}",
18
- "content": "'+content+'",
19
- "url": "{{ page.url | absolute_url }}",
15
+ {%- assign i = 0 -%}
16
+ {%- assign pages_array = '' | split: '' -%}
17
+ {%- assign pages_array = pages_array | push: site.html_pages -%}
18
+ {%- if site.just_the_docs.collections -%}
19
+ {%- for collection_entry in site.just_the_docs.collections -%}
20
+ {%- assign collection_key = collection_entry[0] -%}
21
+ {%- assign collection_value = collection_entry[1] -%}
22
+ {%- assign collection = site[collection_key] -%}
23
+ {%- if collection_value.search_exclude != true -%}
24
+ {%- assign pages_array = pages_array | push: collection -%}
25
+ {%- endif -%}
26
+ {%- endfor -%}
27
+ {%- endif -%}
28
+ {%- for pages in pages_array -%}
29
+ {%- for page in pages -%}
30
+ {%- if page.title and page.search_exclude != true -%}
31
+ {%- assign page_content = page.content -%}
32
+ {%- assign heading_level = site.search.heading_level | default: 2 -%}
33
+ {%- for j in (2..heading_level) -%}
34
+ {%- assign tag = \'<h\' | append: j -%}
35
+ {%- assign closing_tag = \'</h\' | append: j -%}
36
+ {%- assign page_content = page_content | replace: tag, \'<h1\' | replace: closing_tag, \'</h1\' -%}
37
+ {%- endfor -%}
38
+ {%- assign parts = page_content | split: \'<h1\' -%}
39
+ {%- assign title_found = false -%}
40
+ {%- for part in parts offset: 1 -%}
41
+ {%- assign titleAndContent = part | split: \'</h1>\' -%}
42
+ {%- assign title = titleAndContent[0] | replace_first: \'>\', \'<h1>\' | split: \'<h1>\' -%}
43
+ {%- assign title = title[1] | strip_html -%}
44
+ {%- assign content = titleAndContent[1] -%}
45
+ {%- assign url = page.url -%}
46
+ {%- if title == page.title and parts[0] == \'\' -%}
47
+ {%- assign title_found = true -%}
48
+ {%- else -%}
49
+ {%- assign id = titleAndContent[0] -%}
50
+ {%- assign id = id | split: \'id="\' -%}
51
+ {%- if id.size == 2 -%}
52
+ {%- assign id = id[1] -%}
53
+ {%- assign id = id | split: \'"\' -%}
54
+ {%- assign id = id[0] -%}
55
+ {%- capture url -%}{{ url | append: \'#\' | append: id }}{%- endcapture -%}
56
+ {%- endif -%}
57
+ {%- endif -%}
58
+ {%- unless i == 0 -%},{%- endunless -%}
59
+ "{{ i }}": {
60
+ "doc": {{ page.title | jsonify }},
61
+ "title": {{ title | jsonify }},
62
+ "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 }},
63
+ "url": "{{ url | relative_url }}",
64
+ "relUrl": "{{ url }}"
65
+ }
66
+ {%- assign i = i | plus: 1 -%}
67
+ {%- endfor -%}
68
+ {%- unless title_found -%}
69
+ {%- unless i == 0 -%},{%- endunless -%}
70
+ "{{ i }}": {
71
+ "doc": {{ page.title | jsonify }},
72
+ "title": {{ page.title | jsonify }},
73
+ "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 }},
74
+ "url": "{{ page.url | relative_url }}",
20
75
  "relUrl": "{{ page.url }}"
21
- }{% assign comma = true %}
22
- {% endif %}{% endfor %}
76
+ }
77
+ {%- assign i = i | plus: 1 -%}
78
+ {%- endunless -%}
79
+ {%- endif -%}
80
+ {%- endfor -%}
81
+ {%- endfor %}
23
82
  }'
24
83
  end
25
84
  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.7
4
+ version: 0.3.2
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-09-10 00:00:00.000000000 Z
11
+ date: 2020-09-14 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,9 @@ 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
88
+ - _includes/fix_linenos.html
80
89
  - _includes/head.html
81
90
  - _includes/head_custom.html
82
91
  - _includes/js/custom.js
@@ -94,12 +103,14 @@ files:
94
103
  - _sass/buttons.scss
95
104
  - _sass/code.scss
96
105
  - _sass/color_schemes/dark.scss
106
+ - _sass/color_schemes/light.scss
97
107
  - _sass/content.scss
98
108
  - _sass/custom/custom.scss
99
109
  - _sass/labels.scss
100
110
  - _sass/layout.scss
111
+ - _sass/modules.scss
101
112
  - _sass/navigation.scss
102
- - _sass/overrides.scss
113
+ - _sass/print.scss
103
114
  - _sass/search.scss
104
115
  - _sass/support/_functions.scss
105
116
  - _sass/support/_variables.scss
@@ -119,14 +130,14 @@ files:
119
130
  - _sass/vendor/normalize.scss/README.md
120
131
  - _sass/vendor/normalize.scss/normalize.scss
121
132
  - _sass/vendor/normalize.scss/package.json
122
- - assets/css/dark-mode-preview.scss
123
- - assets/css/just-the-docs.scss
133
+ - assets/css/just-the-docs-dark.scss
134
+ - assets/css/just-the-docs-default.scss
135
+ - assets/css/just-the-docs-light.scss
124
136
  - assets/images/just-the-docs.png
125
137
  - assets/images/search.svg
126
- - assets/js/dark-mode-preview.js
127
138
  - assets/js/just-the-docs.js
128
- - assets/js/search-data.json
129
139
  - assets/js/vendor/lunr.min.js
140
+ - assets/js/zzzz-search-data.json
130
141
  - bin/just-the-docs
131
142
  - lib/tasks/search.rake
132
143
  homepage: https://github.com/pmarsceill/just-the-docs
@@ -1,3 +0,0 @@
1
- //
2
- // Custom overrides from a user.
3
- //
@@ -1,45 +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
- {% if site.logo %}
7
- $logo: "{{ site.logo | absolute_url }}";
8
- {% endif %}
9
-
10
- //
11
- // Import external dependencies
12
- //
13
-
14
- @import "./vendor/normalize.scss/normalize.scss";
15
-
16
- //
17
- // Import Just the Docs scss
18
- //
19
-
20
- // Support
21
- @import "./support/support";
22
-
23
- //
24
- // Import custom color scheme scss
25
- //
26
-
27
- @import "./color_schemes/dark.scss";
28
-
29
- // Modules
30
- @import "./base";
31
- @import "./layout";
32
- @import "./content";
33
- @import "./navigation";
34
- @import "./typography";
35
- @import "./labels";
36
- @import "./buttons";
37
- @import "./search";
38
- @import "./tables";
39
- @import "./code";
40
- @import "./utilities/utilities";
41
-
42
- //
43
- // Import custom overrides
44
- //
45
- @import "./custom/custom";
@@ -1,49 +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
- {% if site.logo %}
7
- $logo: "{{ site.logo | absolute_url }}";
8
- {% endif %}
9
-
10
- //
11
- // Import external dependencies
12
- //
13
-
14
- @import "./vendor/normalize.scss/normalize.scss";
15
-
16
- //
17
- // Import Just the Docs scss
18
- //
19
-
20
- // Support
21
- @import "./support/support";
22
-
23
- //
24
- // Import custom overrides
25
- //
26
-
27
- @import "./custom/custom";
28
-
29
- //
30
- // Import custom color scheme scss
31
- //
32
-
33
- {% if site.color_scheme == "dark" %}
34
- @import "./color_schemes/dark.scss";
35
- {% endif %}
36
-
37
- // Modules
38
- @import "./base";
39
- @import "./layout";
40
- @import "./content";
41
- @import "./navigation";
42
- @import "./typography";
43
- @import "./labels";
44
- @import "./buttons";
45
- @import "./search";
46
- @import "./tables";
47
- @import "./code";
48
- @import "./utilities/utilities";
49
- @import "./overrides";
@@ -1,23 +0,0 @@
1
- document.addEventListener("DOMContentLoaded", function(){
2
-
3
- const toggleDarkMode = document.querySelector('.js-toggle-dark-mode')
4
- const cssFile = document.querySelector('[rel="stylesheet"]')
5
- const originalCssRef = cssFile.getAttribute('href')
6
- const darkModeCssRef = originalCssRef.replace('just-the-docs.css', 'dark-mode-preview.css')
7
- const buttonCopy = ['Return to the light side', 'Preview dark color scheme']
8
- const updateButtonText = function(toggleDarkMode) {
9
- toggleDarkMode.textContent === buttonCopy[0] ?
10
- toggleDarkMode.textContent = buttonCopy[1] :
11
- toggleDarkMode.textContent = buttonCopy[0]
12
- }
13
-
14
- jtd.addEvent(toggleDarkMode, 'click', function(){
15
- if (cssFile.getAttribute('href') === originalCssRef) {
16
- cssFile.setAttribute('href', darkModeCssRef)
17
- updateButtonText(toggleDarkMode)
18
- } else {
19
- cssFile.setAttribute('href', originalCssRef)
20
- updateButtonText(toggleDarkMode)
21
- }
22
- })
23
- })
@@ -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: '&amp;', '&' }}",
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
- }