just-the-docs-altair 0.2.3

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 (49) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/README.md +68 -0
  4. data/Rakefile +1 -0
  5. data/_includes/head.html +26 -0
  6. data/_includes/nav.html +44 -0
  7. data/_layouts/about.html +5 -0
  8. data/_layouts/default.html +78 -0
  9. data/_layouts/home.html +5 -0
  10. data/_layouts/page.html +5 -0
  11. data/_layouts/post.html +5 -0
  12. data/_sass/base.scss +110 -0
  13. data/_sass/buttons.scss +118 -0
  14. data/_sass/code.scss +122 -0
  15. data/_sass/color_schemes/dark.scss +14 -0
  16. data/_sass/content.scss +114 -0
  17. data/_sass/custom/custom.scss +120 -0
  18. data/_sass/labels.scss +36 -0
  19. data/_sass/layout.scss +147 -0
  20. data/_sass/navigation.scss +148 -0
  21. data/_sass/search.scss +114 -0
  22. data/_sass/support/_functions.scss +10 -0
  23. data/_sass/support/_variables.scss +130 -0
  24. data/_sass/support/mixins/_buttons.scss +27 -0
  25. data/_sass/support/mixins/_layout.scss +36 -0
  26. data/_sass/support/mixins/_typography.scss +81 -0
  27. data/_sass/support/mixins/mixins.scss +3 -0
  28. data/_sass/support/support.scss +3 -0
  29. data/_sass/tables.scss +78 -0
  30. data/_sass/typography.scss +58 -0
  31. data/_sass/utilities/_colors.scss +239 -0
  32. data/_sass/utilities/_layout.scss +38 -0
  33. data/_sass/utilities/_lists.scss +11 -0
  34. data/_sass/utilities/_spacing.scss +121 -0
  35. data/_sass/utilities/_typography.scss +91 -0
  36. data/_sass/utilities/utilities.scss +5 -0
  37. data/_sass/vendor/normalize.scss/README.md +78 -0
  38. data/_sass/vendor/normalize.scss/normalize.scss +427 -0
  39. data/_sass/vendor/normalize.scss/package.json +70 -0
  40. data/assets/css/dark-mode-preview.scss +41 -0
  41. data/assets/css/just-the-docs.scss +44 -0
  42. data/assets/images/just-the-docs.png +0 -0
  43. data/assets/images/search.svg +1 -0
  44. data/assets/js/just-the-docs.js +177 -0
  45. data/assets/js/search-data.json +12 -0
  46. data/assets/js/vendor/lunr.min.js +6 -0
  47. data/bin/just-the-docs +16 -0
  48. data/lib/tasks/search.rake +27 -0
  49. metadata +137 -0
@@ -0,0 +1,70 @@
1
+ {
2
+ "_args": [
3
+ [
4
+ "normalize.scss",
5
+ "/Users/pmarsceill/_projects/just-the-docs"
6
+ ]
7
+ ],
8
+ "_from": "normalize.scss@*",
9
+ "_id": "normalize.scss@0.1.0",
10
+ "_inCache": true,
11
+ "_installable": true,
12
+ "_location": "/normalize.scss",
13
+ "_nodeVersion": "0.10.32",
14
+ "_npmUser": {
15
+ "email": "alexguerrero1092@gmail.com",
16
+ "name": "alexguerrero"
17
+ },
18
+ "_npmVersion": "2.0.2",
19
+ "_phantomChildren": {},
20
+ "_requested": {
21
+ "name": "normalize.scss",
22
+ "raw": "normalize.scss",
23
+ "rawSpec": "",
24
+ "scope": null,
25
+ "spec": "*",
26
+ "type": "range"
27
+ },
28
+ "_requiredBy": [
29
+ "#DEV:/"
30
+ ],
31
+ "_resolved": "https://registry.npmjs.org/normalize.scss/-/normalize.scss-0.1.0.tgz",
32
+ "_shasum": "4a21dc25bd4c019c857785f829b658aba2a8f9ab",
33
+ "_shrinkwrap": null,
34
+ "_spec": "normalize.scss",
35
+ "_where": "/Users/pmarsceill/_projects/just-the-docs",
36
+ "author": "",
37
+ "bugs": {
38
+ "url": "https://github.com/guerrero/normalize.scss/issues"
39
+ },
40
+ "dependencies": {},
41
+ "description": "Normalize.scss as a node packaged module",
42
+ "devDependencies": {},
43
+ "directories": {},
44
+ "dist": {
45
+ "shasum": "4a21dc25bd4c019c857785f829b658aba2a8f9ab",
46
+ "tarball": "https://registry.npmjs.org/normalize.scss/-/normalize.scss-0.1.0.tgz"
47
+ },
48
+ "files": [
49
+ "normalize.scss"
50
+ ],
51
+ "gitHead": "d67d517e28615a873066438af1d4845c157c9baf",
52
+ "homepage": "https://github.com/guerrero/normalize.scss",
53
+ "license": "MIT",
54
+ "maintainers": [
55
+ {
56
+ "name": "alexguerrero",
57
+ "email": "alexguerrero1092@gmail.com"
58
+ }
59
+ ],
60
+ "name": "normalize.scss",
61
+ "optionalDependencies": {},
62
+ "readme": "ERROR: No README data found!",
63
+ "repository": {
64
+ "type": "git",
65
+ "url": "git://github.com/guerrero/normalize.scss.git"
66
+ },
67
+ "scripts": {},
68
+ "style": "normalize.scss",
69
+ "version": "0.1.0"
70
+ }
@@ -0,0 +1,41 @@
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";
@@ -0,0 +1,44 @@
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
+ //
21
+ // Import custom overrides
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";
@@ -0,0 +1 @@
1
+ <svg width="28" height="28" viewBox="0 0 28 28" xmlns="http://www.w3.org/2000/svg"><title>Search</title><g fill-rule="nonzero" fill="#959396"><path d="M17.332 20.735c-5.537 0-10-4.6-10-10.247 0-5.646 4.463-10.247 10-10.247 5.536 0 10 4.601 10 10.247s-4.464 10.247-10 10.247zm0-4c3.3 0 6-2.783 6-6.247 0-3.463-2.7-6.247-6-6.247s-6 2.784-6 6.247c0 3.464 2.7 6.247 6 6.247z"/><path d="M11.672 13.791L.192 25.271 3.02 28.1 14.5 16.62z"/></g></svg>
@@ -0,0 +1,177 @@
1
+ // Event handling
2
+
3
+ function addEvent(el, type, handler) {
4
+ if (el.attachEvent) el.attachEvent('on'+type, handler); else el.addEventListener(type, handler);
5
+ }
6
+ function removeEvent(el, type, handler) {
7
+ if (el.detachEvent) el.detachEvent('on'+type, handler); else el.removeEventListener(type, handler);
8
+ }
9
+
10
+ // Show/hide mobile menu
11
+
12
+ function toggleNav(){
13
+ const nav = document.querySelector('.js-main-nav');
14
+ const auxNav = document.querySelector('.js-aux-nav');
15
+ const navTrigger = document.querySelector('.js-main-nav-trigger');
16
+ const search = document.querySelector('.js-search');
17
+
18
+ addEvent(navTrigger, 'click', function(){
19
+ var text = navTrigger.innerText;
20
+ var textToggle = navTrigger.getAttribute('data-text-toggle');
21
+
22
+ nav.classList.toggle('nav-open');
23
+ auxNav.classList.toggle('nav-open');
24
+ navTrigger.classList.toggle('nav-open');
25
+ search.classList.toggle('nav-open');
26
+ navTrigger.innerText = textToggle;
27
+ navTrigger.setAttribute('data-text-toggle', text);
28
+ textToggle = text;
29
+ })
30
+ }
31
+
32
+ // Site search
33
+
34
+ function initSearch() {
35
+ var index = lunr(function () {
36
+ this.ref('id');
37
+ this.field('title', { boost: 20 });
38
+ this.field('content', { boost: 10 });
39
+ this.field('url');
40
+ });
41
+
42
+ // Get the generated search_data.json file so lunr.js can search it locally.
43
+
44
+ sc = document.getElementsByTagName("script");
45
+ source = '';
46
+
47
+ for(idx = 0; idx < sc.length; idx++)
48
+ {
49
+ s = sc.item(idx);
50
+
51
+ if(s.src && s.src.match(/just-the-docs\.js$/))
52
+ { source = s.src; }
53
+ }
54
+
55
+ jsPath = source.replace('just-the-docs.js', '');
56
+
57
+ jsonPath = jsPath + 'search-data.json';
58
+
59
+ var request = new XMLHttpRequest();
60
+ request.open('GET', jsonPath, true);
61
+
62
+ request.onload = function() {
63
+ if (request.status >= 200 && request.status < 400) {
64
+ // Success!
65
+ var data = JSON.parse(request.responseText);
66
+ var keys = Object.keys(data);
67
+
68
+ for(var i in data) {
69
+ index.add({
70
+ id: data[i].id,
71
+ title: data[i].title,
72
+ content: data[i].content,
73
+ url: data[i].url
74
+ });
75
+ }
76
+ searchResults(data);
77
+ } else {
78
+ // We reached our target server, but it returned an error
79
+ console.log('Error loading ajax request. Request status:' + request.status);
80
+ }
81
+ };
82
+
83
+ request.onerror = function() {
84
+ // There was a connection error of some sort
85
+ console.log('There was a connection error');
86
+ };
87
+
88
+ request.send();
89
+
90
+ function searchResults(dataStore) {
91
+ var searchInput = document.querySelector('.js-search-input');
92
+ var searchResults = document.querySelector('.js-search-results');
93
+ var store = dataStore;
94
+
95
+ function hideResults() {
96
+ searchResults.innerHTML = '';
97
+ searchResults.classList.remove('active');
98
+ }
99
+
100
+ addEvent(searchInput, 'keyup', function(e){
101
+ var query = this.value;
102
+
103
+ searchResults.innerHTML = '';
104
+ searchResults.classList.remove('active');
105
+
106
+ if (query === '') {
107
+ hideResults();
108
+ } else {
109
+ var results = index.search(query);
110
+
111
+ if (results.length > 0) {
112
+ searchResults.classList.add('active');
113
+ var resultsList = document.createElement('ul');
114
+ searchResults.appendChild(resultsList);
115
+
116
+ for (var i in results) {
117
+ var resultsListItem = document.createElement('li');
118
+ var resultsLink = document.createElement('a');
119
+ var resultsUrlDesc = document.createElement('span');
120
+ var resultsUrl = store[results[i].ref].url;
121
+ var resultsRelUrl = store[results[i].ref].relUrl;
122
+ var resultsTitle = store[results[i].ref].title;
123
+
124
+ resultsLink.setAttribute('href', resultsUrl);
125
+ resultsLink.innerText = resultsTitle;
126
+ resultsUrlDesc.innerText = resultsRelUrl;
127
+
128
+ resultsList.classList.add('search-results-list');
129
+ resultsListItem.classList.add('search-results-list-item');
130
+ resultsLink.classList.add('search-results-link');
131
+ resultsUrlDesc.classList.add('fs-2','text-grey-dk-000','d-block');
132
+
133
+ resultsList.appendChild(resultsListItem);
134
+ resultsListItem.appendChild(resultsLink);
135
+ resultsLink.appendChild(resultsUrlDesc);
136
+ }
137
+ }
138
+
139
+ // When esc key is pressed, hide the results and clear the field
140
+ if (e.keyCode == 27) {
141
+ hideResults();
142
+ searchInput.value = '';
143
+ }
144
+ }
145
+ });
146
+
147
+ addEvent(searchInput, 'blur', function(){
148
+ setTimeout(function(){ hideResults() }, 300);
149
+ });
150
+ }
151
+ }
152
+
153
+ function pageFocus() {
154
+ var mainContent = document.querySelector('.js-main-content');
155
+ mainContent.focus();
156
+ console.log(mainContent)
157
+ }
158
+
159
+
160
+ // Document ready
161
+
162
+ function ready(){
163
+ toggleNav();
164
+ pageFocus();
165
+ if (typeof lunr !== 'undefined') {
166
+ initSearch();
167
+ }
168
+ }
169
+
170
+ // in case the document is already rendered
171
+ if (document.readyState!='loading') ready();
172
+ // modern browsers
173
+ else if (document.addEventListener) document.addEventListener('DOMContentLoaded', ready);
174
+ // IE <= 8
175
+ else document.attachEvent('onreadystatechange', function(){
176
+ if (document.readyState=='complete') ready();
177
+ });
@@ -0,0 +1,12 @@
1
+ ---
2
+ ---
3
+ {
4
+ {% for page in site.html_pages %}{% if page.search_exclude != true %}"{{ forloop.index0 }}": {
5
+ "id": "{{ forloop.index0 }}",
6
+ "title": "{{ page.title | replace: '&amp;', '&' }}",
7
+ "content": "{{ page.content | markdownify | strip_html | escape_once | remove: 'Table of contents' | remove: '```' | remove: '---' | replace: '\', ' ' | normalize_whitespace }}",
8
+ "url": "{{ page.url | absolute_url }}",
9
+ "relUrl": "{{ page.url }}"
10
+ }{% unless forloop.last %},{% endunless %}
11
+ {% endif %}{% endfor %}
12
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * lunr - http://lunrjs.com - A bit like Solr, but much smaller and not as bright - 1.0.0
3
+ * Copyright (C) 2017 Oliver Nightingale
4
+ * @license MIT
5
+ */
6
+ !function(){var t=function(e){var n=new t.Index;return n.pipeline.add(t.trimmer,t.stopWordFilter,t.stemmer),e&&e.call(n,n),n};t.version="1.0.0",t.utils={},t.utils.warn=function(t){return function(e){t.console&&console.warn&&console.warn(e)}}(this),t.utils.asString=function(t){return void 0===t||null===t?"":t.toString()},t.EventEmitter=function(){this.events={}},t.EventEmitter.prototype.addListener=function(){var t=Array.prototype.slice.call(arguments),e=t.pop(),n=t;if("function"!=typeof e)throw new TypeError("last argument must be a function");n.forEach(function(t){this.hasHandler(t)||(this.events[t]=[]),this.events[t].push(e)},this)},t.EventEmitter.prototype.removeListener=function(t,e){if(this.hasHandler(t)){var n=this.events[t].indexOf(e);this.events[t].splice(n,1),this.events[t].length||delete this.events[t]}},t.EventEmitter.prototype.emit=function(t){if(this.hasHandler(t)){var e=Array.prototype.slice.call(arguments,1);this.events[t].forEach(function(t){t.apply(void 0,e)})}},t.EventEmitter.prototype.hasHandler=function(t){return t in this.events},t.tokenizer=function(e){return arguments.length&&null!=e&&void 0!=e?Array.isArray(e)?e.map(function(e){return t.utils.asString(e).toLowerCase()}):e.toString().trim().toLowerCase().split(t.tokenizer.separator):[]},t.tokenizer.separator=/[\s\-]+/,t.tokenizer.load=function(t){var e=this.registeredFunctions[t];if(!e)throw new Error("Cannot load un-registered function: "+t);return e},t.tokenizer.label="default",t.tokenizer.registeredFunctions={"default":t.tokenizer},t.tokenizer.registerFunction=function(e,n){n in this.registeredFunctions&&t.utils.warn("Overwriting existing tokenizer: "+n),e.label=n,this.registeredFunctions[n]=e},t.Pipeline=function(){this._stack=[]},t.Pipeline.registeredFunctions={},t.Pipeline.registerFunction=function(e,n){n in this.registeredFunctions&&t.utils.warn("Overwriting existing registered function: "+n),e.label=n,t.Pipeline.registeredFunctions[e.label]=e},t.Pipeline.warnIfFunctionNotRegistered=function(e){var n=e.label&&e.label in this.registeredFunctions;n||t.utils.warn("Function is not registered with pipeline. This may cause problems when serialising the index.\n",e)},t.Pipeline.load=function(e){var n=new t.Pipeline;return e.forEach(function(e){var i=t.Pipeline.registeredFunctions[e];if(!i)throw new Error("Cannot load un-registered function: "+e);n.add(i)}),n},t.Pipeline.prototype.add=function(){var e=Array.prototype.slice.call(arguments);e.forEach(function(e){t.Pipeline.warnIfFunctionNotRegistered(e),this._stack.push(e)},this)},t.Pipeline.prototype.after=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var i=this._stack.indexOf(e);if(-1==i)throw new Error("Cannot find existingFn");i+=1,this._stack.splice(i,0,n)},t.Pipeline.prototype.before=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var i=this._stack.indexOf(e);if(-1==i)throw new Error("Cannot find existingFn");this._stack.splice(i,0,n)},t.Pipeline.prototype.remove=function(t){var e=this._stack.indexOf(t);-1!=e&&this._stack.splice(e,1)},t.Pipeline.prototype.run=function(t){for(var e=[],n=t.length,i=this._stack.length,r=0;n>r;r++){for(var o=t[r],s=0;i>s&&(o=this._stack[s](o,r,t),void 0!==o&&""!==o);s++);void 0!==o&&""!==o&&e.push(o)}return e},t.Pipeline.prototype.reset=function(){this._stack=[]},t.Pipeline.prototype.toJSON=function(){return this._stack.map(function(e){return t.Pipeline.warnIfFunctionNotRegistered(e),e.label})},t.Vector=function(){this._magnitude=null,this.list=void 0,this.length=0},t.Vector.Node=function(t,e,n){this.idx=t,this.val=e,this.next=n},t.Vector.prototype.insert=function(e,n){this._magnitude=void 0;var i=this.list;if(!i)return this.list=new t.Vector.Node(e,n,i),this.length++;if(e<i.idx)return this.list=new t.Vector.Node(e,n,i),this.length++;for(var r=i,o=i.next;void 0!=o;){if(e<o.idx)return r.next=new t.Vector.Node(e,n,o),this.length++;r=o,o=o.next}return r.next=new t.Vector.Node(e,n,o),this.length++},t.Vector.prototype.magnitude=function(){if(this._magnitude)return this._magnitude;for(var t,e=this.list,n=0;e;)t=e.val,n+=t*t,e=e.next;return this._magnitude=Math.sqrt(n)},t.Vector.prototype.dot=function(t){for(var e=this.list,n=t.list,i=0;e&&n;)e.idx<n.idx?e=e.next:e.idx>n.idx?n=n.next:(i+=e.val*n.val,e=e.next,n=n.next);return i},t.Vector.prototype.similarity=function(t){return this.dot(t)/(this.magnitude()*t.magnitude())},t.SortedSet=function(){this.length=0,this.elements=[]},t.SortedSet.load=function(t){var e=new this;return e.elements=t,e.length=t.length,e},t.SortedSet.prototype.add=function(){var t,e;for(t=0;t<arguments.length;t++)e=arguments[t],~this.indexOf(e)||this.elements.splice(this.locationFor(e),0,e);this.length=this.elements.length},t.SortedSet.prototype.toArray=function(){return this.elements.slice()},t.SortedSet.prototype.map=function(t,e){return this.elements.map(t,e)},t.SortedSet.prototype.forEach=function(t,e){return this.elements.forEach(t,e)},t.SortedSet.prototype.indexOf=function(t){for(var e=0,n=this.elements.length,i=n-e,r=e+Math.floor(i/2),o=this.elements[r];i>1;){if(o===t)return r;t>o&&(e=r),o>t&&(n=r),i=n-e,r=e+Math.floor(i/2),o=this.elements[r]}return o===t?r:-1},t.SortedSet.prototype.locationFor=function(t){for(var e=0,n=this.elements.length,i=n-e,r=e+Math.floor(i/2),o=this.elements[r];i>1;)t>o&&(e=r),o>t&&(n=r),i=n-e,r=e+Math.floor(i/2),o=this.elements[r];return o>t?r:t>o?r+1:void 0},t.SortedSet.prototype.intersect=function(e){for(var n=new t.SortedSet,i=0,r=0,o=this.length,s=e.length,a=this.elements,h=e.elements;;){if(i>o-1||r>s-1)break;a[i]!==h[r]?a[i]<h[r]?i++:a[i]>h[r]&&r++:(n.add(a[i]),i++,r++)}return n},t.SortedSet.prototype.clone=function(){var e=new t.SortedSet;return e.elements=this.toArray(),e.length=e.elements.length,e},t.SortedSet.prototype.union=function(t){var e,n,i;this.length>=t.length?(e=this,n=t):(e=t,n=this),i=e.clone();for(var r=0,o=n.toArray();r<o.length;r++)i.add(o[r]);return i},t.SortedSet.prototype.toJSON=function(){return this.toArray()},t.Index=function(){this._fields=[],this._ref="id",this.pipeline=new t.Pipeline,this.documentStore=new t.Store,this.tokenStore=new t.TokenStore,this.corpusTokens=new t.SortedSet,this.eventEmitter=new t.EventEmitter,this.tokenizerFn=t.tokenizer,this._idfCache={},this.on("add","remove","update",function(){this._idfCache={}}.bind(this))},t.Index.prototype.on=function(){var t=Array.prototype.slice.call(arguments);return this.eventEmitter.addListener.apply(this.eventEmitter,t)},t.Index.prototype.off=function(t,e){return this.eventEmitter.removeListener(t,e)},t.Index.load=function(e){e.version!==t.version&&t.utils.warn("version mismatch: current "+t.version+" importing "+e.version);var n=new this;return n._fields=e.fields,n._ref=e.ref,n.tokenizer(t.tokenizer.load(e.tokenizer)),n.documentStore=t.Store.load(e.documentStore),n.tokenStore=t.TokenStore.load(e.tokenStore),n.corpusTokens=t.SortedSet.load(e.corpusTokens),n.pipeline=t.Pipeline.load(e.pipeline),n},t.Index.prototype.field=function(t,e){var e=e||{},n={name:t,boost:e.boost||1};return this._fields.push(n),this},t.Index.prototype.ref=function(t){return this._ref=t,this},t.Index.prototype.tokenizer=function(e){var n=e.label&&e.label in t.tokenizer.registeredFunctions;return n||t.utils.warn("Function is not a registered tokenizer. This may cause problems when serialising the index"),this.tokenizerFn=e,this},t.Index.prototype.add=function(e,n){var i={},r=new t.SortedSet,o=e[this._ref],n=void 0===n?!0:n;this._fields.forEach(function(t){var n=this.pipeline.run(this.tokenizerFn(e[t.name]));i[t.name]=n;for(var o=0;o<n.length;o++){var s=n[o];r.add(s),this.corpusTokens.add(s)}},this),this.documentStore.set(o,r);for(var s=0;s<r.length;s++){for(var a=r.elements[s],h=0,u=0;u<this._fields.length;u++){var l=this._fields[u],c=i[l.name],f=c.length;if(f){for(var d=0,p=0;f>p;p++)c[p]===a&&d++;h+=d/f*l.boost}}this.tokenStore.add(a,{ref:o,tf:h})}n&&this.eventEmitter.emit("add",e,this)},t.Index.prototype.remove=function(t,e){var n=t[this._ref],e=void 0===e?!0:e;if(this.documentStore.has(n)){var i=this.documentStore.get(n);this.documentStore.remove(n),i.forEach(function(t){this.tokenStore.remove(t,n)},this),e&&this.eventEmitter.emit("remove",t,this)}},t.Index.prototype.update=function(t,e){var e=void 0===e?!0:e;this.remove(t,!1),this.add(t,!1),e&&this.eventEmitter.emit("update",t,this)},t.Index.prototype.idf=function(t){var e="@"+t;if(Object.prototype.hasOwnProperty.call(this._idfCache,e))return this._idfCache[e];var n=this.tokenStore.count(t),i=1;return n>0&&(i=1+Math.log(this.documentStore.length/n)),this._idfCache[e]=i},t.Index.prototype.search=function(e){var n=this.pipeline.run(this.tokenizerFn(e)),i=new t.Vector,r=[],o=this._fields.reduce(function(t,e){return t+e.boost},0),s=n.some(function(t){return this.tokenStore.has(t)},this);if(!s)return[];n.forEach(function(e,n,s){var a=1/s.length*this._fields.length*o,h=this,u=this.tokenStore.expand(e).reduce(function(n,r){var o=h.corpusTokens.indexOf(r),s=h.idf(r),u=1,l=new t.SortedSet;if(r!==e){var c=Math.max(3,r.length-e.length);u=1/Math.log(c)}o>-1&&i.insert(o,a*s*u);for(var f=h.tokenStore.get(r),d=Object.keys(f),p=d.length,v=0;p>v;v++)l.add(f[d[v]].ref);return n.union(l)},new t.SortedSet);r.push(u)},this);var a=r.reduce(function(t,e){return t.intersect(e)});return a.map(function(t){return{ref:t,score:i.similarity(this.documentVector(t))}},this).sort(function(t,e){return e.score-t.score})},t.Index.prototype.documentVector=function(e){for(var n=this.documentStore.get(e),i=n.length,r=new t.Vector,o=0;i>o;o++){var s=n.elements[o],a=this.tokenStore.get(s)[e].tf,h=this.idf(s);r.insert(this.corpusTokens.indexOf(s),a*h)}return r},t.Index.prototype.toJSON=function(){return{version:t.version,fields:this._fields,ref:this._ref,tokenizer:this.tokenizerFn.label,documentStore:this.documentStore.toJSON(),tokenStore:this.tokenStore.toJSON(),corpusTokens:this.corpusTokens.toJSON(),pipeline:this.pipeline.toJSON()}},t.Index.prototype.use=function(t){var e=Array.prototype.slice.call(arguments,1);e.unshift(this),t.apply(this,e)},t.Store=function(){this.store={},this.length=0},t.Store.load=function(e){var n=new this;return n.length=e.length,n.store=Object.keys(e.store).reduce(function(n,i){return n[i]=t.SortedSet.load(e.store[i]),n},{}),n},t.Store.prototype.set=function(t,e){this.has(t)||this.length++,this.store[t]=e},t.Store.prototype.get=function(t){return this.store[t]},t.Store.prototype.has=function(t){return t in this.store},t.Store.prototype.remove=function(t){this.has(t)&&(delete this.store[t],this.length--)},t.Store.prototype.toJSON=function(){return{store:this.store,length:this.length}},t.stemmer=function(){var t={ational:"ate",tional:"tion",enci:"ence",anci:"ance",izer:"ize",bli:"ble",alli:"al",entli:"ent",eli:"e",ousli:"ous",ization:"ize",ation:"ate",ator:"ate",alism:"al",iveness:"ive",fulness:"ful",ousness:"ous",aliti:"al",iviti:"ive",biliti:"ble",logi:"log"},e={icate:"ic",ative:"",alize:"al",iciti:"ic",ical:"ic",ful:"",ness:""},n="[^aeiou]",i="[aeiouy]",r=n+"[^aeiouy]*",o=i+"[aeiou]*",s="^("+r+")?"+o+r,a="^("+r+")?"+o+r+"("+o+")?$",h="^("+r+")?"+o+r+o+r,u="^("+r+")?"+i,l=new RegExp(s),c=new RegExp(h),f=new RegExp(a),d=new RegExp(u),p=/^(.+?)(ss|i)es$/,v=/^(.+?)([^s])s$/,g=/^(.+?)eed$/,m=/^(.+?)(ed|ing)$/,y=/.$/,S=/(at|bl|iz)$/,w=new RegExp("([^aeiouylsz])\\1$"),k=new RegExp("^"+r+i+"[^aeiouwxy]$"),x=/^(.+?[^aeiou])y$/,b=/^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/,E=/^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/,F=/^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/,_=/^(.+?)(s|t)(ion)$/,z=/^(.+?)e$/,O=/ll$/,P=new RegExp("^"+r+i+"[^aeiouwxy]$"),T=function(n){var i,r,o,s,a,h,u;if(n.length<3)return n;if(o=n.substr(0,1),"y"==o&&(n=o.toUpperCase()+n.substr(1)),s=p,a=v,s.test(n)?n=n.replace(s,"$1$2"):a.test(n)&&(n=n.replace(a,"$1$2")),s=g,a=m,s.test(n)){var T=s.exec(n);s=l,s.test(T[1])&&(s=y,n=n.replace(s,""))}else if(a.test(n)){var T=a.exec(n);i=T[1],a=d,a.test(i)&&(n=i,a=S,h=w,u=k,a.test(n)?n+="e":h.test(n)?(s=y,n=n.replace(s,"")):u.test(n)&&(n+="e"))}if(s=x,s.test(n)){var T=s.exec(n);i=T[1],n=i+"i"}if(s=b,s.test(n)){var T=s.exec(n);i=T[1],r=T[2],s=l,s.test(i)&&(n=i+t[r])}if(s=E,s.test(n)){var T=s.exec(n);i=T[1],r=T[2],s=l,s.test(i)&&(n=i+e[r])}if(s=F,a=_,s.test(n)){var T=s.exec(n);i=T[1],s=c,s.test(i)&&(n=i)}else if(a.test(n)){var T=a.exec(n);i=T[1]+T[2],a=c,a.test(i)&&(n=i)}if(s=z,s.test(n)){var T=s.exec(n);i=T[1],s=c,a=f,h=P,(s.test(i)||a.test(i)&&!h.test(i))&&(n=i)}return s=O,a=c,s.test(n)&&a.test(n)&&(s=y,n=n.replace(s,"")),"y"==o&&(n=o.toLowerCase()+n.substr(1)),n};return T}(),t.Pipeline.registerFunction(t.stemmer,"stemmer"),t.generateStopWordFilter=function(t){var e=t.reduce(function(t,e){return t[e]=e,t},{});return function(t){return t&&e[t]!==t?t:void 0}},t.stopWordFilter=t.generateStopWordFilter(["a","able","about","across","after","all","almost","also","am","among","an","and","any","are","as","at","be","because","been","but","by","can","cannot","could","dear","did","do","does","either","else","ever","every","for","from","get","got","had","has","have","he","her","hers","him","his","how","however","i","if","in","into","is","it","its","just","least","let","like","likely","may","me","might","most","must","my","neither","no","nor","not","of","off","often","on","only","or","other","our","own","rather","said","say","says","she","should","since","so","some","than","that","the","their","them","then","there","these","they","this","tis","to","too","twas","us","wants","was","we","were","what","when","where","which","while","who","whom","why","will","with","would","yet","you","your"]),t.Pipeline.registerFunction(t.stopWordFilter,"stopWordFilter"),t.trimmer=function(t){return t.replace(/^\W+/,"").replace(/\W+$/,"")},t.Pipeline.registerFunction(t.trimmer,"trimmer"),t.TokenStore=function(){this.root={docs:{}},this.length=0},t.TokenStore.load=function(t){var e=new this;return e.root=t.root,e.length=t.length,e},t.TokenStore.prototype.add=function(t,e,n){var n=n||this.root,i=t.charAt(0),r=t.slice(1);return i in n||(n[i]={docs:{}}),0===r.length?(n[i].docs[e.ref]=e,void(this.length+=1)):this.add(r,e,n[i])},t.TokenStore.prototype.has=function(t){if(!t)return!1;for(var e=this.root,n=0;n<t.length;n++){if(!e[t.charAt(n)])return!1;e=e[t.charAt(n)]}return!0},t.TokenStore.prototype.getNode=function(t){if(!t)return{};for(var e=this.root,n=0;n<t.length;n++){if(!e[t.charAt(n)])return{};e=e[t.charAt(n)]}return e},t.TokenStore.prototype.get=function(t,e){return this.getNode(t,e).docs||{}},t.TokenStore.prototype.count=function(t,e){return Object.keys(this.get(t,e)).length},t.TokenStore.prototype.remove=function(t,e){if(t){for(var n=this.root,i=0;i<t.length;i++){if(!(t.charAt(i)in n))return;n=n[t.charAt(i)]}delete n.docs[e]}},t.TokenStore.prototype.expand=function(t,e){var n=this.getNode(t),i=n.docs||{},e=e||[];return Object.keys(i).length&&e.push(t),Object.keys(n).forEach(function(n){"docs"!==n&&e.concat(this.expand(t+n,e))},this),e},t.TokenStore.prototype.toJSON=function(){return{root:this.root,length:this.length}},function(t,e){"function"==typeof define&&define.amd?define(e):"object"==typeof exports?module.exports=e():t.lunr=e()}(this,function(){return t})}();
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ gem_dir = File.expand_path("..",File.dirname(__FILE__))
4
+ $LOAD_PATH.unshift gem_dir # Look in gem directory for resources first.
5
+ exec_type = ARGV[0]
6
+
7
+ if exec_type == 'rake' then
8
+ require 'rake'
9
+ require 'pp'
10
+ pwd=Dir.pwd
11
+ Dir.chdir(gem_dir) # We'll load rakefile from the gem's dir.
12
+ Rake.application.init
13
+ Rake.application.load_rakefile
14
+ Dir.chdir(pwd) # Revert to original pwd for any path args passed to task.
15
+ Rake.application.invoke_task(ARGV[1])
16
+ end
@@ -0,0 +1,27 @@
1
+ namespace :search do
2
+ desc 'Generate the files needed for search functionality'
3
+ task :init do
4
+ puts 'Creating search data json file...'
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 }}]
8
+ puts 'Done.'
9
+ puts 'Generating content...'
10
+
11
+ File.open('assets/js/search-data.json', 'w') do |f|
12
+ f.puts '---
13
+ ---
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+'",
19
+ "url": "{{ page.url | absolute_url }}",
20
+ "relUrl": "{{ page.url }}"
21
+ }{% unless forloop.last %},{% endunless %}
22
+ {% endif %}{% endfor %}
23
+ }'
24
+ end
25
+ puts 'Done.'
26
+ end
27
+ end
metadata ADDED
@@ -0,0 +1,137 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: just-the-docs-altair
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.3
5
+ platform: ruby
6
+ authors:
7
+ - Patrick Marsceill
8
+ - Samuel Imolorhe
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2019-03-23 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: jekyll
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - "~>"
19
+ - !ruby/object:Gem::Version
20
+ version: 3.8.5
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "~>"
26
+ - !ruby/object:Gem::Version
27
+ version: 3.8.5
28
+ - !ruby/object:Gem::Dependency
29
+ name: rake
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - "~>"
33
+ - !ruby/object:Gem::Version
34
+ version: 12.3.1
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: 12.3.1
42
+ - !ruby/object:Gem::Dependency
43
+ name: bundler
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - "~>"
47
+ - !ruby/object:Gem::Version
48
+ version: 2.0.1
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - "~>"
54
+ - !ruby/object:Gem::Version
55
+ version: 2.0.1
56
+ description:
57
+ email:
58
+ - patrick.marsceill@gmail.com
59
+ - samuelimolo4real@gmail.com
60
+ executables:
61
+ - just-the-docs
62
+ extensions: []
63
+ extra_rdoc_files: []
64
+ files:
65
+ - LICENSE.txt
66
+ - README.md
67
+ - Rakefile
68
+ - _includes/head.html
69
+ - _includes/nav.html
70
+ - _layouts/about.html
71
+ - _layouts/default.html
72
+ - _layouts/home.html
73
+ - _layouts/page.html
74
+ - _layouts/post.html
75
+ - _sass/base.scss
76
+ - _sass/buttons.scss
77
+ - _sass/code.scss
78
+ - _sass/color_schemes/dark.scss
79
+ - _sass/content.scss
80
+ - _sass/custom/custom.scss
81
+ - _sass/labels.scss
82
+ - _sass/layout.scss
83
+ - _sass/navigation.scss
84
+ - _sass/search.scss
85
+ - _sass/support/_functions.scss
86
+ - _sass/support/_variables.scss
87
+ - _sass/support/mixins/_buttons.scss
88
+ - _sass/support/mixins/_layout.scss
89
+ - _sass/support/mixins/_typography.scss
90
+ - _sass/support/mixins/mixins.scss
91
+ - _sass/support/support.scss
92
+ - _sass/tables.scss
93
+ - _sass/typography.scss
94
+ - _sass/utilities/_colors.scss
95
+ - _sass/utilities/_layout.scss
96
+ - _sass/utilities/_lists.scss
97
+ - _sass/utilities/_spacing.scss
98
+ - _sass/utilities/_typography.scss
99
+ - _sass/utilities/utilities.scss
100
+ - _sass/vendor/normalize.scss/README.md
101
+ - _sass/vendor/normalize.scss/normalize.scss
102
+ - _sass/vendor/normalize.scss/package.json
103
+ - assets/css/dark-mode-preview.scss
104
+ - assets/css/just-the-docs.scss
105
+ - assets/images/just-the-docs.png
106
+ - assets/images/search.svg
107
+ - assets/js/just-the-docs.js
108
+ - assets/js/search-data.json
109
+ - assets/js/vendor/lunr.min.js
110
+ - bin/just-the-docs
111
+ - lib/tasks/search.rake
112
+ homepage: https://github.com/imolorhe/just-the-docs
113
+ licenses:
114
+ - MIT
115
+ metadata: {}
116
+ post_install_message:
117
+ rdoc_options: []
118
+ require_paths:
119
+ - lib
120
+ required_ruby_version: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ required_rubygems_version: !ruby/object:Gem::Requirement
126
+ requirements:
127
+ - - ">="
128
+ - !ruby/object:Gem::Version
129
+ version: '0'
130
+ requirements: []
131
+ rubyforge_project:
132
+ rubygems_version: 2.5.1
133
+ signing_key:
134
+ specification_version: 4
135
+ summary: A modern, high customizable, responsive Jekyll theme for documention with
136
+ built-in search.
137
+ test_files: []