fni-docs-theme 0.4.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 (66) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/README.md +19 -0
  4. data/Rakefile +1 -0
  5. data/_includes/css/custom.scss.liquid +1 -0
  6. data/_includes/css/just-the-docs.scss.liquid +7 -0
  7. data/_includes/fix_linenos.html +65 -0
  8. data/_includes/footer_custom.html +3 -0
  9. data/_includes/head.html +39 -0
  10. data/_includes/head_custom.html +0 -0
  11. data/_includes/header_custom.html +0 -0
  12. data/_includes/js/custom.js +0 -0
  13. data/_includes/nav.html +31 -0
  14. data/_includes/title.html +5 -0
  15. data/_includes/vendor/anchor_headings.html +144 -0
  16. data/_layouts/about.html +5 -0
  17. data/_layouts/default.html +199 -0
  18. data/_layouts/home.html +5 -0
  19. data/_layouts/page.html +5 -0
  20. data/_layouts/post.html +5 -0
  21. data/_layouts/table_wrappers.html +7 -0
  22. data/_layouts/vendor/compress.html +10 -0
  23. data/_sass/base.scss +108 -0
  24. data/_sass/buttons.scss +118 -0
  25. data/_sass/code.scss +340 -0
  26. data/_sass/color_schemes/dark.scss +17 -0
  27. data/_sass/color_schemes/light.scss +0 -0
  28. data/_sass/content.scss +231 -0
  29. data/_sass/custom/custom.scss +0 -0
  30. data/_sass/labels.scss +37 -0
  31. data/_sass/layout.scss +205 -0
  32. data/_sass/modules.scss +20 -0
  33. data/_sass/navigation.scss +219 -0
  34. data/_sass/print.scss +40 -0
  35. data/_sass/search.scss +324 -0
  36. data/_sass/support/_functions.scss +9 -0
  37. data/_sass/support/_variables.scss +153 -0
  38. data/_sass/support/mixins/_buttons.scss +27 -0
  39. data/_sass/support/mixins/_layout.scss +34 -0
  40. data/_sass/support/mixins/_typography.scss +84 -0
  41. data/_sass/support/mixins/mixins.scss +3 -0
  42. data/_sass/support/support.scss +3 -0
  43. data/_sass/tables.scss +58 -0
  44. data/_sass/typography.scss +64 -0
  45. data/_sass/utilities/_colors.scss +239 -0
  46. data/_sass/utilities/_layout.scss +95 -0
  47. data/_sass/utilities/_lists.scss +17 -0
  48. data/_sass/utilities/_spacing.scss +165 -0
  49. data/_sass/utilities/_typography.scss +91 -0
  50. data/_sass/utilities/utilities.scss +5 -0
  51. data/_sass/vendor/normalize.scss/README.md +7 -0
  52. data/_sass/vendor/normalize.scss/normalize.scss +349 -0
  53. data/assets/css/just-the-docs-dark.scss +3 -0
  54. data/assets/css/just-the-docs-default.scss +8 -0
  55. data/assets/css/just-the-docs-light.scss +3 -0
  56. data/assets/images/just-the-docs.png +0 -0
  57. data/assets/images/search.svg +1 -0
  58. data/assets/js/jtd-nav.js +35 -0
  59. data/assets/js/just-the-docs.js +471 -0
  60. data/assets/js/vendor/lunr.min.js +6 -0
  61. data/assets/js/zzzz-search-data.json +72 -0
  62. data/bin/just-the-docs +16 -0
  63. data/lib/fni-docs-theme.rb +1 -0
  64. data/lib/generators/nav-generator.rb +31 -0
  65. data/lib/tasks/search.rake +86 -0
  66. metadata +200 -0
@@ -0,0 +1,471 @@
1
+ ---
2
+ ---
3
+ (function (jtd, undefined) {
4
+
5
+ // Event handling
6
+
7
+ jtd.addEvent = function(el, type, handler) {
8
+ if (el.attachEvent) el.attachEvent('on'+type, handler); else el.addEventListener(type, handler);
9
+ }
10
+ jtd.removeEvent = function(el, type, handler) {
11
+ if (el.detachEvent) el.detachEvent('on'+type, handler); else el.removeEventListener(type, handler);
12
+ }
13
+ jtd.onReady = function(ready) {
14
+ // in case the document is already rendered
15
+ if (document.readyState!='loading') ready();
16
+ // modern browsers
17
+ else if (document.addEventListener) document.addEventListener('DOMContentLoaded', ready);
18
+ // IE <= 8
19
+ else document.attachEvent('onreadystatechange', function(){
20
+ if (document.readyState=='complete') ready();
21
+ });
22
+ }
23
+
24
+ // Show/hide mobile menu
25
+
26
+ function initNav() {
27
+ jtd.addEvent(document, 'click', function(e){
28
+ var target = e.target;
29
+ while (target && !(target.classList && target.classList.contains('nav-list-expander'))) {
30
+ target = target.parentNode;
31
+ }
32
+ if (target) {
33
+ e.preventDefault();
34
+ target.parentNode.classList.toggle('active');
35
+ }
36
+ });
37
+
38
+ const siteNav = document.getElementById('site-nav');
39
+ const mainHeader = document.getElementById('main-header');
40
+ const menuButton = document.getElementById('menu-button');
41
+
42
+ jtd.addEvent(menuButton, 'click', function(e){
43
+ e.preventDefault();
44
+
45
+ if (menuButton.classList.toggle('nav-open')) {
46
+ siteNav.classList.add('nav-open');
47
+ mainHeader.classList.add('nav-open');
48
+ } else {
49
+ siteNav.classList.remove('nav-open');
50
+ mainHeader.classList.remove('nav-open');
51
+ }
52
+ });
53
+
54
+ {%- if site.search_enabled != false and site.search.button %}
55
+ const searchInput = document.getElementById('search-input');
56
+ const searchButton = document.getElementById('search-button');
57
+
58
+ jtd.addEvent(searchButton, 'click', function(e){
59
+ e.preventDefault();
60
+
61
+ mainHeader.classList.add('nav-open');
62
+ searchInput.focus();
63
+ });
64
+ {%- endif %}
65
+ }
66
+
67
+ {%- if site.search_enabled != false %}
68
+ // Site search
69
+
70
+ function initSearch() {
71
+ var request = new XMLHttpRequest();
72
+ request.open('GET', '{{ "assets/js/search-data.json" | absolute_url }}', true);
73
+
74
+ request.onload = function(){
75
+ if (request.status >= 200 && request.status < 400) {
76
+ var docs = JSON.parse(request.responseText);
77
+
78
+ lunr.tokenizer.separator = {{ site.search.tokenizer_separator | default: site.search_tokenizer_separator | default: "/[\s\-/]+/" }}
79
+
80
+ var index = lunr(function(){
81
+ this.ref('id');
82
+ this.field('title', { boost: 200 });
83
+ this.field('content', { boost: 2 });
84
+ {%- if site.search.rel_url != false %}
85
+ this.field('relUrl');
86
+ {%- endif %}
87
+ this.metadataWhitelist = ['position']
88
+
89
+ for (var i in docs) {
90
+ this.add({
91
+ id: i,
92
+ title: docs[i].title,
93
+ content: docs[i].content,
94
+ {%- if site.search.rel_url != false %}
95
+ relUrl: docs[i].relUrl
96
+ {%- endif %}
97
+ });
98
+ }
99
+ });
100
+
101
+ searchLoaded(index, docs);
102
+ } else {
103
+ console.log('Error loading ajax request. Request status:' + request.status);
104
+ }
105
+ };
106
+
107
+ request.onerror = function(){
108
+ console.log('There was a connection error');
109
+ };
110
+
111
+ request.send();
112
+ }
113
+
114
+ function searchLoaded(index, docs) {
115
+ var index = index;
116
+ var docs = docs;
117
+ var searchInput = document.getElementById('search-input');
118
+ var searchResults = document.getElementById('search-results');
119
+ var mainHeader = document.getElementById('main-header');
120
+ var currentInput;
121
+ var currentSearchIndex = 0;
122
+
123
+ function showSearch() {
124
+ document.documentElement.classList.add('search-active');
125
+ }
126
+
127
+ function hideSearch() {
128
+ document.documentElement.classList.remove('search-active');
129
+ }
130
+
131
+ function update() {
132
+ currentSearchIndex++;
133
+
134
+ var input = searchInput.value;
135
+ if (input === '') {
136
+ hideSearch();
137
+ } else {
138
+ showSearch();
139
+ // scroll search input into view, workaround for iOS Safari
140
+ window.scroll(0, -1);
141
+ setTimeout(function(){ window.scroll(0, 0); }, 0);
142
+ }
143
+ if (input === currentInput) {
144
+ return;
145
+ }
146
+ currentInput = input;
147
+ searchResults.innerHTML = '';
148
+ if (input === '') {
149
+ return;
150
+ }
151
+
152
+ var results = index.query(function (query) {
153
+ var tokens = lunr.tokenizer(input)
154
+ query.term(tokens, {
155
+ boost: 10
156
+ });
157
+ query.term(tokens, {
158
+ wildcard: lunr.Query.wildcard.TRAILING
159
+ });
160
+ });
161
+
162
+ if ((results.length == 0) && (input.length > 2)) {
163
+ var tokens = lunr.tokenizer(input).filter(function(token, i) {
164
+ return token.str.length < 20;
165
+ })
166
+ if (tokens.length > 0) {
167
+ results = index.query(function (query) {
168
+ query.term(tokens, {
169
+ editDistance: Math.round(Math.sqrt(input.length / 2 - 1))
170
+ });
171
+ });
172
+ }
173
+ }
174
+
175
+ if (results.length == 0) {
176
+ var noResultsDiv = document.createElement('div');
177
+ noResultsDiv.classList.add('search-no-result');
178
+ noResultsDiv.innerText = 'No results found';
179
+ searchResults.appendChild(noResultsDiv);
180
+
181
+ } else {
182
+ var resultsList = document.createElement('ul');
183
+ resultsList.classList.add('search-results-list');
184
+ searchResults.appendChild(resultsList);
185
+
186
+ addResults(resultsList, results, 0, 10, 100, currentSearchIndex);
187
+ }
188
+
189
+ function addResults(resultsList, results, start, batchSize, batchMillis, searchIndex) {
190
+ if (searchIndex != currentSearchIndex) {
191
+ return;
192
+ }
193
+ for (var i = start; i < (start + batchSize); i++) {
194
+ if (i == results.length) {
195
+ return;
196
+ }
197
+ addResult(resultsList, results[i]);
198
+ }
199
+ setTimeout(function() {
200
+ addResults(resultsList, results, start + batchSize, batchSize, batchMillis, searchIndex);
201
+ }, batchMillis);
202
+ }
203
+
204
+ function addResult(resultsList, result) {
205
+ var doc = docs[result.ref];
206
+
207
+ var resultsListItem = document.createElement('li');
208
+ resultsListItem.classList.add('search-results-list-item');
209
+ resultsList.appendChild(resultsListItem);
210
+
211
+ var resultLink = document.createElement('a');
212
+ resultLink.classList.add('search-result');
213
+ resultLink.setAttribute('href', doc.url);
214
+ resultsListItem.appendChild(resultLink);
215
+
216
+ var resultTitle = document.createElement('div');
217
+ resultTitle.classList.add('search-result-title');
218
+ resultLink.appendChild(resultTitle);
219
+
220
+ var resultDoc = document.createElement('div');
221
+ resultDoc.classList.add('search-result-doc');
222
+ resultDoc.innerHTML = '<svg viewBox="0 0 24 24" class="search-result-icon"><use xlink:href="#svg-doc"></use></svg>';
223
+ resultTitle.appendChild(resultDoc);
224
+
225
+ var resultDocTitle = document.createElement('div');
226
+ resultDocTitle.classList.add('search-result-doc-title');
227
+ resultDocTitle.innerHTML = doc.doc;
228
+ resultDoc.appendChild(resultDocTitle);
229
+ var resultDocOrSection = resultDocTitle;
230
+
231
+ if (doc.doc != doc.title) {
232
+ resultDoc.classList.add('search-result-doc-parent');
233
+ var resultSection = document.createElement('div');
234
+ resultSection.classList.add('search-result-section');
235
+ resultSection.innerHTML = doc.title;
236
+ resultTitle.appendChild(resultSection);
237
+ resultDocOrSection = resultSection;
238
+ }
239
+
240
+ var metadata = result.matchData.metadata;
241
+ var titlePositions = [];
242
+ var contentPositions = [];
243
+ for (var j in metadata) {
244
+ var meta = metadata[j];
245
+ if (meta.title) {
246
+ var positions = meta.title.position;
247
+ for (var k in positions) {
248
+ titlePositions.push(positions[k]);
249
+ }
250
+ }
251
+ if (meta.content) {
252
+ var positions = meta.content.position;
253
+ for (var k in positions) {
254
+ var position = positions[k];
255
+ var previewStart = position[0];
256
+ var previewEnd = position[0] + position[1];
257
+ var ellipsesBefore = true;
258
+ var ellipsesAfter = true;
259
+ for (var k = 0; k < {{ site.search.preview_words_before | default: 5 }}; k++) {
260
+ var nextSpace = doc.content.lastIndexOf(' ', previewStart - 2);
261
+ var nextDot = doc.content.lastIndexOf('. ', previewStart - 2);
262
+ if ((nextDot >= 0) && (nextDot > nextSpace)) {
263
+ previewStart = nextDot + 1;
264
+ ellipsesBefore = false;
265
+ break;
266
+ }
267
+ if (nextSpace < 0) {
268
+ previewStart = 0;
269
+ ellipsesBefore = false;
270
+ break;
271
+ }
272
+ previewStart = nextSpace + 1;
273
+ }
274
+ for (var k = 0; k < {{ site.search.preview_words_after | default: 10 }}; k++) {
275
+ var nextSpace = doc.content.indexOf(' ', previewEnd + 1);
276
+ var nextDot = doc.content.indexOf('. ', previewEnd + 1);
277
+ if ((nextDot >= 0) && (nextDot < nextSpace)) {
278
+ previewEnd = nextDot;
279
+ ellipsesAfter = false;
280
+ break;
281
+ }
282
+ if (nextSpace < 0) {
283
+ previewEnd = doc.content.length;
284
+ ellipsesAfter = false;
285
+ break;
286
+ }
287
+ previewEnd = nextSpace;
288
+ }
289
+ contentPositions.push({
290
+ highlight: position,
291
+ previewStart: previewStart, previewEnd: previewEnd,
292
+ ellipsesBefore: ellipsesBefore, ellipsesAfter: ellipsesAfter
293
+ });
294
+ }
295
+ }
296
+ }
297
+
298
+ if (titlePositions.length > 0) {
299
+ titlePositions.sort(function(p1, p2){ return p1[0] - p2[0] });
300
+ resultDocOrSection.innerHTML = '';
301
+ addHighlightedText(resultDocOrSection, doc.title, 0, doc.title.length, titlePositions);
302
+ }
303
+
304
+ if (contentPositions.length > 0) {
305
+ contentPositions.sort(function(p1, p2){ return p1.highlight[0] - p2.highlight[0] });
306
+ var contentPosition = contentPositions[0];
307
+ var previewPosition = {
308
+ highlight: [contentPosition.highlight],
309
+ previewStart: contentPosition.previewStart, previewEnd: contentPosition.previewEnd,
310
+ ellipsesBefore: contentPosition.ellipsesBefore, ellipsesAfter: contentPosition.ellipsesAfter
311
+ };
312
+ var previewPositions = [previewPosition];
313
+ for (var j = 1; j < contentPositions.length; j++) {
314
+ contentPosition = contentPositions[j];
315
+ if (previewPosition.previewEnd < contentPosition.previewStart) {
316
+ previewPosition = {
317
+ highlight: [contentPosition.highlight],
318
+ previewStart: contentPosition.previewStart, previewEnd: contentPosition.previewEnd,
319
+ ellipsesBefore: contentPosition.ellipsesBefore, ellipsesAfter: contentPosition.ellipsesAfter
320
+ }
321
+ previewPositions.push(previewPosition);
322
+ } else {
323
+ previewPosition.highlight.push(contentPosition.highlight);
324
+ previewPosition.previewEnd = contentPosition.previewEnd;
325
+ previewPosition.ellipsesAfter = contentPosition.ellipsesAfter;
326
+ }
327
+ }
328
+
329
+ var resultPreviews = document.createElement('div');
330
+ resultPreviews.classList.add('search-result-previews');
331
+ resultLink.appendChild(resultPreviews);
332
+
333
+ var content = doc.content;
334
+ for (var j = 0; j < Math.min(previewPositions.length, {{ site.search.previews | default: 3 }}); j++) {
335
+ var position = previewPositions[j];
336
+
337
+ var resultPreview = document.createElement('div');
338
+ resultPreview.classList.add('search-result-preview');
339
+ resultPreviews.appendChild(resultPreview);
340
+
341
+ if (position.ellipsesBefore) {
342
+ resultPreview.appendChild(document.createTextNode('... '));
343
+ }
344
+ addHighlightedText(resultPreview, content, position.previewStart, position.previewEnd, position.highlight);
345
+ if (position.ellipsesAfter) {
346
+ resultPreview.appendChild(document.createTextNode(' ...'));
347
+ }
348
+ }
349
+ }
350
+
351
+ {%- if site.search.rel_url != false %}
352
+ var resultRelUrl = document.createElement('span');
353
+ resultRelUrl.classList.add('search-result-rel-url');
354
+ resultRelUrl.innerText = doc.relUrl;
355
+ resultTitle.appendChild(resultRelUrl);
356
+ {%- endif %}
357
+ }
358
+
359
+ function addHighlightedText(parent, text, start, end, positions) {
360
+ var index = start;
361
+ for (var i in positions) {
362
+ var position = positions[i];
363
+ var span = document.createElement('span');
364
+ span.innerHTML = text.substring(index, position[0]);
365
+ parent.appendChild(span);
366
+ index = position[0] + position[1];
367
+ var highlight = document.createElement('span');
368
+ highlight.classList.add('search-result-highlight');
369
+ highlight.innerHTML = text.substring(position[0], index);
370
+ parent.appendChild(highlight);
371
+ }
372
+ var span = document.createElement('span');
373
+ span.innerHTML = text.substring(index, end);
374
+ parent.appendChild(span);
375
+ }
376
+ }
377
+
378
+ jtd.addEvent(searchInput, 'focus', function(){
379
+ setTimeout(update, 0);
380
+ });
381
+
382
+ jtd.addEvent(searchInput, 'keyup', function(e){
383
+ switch (e.keyCode) {
384
+ case 27: // When esc key is pressed, hide the results and clear the field
385
+ searchInput.value = '';
386
+ break;
387
+ case 38: // arrow up
388
+ case 40: // arrow down
389
+ case 13: // enter
390
+ e.preventDefault();
391
+ return;
392
+ }
393
+ update();
394
+ });
395
+
396
+ jtd.addEvent(searchInput, 'keydown', function(e){
397
+ switch (e.keyCode) {
398
+ case 38: // arrow up
399
+ e.preventDefault();
400
+ var active = document.querySelector('.search-result.active');
401
+ if (active) {
402
+ active.classList.remove('active');
403
+ if (active.parentElement.previousSibling) {
404
+ var previous = active.parentElement.previousSibling.querySelector('.search-result');
405
+ previous.classList.add('active');
406
+ }
407
+ }
408
+ return;
409
+ case 40: // arrow down
410
+ e.preventDefault();
411
+ var active = document.querySelector('.search-result.active');
412
+ if (active) {
413
+ if (active.parentElement.nextSibling) {
414
+ var next = active.parentElement.nextSibling.querySelector('.search-result');
415
+ active.classList.remove('active');
416
+ next.classList.add('active');
417
+ }
418
+ } else {
419
+ var next = document.querySelector('.search-result');
420
+ if (next) {
421
+ next.classList.add('active');
422
+ }
423
+ }
424
+ return;
425
+ case 13: // enter
426
+ e.preventDefault();
427
+ var active = document.querySelector('.search-result.active');
428
+ if (active) {
429
+ active.click();
430
+ } else {
431
+ var first = document.querySelector('.search-result');
432
+ if (first) {
433
+ first.click();
434
+ }
435
+ }
436
+ return;
437
+ }
438
+ });
439
+
440
+ jtd.addEvent(document, 'click', function(e){
441
+ if (e.target != searchInput) {
442
+ hideSearch();
443
+ }
444
+ });
445
+ }
446
+ {%- endif %}
447
+
448
+ // Switch theme
449
+
450
+ jtd.getTheme = function() {
451
+ var cssFileHref = document.querySelector('[rel="stylesheet"]').getAttribute('href');
452
+ return cssFileHref.substring(cssFileHref.lastIndexOf('-') + 1, cssFileHref.length - 4);
453
+ }
454
+
455
+ jtd.setTheme = function(theme) {
456
+ var cssFile = document.querySelector('[rel="stylesheet"]');
457
+ cssFile.setAttribute('href', '{{ "assets/css/just-the-docs-" | absolute_url }}' + theme + '.css');
458
+ }
459
+
460
+ // Document ready
461
+
462
+ jtd.onReady(function(){
463
+ initNav();
464
+ {%- if site.search_enabled != false %}
465
+ initSearch();
466
+ {%- endif %}
467
+ });
468
+
469
+ })(window.jtd = window.jtd || {});
470
+
471
+ {% include js/custom.js %}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * lunr - http://lunrjs.com - A bit like Solr, but much smaller and not as bright - 2.3.6
3
+ * Copyright (C) 2019 Oliver Nightingale
4
+ * @license MIT
5
+ */
6
+ !function(){var e=function(t){var r=new e.Builder;return r.pipeline.add(e.trimmer,e.stopWordFilter,e.stemmer),r.searchPipeline.add(e.stemmer),t.call(r,r),r.build()};e.version="2.3.6",e.utils={},e.utils.warn=function(e){return function(t){e.console&&console.warn&&console.warn(t)}}(this),e.utils.asString=function(e){return void 0===e||null===e?"":e.toString()},e.utils.clone=function(e){if(null===e||void 0===e)return e;for(var t=Object.create(null),r=Object.keys(e),i=0;i<r.length;i++){var n=r[i],s=e[n];if(Array.isArray(s))t[n]=s.slice();else{if("string"!=typeof s&&"number"!=typeof s&&"boolean"!=typeof s)throw new TypeError("clone is not deep and does not support nested objects");t[n]=s}}return t},e.FieldRef=function(e,t,r){this.docRef=e,this.fieldName=t,this._stringValue=r},e.FieldRef.joiner="/",e.FieldRef.fromString=function(t){var r=t.indexOf(e.FieldRef.joiner);if(r===-1)throw"malformed field ref string";var i=t.slice(0,r),n=t.slice(r+1);return new e.FieldRef(n,i,t)},e.FieldRef.prototype.toString=function(){return void 0==this._stringValue&&(this._stringValue=this.fieldName+e.FieldRef.joiner+this.docRef),this._stringValue},e.Set=function(e){if(this.elements=Object.create(null),e){this.length=e.length;for(var t=0;t<this.length;t++)this.elements[e[t]]=!0}else this.length=0},e.Set.complete={intersect:function(e){return e},union:function(e){return e},contains:function(){return!0}},e.Set.empty={intersect:function(){return this},union:function(e){return e},contains:function(){return!1}},e.Set.prototype.contains=function(e){return!!this.elements[e]},e.Set.prototype.intersect=function(t){var r,i,n,s=[];if(t===e.Set.complete)return this;if(t===e.Set.empty)return t;this.length<t.length?(r=this,i=t):(r=t,i=this),n=Object.keys(r.elements);for(var o=0;o<n.length;o++){var a=n[o];a in i.elements&&s.push(a)}return new e.Set(s)},e.Set.prototype.union=function(t){return t===e.Set.complete?e.Set.complete:t===e.Set.empty?this:new e.Set(Object.keys(this.elements).concat(Object.keys(t.elements)))},e.idf=function(e,t){var r=0;for(var i in e)"_index"!=i&&(r+=Object.keys(e[i]).length);var n=(t-r+.5)/(r+.5);return Math.log(1+Math.abs(n))},e.Token=function(e,t){this.str=e||"",this.metadata=t||{}},e.Token.prototype.toString=function(){return this.str},e.Token.prototype.update=function(e){return this.str=e(this.str,this.metadata),this},e.Token.prototype.clone=function(t){return t=t||function(e){return e},new e.Token(t(this.str,this.metadata),this.metadata)},e.tokenizer=function(t,r){if(null==t||void 0==t)return[];if(Array.isArray(t))return t.map(function(t){return new e.Token(e.utils.asString(t).toLowerCase(),e.utils.clone(r))});for(var i=t.toString().trim().toLowerCase(),n=i.length,s=[],o=0,a=0;o<=n;o++){var u=i.charAt(o),l=o-a;if(u.match(e.tokenizer.separator)||o==n){if(l>0){var c=e.utils.clone(r)||{};c.position=[a,l],c.index=s.length,s.push(new e.Token(i.slice(a,o),c))}a=o+1}}return s},e.tokenizer.separator=/[\s\-]+/,e.Pipeline=function(){this._stack=[]},e.Pipeline.registeredFunctions=Object.create(null),e.Pipeline.registerFunction=function(t,r){r in this.registeredFunctions&&e.utils.warn("Overwriting existing registered function: "+r),t.label=r,e.Pipeline.registeredFunctions[t.label]=t},e.Pipeline.warnIfFunctionNotRegistered=function(t){var r=t.label&&t.label in this.registeredFunctions;r||e.utils.warn("Function is not registered with pipeline. This may cause problems when serialising the index.\n",t)},e.Pipeline.load=function(t){var r=new e.Pipeline;return t.forEach(function(t){var i=e.Pipeline.registeredFunctions[t];if(!i)throw new Error("Cannot load unregistered function: "+t);r.add(i)}),r},e.Pipeline.prototype.add=function(){var t=Array.prototype.slice.call(arguments);t.forEach(function(t){e.Pipeline.warnIfFunctionNotRegistered(t),this._stack.push(t)},this)},e.Pipeline.prototype.after=function(t,r){e.Pipeline.warnIfFunctionNotRegistered(r);var i=this._stack.indexOf(t);if(i==-1)throw new Error("Cannot find existingFn");i+=1,this._stack.splice(i,0,r)},e.Pipeline.prototype.before=function(t,r){e.Pipeline.warnIfFunctionNotRegistered(r);var i=this._stack.indexOf(t);if(i==-1)throw new Error("Cannot find existingFn");this._stack.splice(i,0,r)},e.Pipeline.prototype.remove=function(e){var t=this._stack.indexOf(e);t!=-1&&this._stack.splice(t,1)},e.Pipeline.prototype.run=function(e){for(var t=this._stack.length,r=0;r<t;r++){for(var i=this._stack[r],n=[],s=0;s<e.length;s++){var o=i(e[s],s,e);if(void 0!==o&&""!==o)if(Array.isArray(o))for(var a=0;a<o.length;a++)n.push(o[a]);else n.push(o)}e=n}return e},e.Pipeline.prototype.runString=function(t,r){var i=new e.Token(t,r);return this.run([i]).map(function(e){return e.toString()})},e.Pipeline.prototype.reset=function(){this._stack=[]},e.Pipeline.prototype.toJSON=function(){return this._stack.map(function(t){return e.Pipeline.warnIfFunctionNotRegistered(t),t.label})},e.Vector=function(e){this._magnitude=0,this.elements=e||[]},e.Vector.prototype.positionForIndex=function(e){if(0==this.elements.length)return 0;for(var t=0,r=this.elements.length/2,i=r-t,n=Math.floor(i/2),s=this.elements[2*n];i>1&&(s<e&&(t=n),s>e&&(r=n),s!=e);)i=r-t,n=t+Math.floor(i/2),s=this.elements[2*n];return s==e?2*n:s>e?2*n:s<e?2*(n+1):void 0},e.Vector.prototype.insert=function(e,t){this.upsert(e,t,function(){throw"duplicate index"})},e.Vector.prototype.upsert=function(e,t,r){this._magnitude=0;var i=this.positionForIndex(e);this.elements[i]==e?this.elements[i+1]=r(this.elements[i+1],t):this.elements.splice(i,0,e,t)},e.Vector.prototype.magnitude=function(){if(this._magnitude)return this._magnitude;for(var e=0,t=this.elements.length,r=1;r<t;r+=2){var i=this.elements[r];e+=i*i}return this._magnitude=Math.sqrt(e)},e.Vector.prototype.dot=function(e){for(var t=0,r=this.elements,i=e.elements,n=r.length,s=i.length,o=0,a=0,u=0,l=0;u<n&&l<s;)o=r[u],a=i[l],o<a?u+=2:o>a?l+=2:o==a&&(t+=r[u+1]*i[l+1],u+=2,l+=2);return t},e.Vector.prototype.similarity=function(e){return this.dot(e)/this.magnitude()||0},e.Vector.prototype.toArray=function(){for(var e=new Array(this.elements.length/2),t=1,r=0;t<this.elements.length;t+=2,r++)e[r]=this.elements[t];return e},e.Vector.prototype.toJSON=function(){return this.elements},e.stemmer=function(){var e={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"},t={icate:"ic",ative:"",alize:"al",iciti:"ic",ical:"ic",ful:"",ness:""},r="[^aeiou]",i="[aeiouy]",n=r+"[^aeiouy]*",s=i+"[aeiou]*",o="^("+n+")?"+s+n,a="^("+n+")?"+s+n+"("+s+")?$",u="^("+n+")?"+s+n+s+n,l="^("+n+")?"+i,c=new RegExp(o),h=new RegExp(u),d=new RegExp(a),f=new RegExp(l),p=/^(.+?)(ss|i)es$/,y=/^(.+?)([^s])s$/,m=/^(.+?)eed$/,v=/^(.+?)(ed|ing)$/,g=/.$/,x=/(at|bl|iz)$/,w=new RegExp("([^aeiouylsz])\\1$"),Q=new RegExp("^"+n+i+"[^aeiouwxy]$"),k=/^(.+?[^aeiou])y$/,S=/^(.+?)(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)$/,L=/^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/,b=/^(.+?)(s|t)(ion)$/,P=/^(.+?)e$/,T=/ll$/,O=new RegExp("^"+n+i+"[^aeiouwxy]$"),I=function(r){var i,n,s,o,a,u,l;if(r.length<3)return r;if(s=r.substr(0,1),"y"==s&&(r=s.toUpperCase()+r.substr(1)),o=p,a=y,o.test(r)?r=r.replace(o,"$1$2"):a.test(r)&&(r=r.replace(a,"$1$2")),o=m,a=v,o.test(r)){var I=o.exec(r);o=c,o.test(I[1])&&(o=g,r=r.replace(o,""))}else if(a.test(r)){var I=a.exec(r);i=I[1],a=f,a.test(i)&&(r=i,a=x,u=w,l=Q,a.test(r)?r+="e":u.test(r)?(o=g,r=r.replace(o,"")):l.test(r)&&(r+="e"))}if(o=k,o.test(r)){var I=o.exec(r);i=I[1],r=i+"i"}if(o=S,o.test(r)){var I=o.exec(r);i=I[1],n=I[2],o=c,o.test(i)&&(r=i+e[n])}if(o=E,o.test(r)){var I=o.exec(r);i=I[1],n=I[2],o=c,o.test(i)&&(r=i+t[n])}if(o=L,a=b,o.test(r)){var I=o.exec(r);i=I[1],o=h,o.test(i)&&(r=i)}else if(a.test(r)){var I=a.exec(r);i=I[1]+I[2],a=h,a.test(i)&&(r=i)}if(o=P,o.test(r)){var I=o.exec(r);i=I[1],o=h,a=d,u=O,(o.test(i)||a.test(i)&&!u.test(i))&&(r=i)}return o=T,a=h,o.test(r)&&a.test(r)&&(o=g,r=r.replace(o,"")),"y"==s&&(r=s.toLowerCase()+r.substr(1)),r};return function(e){return e.update(I)}}(),e.Pipeline.registerFunction(e.stemmer,"stemmer"),e.generateStopWordFilter=function(e){var t=e.reduce(function(e,t){return e[t]=t,e},{});return function(e){if(e&&t[e.toString()]!==e.toString())return e}},e.stopWordFilter=e.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"]),e.Pipeline.registerFunction(e.stopWordFilter,"stopWordFilter"),e.trimmer=function(e){return e.update(function(e){return e.replace(/^\W+/,"").replace(/\W+$/,"")})},e.Pipeline.registerFunction(e.trimmer,"trimmer"),e.TokenSet=function(){this["final"]=!1,this.edges={},this.id=e.TokenSet._nextId,e.TokenSet._nextId+=1},e.TokenSet._nextId=1,e.TokenSet.fromArray=function(t){for(var r=new e.TokenSet.Builder,i=0,n=t.length;i<n;i++)r.insert(t[i]);return r.finish(),r.root},e.TokenSet.fromClause=function(t){return"editDistance"in t?e.TokenSet.fromFuzzyString(t.term,t.editDistance):e.TokenSet.fromString(t.term)},e.TokenSet.fromFuzzyString=function(t,r){for(var i=new e.TokenSet,n=[{node:i,editsRemaining:r,str:t}];n.length;){var s=n.pop();if(s.str.length>0){var o,a=s.str.charAt(0);a in s.node.edges?o=s.node.edges[a]:(o=new e.TokenSet,s.node.edges[a]=o),1==s.str.length&&(o["final"]=!0),n.push({node:o,editsRemaining:s.editsRemaining,str:s.str.slice(1)})}if(0!=s.editsRemaining){if("*"in s.node.edges)var u=s.node.edges["*"];else{var u=new e.TokenSet;s.node.edges["*"]=u}if(0==s.str.length&&(u["final"]=!0),n.push({node:u,editsRemaining:s.editsRemaining-1,str:s.str}),s.str.length>1&&n.push({node:s.node,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)}),1==s.str.length&&(s.node["final"]=!0),s.str.length>=1){if("*"in s.node.edges)var l=s.node.edges["*"];else{var l=new e.TokenSet;s.node.edges["*"]=l}1==s.str.length&&(l["final"]=!0),n.push({node:l,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)})}if(s.str.length>1){var c,h=s.str.charAt(0),d=s.str.charAt(1);d in s.node.edges?c=s.node.edges[d]:(c=new e.TokenSet,s.node.edges[d]=c),1==s.str.length&&(c["final"]=!0),n.push({node:c,editsRemaining:s.editsRemaining-1,str:h+s.str.slice(2)})}}}return i},e.TokenSet.fromString=function(t){for(var r=new e.TokenSet,i=r,n=0,s=t.length;n<s;n++){var o=t[n],a=n==s-1;if("*"==o)r.edges[o]=r,r["final"]=a;else{var u=new e.TokenSet;u["final"]=a,r.edges[o]=u,r=u}}return i},e.TokenSet.prototype.toArray=function(){for(var e=[],t=[{prefix:"",node:this}];t.length;){var r=t.pop(),i=Object.keys(r.node.edges),n=i.length;r.node["final"]&&(r.prefix.charAt(0),e.push(r.prefix));for(var s=0;s<n;s++){var o=i[s];t.push({prefix:r.prefix.concat(o),node:r.node.edges[o]})}}return e},e.TokenSet.prototype.toString=function(){if(this._str)return this._str;for(var e=this["final"]?"1":"0",t=Object.keys(this.edges).sort(),r=t.length,i=0;i<r;i++){var n=t[i],s=this.edges[n];e=e+n+s.id}return e},e.TokenSet.prototype.intersect=function(t){for(var r=new e.TokenSet,i=void 0,n=[{qNode:t,output:r,node:this}];n.length;){i=n.pop();for(var s=Object.keys(i.qNode.edges),o=s.length,a=Object.keys(i.node.edges),u=a.length,l=0;l<o;l++)for(var c=s[l],h=0;h<u;h++){var d=a[h];if(d==c||"*"==c){var f=i.node.edges[d],p=i.qNode.edges[c],y=f["final"]&&p["final"],m=void 0;d in i.output.edges?(m=i.output.edges[d],m["final"]=m["final"]||y):(m=new e.TokenSet,m["final"]=y,i.output.edges[d]=m),n.push({qNode:p,output:m,node:f})}}}return r},e.TokenSet.Builder=function(){this.previousWord="",this.root=new e.TokenSet,this.uncheckedNodes=[],this.minimizedNodes={}},e.TokenSet.Builder.prototype.insert=function(t){var r,i=0;if(t<this.previousWord)throw new Error("Out of order word insertion");for(var n=0;n<t.length&&n<this.previousWord.length&&t[n]==this.previousWord[n];n++)i++;this.minimize(i),r=0==this.uncheckedNodes.length?this.root:this.uncheckedNodes[this.uncheckedNodes.length-1].child;for(var n=i;n<t.length;n++){var s=new e.TokenSet,o=t[n];r.edges[o]=s,this.uncheckedNodes.push({parent:r,"char":o,child:s}),r=s}r["final"]=!0,this.previousWord=t},e.TokenSet.Builder.prototype.finish=function(){this.minimize(0)},e.TokenSet.Builder.prototype.minimize=function(e){for(var t=this.uncheckedNodes.length-1;t>=e;t--){var r=this.uncheckedNodes[t],i=r.child.toString();i in this.minimizedNodes?r.parent.edges[r["char"]]=this.minimizedNodes[i]:(r.child._str=i,this.minimizedNodes[i]=r.child),this.uncheckedNodes.pop()}},e.Index=function(e){this.invertedIndex=e.invertedIndex,this.fieldVectors=e.fieldVectors,this.tokenSet=e.tokenSet,this.fields=e.fields,this.pipeline=e.pipeline},e.Index.prototype.search=function(t){return this.query(function(r){var i=new e.QueryParser(t,r);i.parse()})},e.Index.prototype.query=function(t){for(var r=new e.Query(this.fields),i=Object.create(null),n=Object.create(null),s=Object.create(null),o=Object.create(null),a=Object.create(null),u=0;u<this.fields.length;u++)n[this.fields[u]]=new e.Vector;t.call(r,r);for(var u=0;u<r.clauses.length;u++){var l=r.clauses[u],c=null,h=e.Set.complete;c=l.usePipeline?this.pipeline.runString(l.term,{fields:l.fields}):[l.term];for(var d=0;d<c.length;d++){var f=c[d];l.term=f;var p=e.TokenSet.fromClause(l),y=this.tokenSet.intersect(p).toArray();if(0===y.length&&l.presence===e.Query.presence.REQUIRED){for(var m=0;m<l.fields.length;m++){var v=l.fields[m];o[v]=e.Set.empty}break}for(var g=0;g<y.length;g++)for(var x=y[g],w=this.invertedIndex[x],Q=w._index,m=0;m<l.fields.length;m++){var v=l.fields[m],k=w[v],S=Object.keys(k),E=x+"/"+v,L=new e.Set(S);if(l.presence==e.Query.presence.REQUIRED&&(h=h.union(L),void 0===o[v]&&(o[v]=e.Set.complete)),l.presence!=e.Query.presence.PROHIBITED){if(n[v].upsert(Q,l.boost,function(e,t){return e+t}),!s[E]){for(var b=0;b<S.length;b++){var P,T=S[b],O=new e.FieldRef(T,v),I=k[T];void 0===(P=i[O])?i[O]=new e.MatchData(x,v,I):P.add(x,v,I)}s[E]=!0}}else void 0===a[v]&&(a[v]=e.Set.empty),a[v]=a[v].union(L)}}if(l.presence===e.Query.presence.REQUIRED)for(var m=0;m<l.fields.length;m++){var v=l.fields[m];o[v]=o[v].intersect(h)}}for(var R=e.Set.complete,F=e.Set.empty,u=0;u<this.fields.length;u++){var v=this.fields[u];o[v]&&(R=R.intersect(o[v])),a[v]&&(F=F.union(a[v]))}var C=Object.keys(i),N=[],_=Object.create(null);if(r.isNegated()){C=Object.keys(this.fieldVectors);for(var u=0;u<C.length;u++){var O=C[u],j=e.FieldRef.fromString(O);i[O]=new e.MatchData}}for(var u=0;u<C.length;u++){var j=e.FieldRef.fromString(C[u]),D=j.docRef;if(R.contains(D)&&!F.contains(D)){var A,B=this.fieldVectors[j],V=n[j.fieldName].similarity(B);if(void 0!==(A=_[D]))A.score+=V,A.matchData.combine(i[j]);else{var z={ref:D,score:V,matchData:i[j]};_[D]=z,N.push(z)}}}return N.sort(function(e,t){return t.score-e.score})},e.Index.prototype.toJSON=function(){var t=Object.keys(this.invertedIndex).sort().map(function(e){return[e,this.invertedIndex[e]]},this),r=Object.keys(this.fieldVectors).map(function(e){return[e,this.fieldVectors[e].toJSON()]},this);return{version:e.version,fields:this.fields,fieldVectors:r,invertedIndex:t,pipeline:this.pipeline.toJSON()}},e.Index.load=function(t){var r={},i={},n=t.fieldVectors,s=Object.create(null),o=t.invertedIndex,a=new e.TokenSet.Builder,u=e.Pipeline.load(t.pipeline);t.version!=e.version&&e.utils.warn("Version mismatch when loading serialised index. Current version of lunr '"+e.version+"' does not match serialized index '"+t.version+"'");for(var l=0;l<n.length;l++){var c=n[l],h=c[0],d=c[1];i[h]=new e.Vector(d)}for(var l=0;l<o.length;l++){var c=o[l],f=c[0],p=c[1];a.insert(f),s[f]=p}return a.finish(),r.fields=t.fields,r.fieldVectors=i,r.invertedIndex=s,r.tokenSet=a.root,r.pipeline=u,new e.Index(r)},e.Builder=function(){this._ref="id",this._fields=Object.create(null),this._documents=Object.create(null),this.invertedIndex=Object.create(null),this.fieldTermFrequencies={},this.fieldLengths={},this.tokenizer=e.tokenizer,this.pipeline=new e.Pipeline,this.searchPipeline=new e.Pipeline,this.documentCount=0,this._b=.75,this._k1=1.2,this.termIndex=0,this.metadataWhitelist=[]},e.Builder.prototype.ref=function(e){this._ref=e},e.Builder.prototype.field=function(e,t){if(/\//.test(e))throw new RangeError("Field '"+e+"' contains illegal character '/'");this._fields[e]=t||{}},e.Builder.prototype.b=function(e){e<0?this._b=0:e>1?this._b=1:this._b=e},e.Builder.prototype.k1=function(e){this._k1=e},e.Builder.prototype.add=function(t,r){var i=t[this._ref],n=Object.keys(this._fields);this._documents[i]=r||{},this.documentCount+=1;for(var s=0;s<n.length;s++){var o=n[s],a=this._fields[o].extractor,u=a?a(t):t[o],l=this.tokenizer(u,{fields:[o]}),c=this.pipeline.run(l),h=new e.FieldRef(i,o),d=Object.create(null);this.fieldTermFrequencies[h]=d,this.fieldLengths[h]=0,this.fieldLengths[h]+=c.length;for(var f=0;f<c.length;f++){var p=c[f];if(void 0==d[p]&&(d[p]=0),d[p]+=1,void 0==this.invertedIndex[p]){var y=Object.create(null);y._index=this.termIndex,this.termIndex+=1;for(var m=0;m<n.length;m++)y[n[m]]=Object.create(null);this.invertedIndex[p]=y}void 0==this.invertedIndex[p][o][i]&&(this.invertedIndex[p][o][i]=Object.create(null));for(var v=0;v<this.metadataWhitelist.length;v++){var g=this.metadataWhitelist[v],x=p.metadata[g];void 0==this.invertedIndex[p][o][i][g]&&(this.invertedIndex[p][o][i][g]=[]),this.invertedIndex[p][o][i][g].push(x)}}}},e.Builder.prototype.calculateAverageFieldLengths=function(){for(var t=Object.keys(this.fieldLengths),r=t.length,i={},n={},s=0;s<r;s++){var o=e.FieldRef.fromString(t[s]),a=o.fieldName;n[a]||(n[a]=0),n[a]+=1,i[a]||(i[a]=0),i[a]+=this.fieldLengths[o]}for(var u=Object.keys(this._fields),s=0;s<u.length;s++){var l=u[s];i[l]=i[l]/n[l]}this.averageFieldLength=i},e.Builder.prototype.createFieldVectors=function(){for(var t={},r=Object.keys(this.fieldTermFrequencies),i=r.length,n=Object.create(null),s=0;s<i;s++){for(var o=e.FieldRef.fromString(r[s]),a=o.fieldName,u=this.fieldLengths[o],l=new e.Vector,c=this.fieldTermFrequencies[o],h=Object.keys(c),d=h.length,f=this._fields[a].boost||1,p=this._documents[o.docRef].boost||1,y=0;y<d;y++){var m,v,g,x=h[y],w=c[x],Q=this.invertedIndex[x]._index;void 0===n[x]?(m=e.idf(this.invertedIndex[x],this.documentCount),n[x]=m):m=n[x],v=m*((this._k1+1)*w)/(this._k1*(1-this._b+this._b*(u/this.averageFieldLength[a]))+w),v*=f,v*=p,g=Math.round(1e3*v)/1e3,l.insert(Q,g)}t[o]=l}this.fieldVectors=t},e.Builder.prototype.createTokenSet=function(){this.tokenSet=e.TokenSet.fromArray(Object.keys(this.invertedIndex).sort())},e.Builder.prototype.build=function(){return this.calculateAverageFieldLengths(),this.createFieldVectors(),this.createTokenSet(),new e.Index({invertedIndex:this.invertedIndex,fieldVectors:this.fieldVectors,tokenSet:this.tokenSet,fields:Object.keys(this._fields),pipeline:this.searchPipeline})},e.Builder.prototype.use=function(e){var t=Array.prototype.slice.call(arguments,1);t.unshift(this),e.apply(this,t)},e.MatchData=function(e,t,r){for(var i=Object.create(null),n=Object.keys(r||{}),s=0;s<n.length;s++){var o=n[s];i[o]=r[o].slice()}this.metadata=Object.create(null),void 0!==e&&(this.metadata[e]=Object.create(null),this.metadata[e][t]=i)},e.MatchData.prototype.combine=function(e){for(var t=Object.keys(e.metadata),r=0;r<t.length;r++){var i=t[r],n=Object.keys(e.metadata[i]);void 0==this.metadata[i]&&(this.metadata[i]=Object.create(null));for(var s=0;s<n.length;s++){var o=n[s],a=Object.keys(e.metadata[i][o]);void 0==this.metadata[i][o]&&(this.metadata[i][o]=Object.create(null));for(var u=0;u<a.length;u++){var l=a[u];void 0==this.metadata[i][o][l]?this.metadata[i][o][l]=e.metadata[i][o][l]:this.metadata[i][o][l]=this.metadata[i][o][l].concat(e.metadata[i][o][l])}}}},e.MatchData.prototype.add=function(e,t,r){if(!(e in this.metadata))return this.metadata[e]=Object.create(null),void(this.metadata[e][t]=r);if(!(t in this.metadata[e]))return void(this.metadata[e][t]=r);for(var i=Object.keys(r),n=0;n<i.length;n++){var s=i[n];s in this.metadata[e][t]?this.metadata[e][t][s]=this.metadata[e][t][s].concat(r[s]):this.metadata[e][t][s]=r[s]}},e.Query=function(e){this.clauses=[],this.allFields=e},e.Query.wildcard=new String("*"),e.Query.wildcard.NONE=0,e.Query.wildcard.LEADING=1,e.Query.wildcard.TRAILING=2,e.Query.presence={OPTIONAL:1,REQUIRED:2,PROHIBITED:3},e.Query.prototype.clause=function(t){return"fields"in t||(t.fields=this.allFields),"boost"in t||(t.boost=1),"usePipeline"in t||(t.usePipeline=!0),"wildcard"in t||(t.wildcard=e.Query.wildcard.NONE),t.wildcard&e.Query.wildcard.LEADING&&t.term.charAt(0)!=e.Query.wildcard&&(t.term="*"+t.term),t.wildcard&e.Query.wildcard.TRAILING&&t.term.slice(-1)!=e.Query.wildcard&&(t.term=""+t.term+"*"),"presence"in t||(t.presence=e.Query.presence.OPTIONAL),this.clauses.push(t),this},e.Query.prototype.isNegated=function(){for(var t=0;t<this.clauses.length;t++)if(this.clauses[t].presence!=e.Query.presence.PROHIBITED)return!1;return!0},e.Query.prototype.term=function(t,r){if(Array.isArray(t))return t.forEach(function(t){this.term(t,e.utils.clone(r))},this),this;var i=r||{};return i.term=t.toString(),this.clause(i),this},e.QueryParseError=function(e,t,r){this.name="QueryParseError",this.message=e,this.start=t,this.end=r},e.QueryParseError.prototype=new Error,e.QueryLexer=function(e){this.lexemes=[],this.str=e,this.length=e.length,this.pos=0,this.start=0,this.escapeCharPositions=[]},e.QueryLexer.prototype.run=function(){for(var t=e.QueryLexer.lexText;t;)t=t(this)},e.QueryLexer.prototype.sliceString=function(){for(var e=[],t=this.start,r=this.pos,i=0;i<this.escapeCharPositions.length;i++)r=this.escapeCharPositions[i],e.push(this.str.slice(t,r)),t=r+1;return e.push(this.str.slice(t,this.pos)),this.escapeCharPositions.length=0,e.join("")},e.QueryLexer.prototype.emit=function(e){this.lexemes.push({type:e,str:this.sliceString(),start:this.start,end:this.pos}),this.start=this.pos},e.QueryLexer.prototype.escapeCharacter=function(){this.escapeCharPositions.push(this.pos-1),this.pos+=1},e.QueryLexer.prototype.next=function(){if(this.pos>=this.length)return e.QueryLexer.EOS;var t=this.str.charAt(this.pos);return this.pos+=1,t},e.QueryLexer.prototype.width=function(){return this.pos-this.start},e.QueryLexer.prototype.ignore=function(){this.start==this.pos&&(this.pos+=1),this.start=this.pos},e.QueryLexer.prototype.backup=function(){this.pos-=1},e.QueryLexer.prototype.acceptDigitRun=function(){var t,r;do t=this.next(),r=t.charCodeAt(0);while(r>47&&r<58);t!=e.QueryLexer.EOS&&this.backup()},e.QueryLexer.prototype.more=function(){return this.pos<this.length},e.QueryLexer.EOS="EOS",e.QueryLexer.FIELD="FIELD",e.QueryLexer.TERM="TERM",e.QueryLexer.EDIT_DISTANCE="EDIT_DISTANCE",e.QueryLexer.BOOST="BOOST",e.QueryLexer.PRESENCE="PRESENCE",e.QueryLexer.lexField=function(t){return t.backup(),t.emit(e.QueryLexer.FIELD),t.ignore(),e.QueryLexer.lexText},e.QueryLexer.lexTerm=function(t){if(t.width()>1&&(t.backup(),t.emit(e.QueryLexer.TERM)),t.ignore(),t.more())return e.QueryLexer.lexText},e.QueryLexer.lexEditDistance=function(t){return t.ignore(),t.acceptDigitRun(),t.emit(e.QueryLexer.EDIT_DISTANCE),e.QueryLexer.lexText},e.QueryLexer.lexBoost=function(t){return t.ignore(),t.acceptDigitRun(),t.emit(e.QueryLexer.BOOST),e.QueryLexer.lexText},e.QueryLexer.lexEOS=function(t){t.width()>0&&t.emit(e.QueryLexer.TERM)},e.QueryLexer.termSeparator=e.tokenizer.separator,e.QueryLexer.lexText=function(t){for(;;){var r=t.next();if(r==e.QueryLexer.EOS)return e.QueryLexer.lexEOS;if(92!=r.charCodeAt(0)){if(":"==r)return e.QueryLexer.lexField;if("~"==r)return t.backup(),t.width()>0&&t.emit(e.QueryLexer.TERM),e.QueryLexer.lexEditDistance;if("^"==r)return t.backup(),t.width()>0&&t.emit(e.QueryLexer.TERM),e.QueryLexer.lexBoost;if("+"==r&&1===t.width())return t.emit(e.QueryLexer.PRESENCE),e.QueryLexer.lexText;if("-"==r&&1===t.width())return t.emit(e.QueryLexer.PRESENCE),e.QueryLexer.lexText;if(r.match(e.QueryLexer.termSeparator))return e.QueryLexer.lexTerm}else t.escapeCharacter()}},e.QueryParser=function(t,r){this.lexer=new e.QueryLexer(t),this.query=r,this.currentClause={},this.lexemeIdx=0},e.QueryParser.prototype.parse=function(){this.lexer.run(),this.lexemes=this.lexer.lexemes;for(var t=e.QueryParser.parseClause;t;)t=t(this);return this.query},e.QueryParser.prototype.peekLexeme=function(){return this.lexemes[this.lexemeIdx]},e.QueryParser.prototype.consumeLexeme=function(){var e=this.peekLexeme();return this.lexemeIdx+=1,e},e.QueryParser.prototype.nextClause=function(){var e=this.currentClause;this.query.clause(e),this.currentClause={}},e.QueryParser.parseClause=function(t){var r=t.peekLexeme();if(void 0!=r)switch(r.type){case e.QueryLexer.PRESENCE:return e.QueryParser.parsePresence;case e.QueryLexer.FIELD:return e.QueryParser.parseField;case e.QueryLexer.TERM:return e.QueryParser.parseTerm;default:var i="expected either a field or a term, found "+r.type;throw r.str.length>=1&&(i+=" with value '"+r.str+"'"),new e.QueryParseError(i,r.start,r.end)}},e.QueryParser.parsePresence=function(t){var r=t.consumeLexeme();if(void 0!=r){switch(r.str){case"-":t.currentClause.presence=e.Query.presence.PROHIBITED;break;case"+":t.currentClause.presence=e.Query.presence.REQUIRED;break;default:var i="unrecognised presence operator'"+r.str+"'";throw new e.QueryParseError(i,r.start,r.end)}var n=t.peekLexeme();if(void 0==n){var i="expecting term or field, found nothing";throw new e.QueryParseError(i,r.start,r.end)}switch(n.type){case e.QueryLexer.FIELD:return e.QueryParser.parseField;case e.QueryLexer.TERM:return e.QueryParser.parseTerm;default:var i="expecting term or field, found '"+n.type+"'";throw new e.QueryParseError(i,n.start,n.end)}}},e.QueryParser.parseField=function(t){var r=t.consumeLexeme();if(void 0!=r){if(t.query.allFields.indexOf(r.str)==-1){var i=t.query.allFields.map(function(e){return"'"+e+"'"}).join(", "),n="unrecognised field '"+r.str+"', possible fields: "+i;throw new e.QueryParseError(n,r.start,r.end)}t.currentClause.fields=[r.str];var s=t.peekLexeme();if(void 0==s){var n="expecting term, found nothing";throw new e.QueryParseError(n,r.start,r.end)}switch(s.type){case e.QueryLexer.TERM:return e.QueryParser.parseTerm;default:var n="expecting term, found '"+s.type+"'";throw new e.QueryParseError(n,s.start,s.end)}}},e.QueryParser.parseTerm=function(t){var r=t.consumeLexeme();if(void 0!=r){t.currentClause.term=r.str.toLowerCase(),r.str.indexOf("*")!=-1&&(t.currentClause.usePipeline=!1);var i=t.peekLexeme();if(void 0==i)return void t.nextClause();switch(i.type){case e.QueryLexer.TERM:return t.nextClause(),e.QueryParser.parseTerm;case e.QueryLexer.FIELD:return t.nextClause(),e.QueryParser.parseField;case e.QueryLexer.EDIT_DISTANCE:return e.QueryParser.parseEditDistance;case e.QueryLexer.BOOST:return e.QueryParser.parseBoost;case e.QueryLexer.PRESENCE:return t.nextClause(),e.QueryParser.parsePresence;default:var n="Unexpected lexeme type '"+i.type+"'";throw new e.QueryParseError(n,i.start,i.end)}}},e.QueryParser.parseEditDistance=function(t){var r=t.consumeLexeme();if(void 0!=r){var i=parseInt(r.str,10);if(isNaN(i)){var n="edit distance must be numeric";throw new e.QueryParseError(n,r.start,r.end)}t.currentClause.editDistance=i;var s=t.peekLexeme();if(void 0==s)return void t.nextClause();switch(s.type){case e.QueryLexer.TERM:return t.nextClause(),e.QueryParser.parseTerm;case e.QueryLexer.FIELD:return t.nextClause(),e.QueryParser.parseField;case e.QueryLexer.EDIT_DISTANCE:return e.QueryParser.parseEditDistance;case e.QueryLexer.BOOST:return e.QueryParser.parseBoost;case e.QueryLexer.PRESENCE:return t.nextClause(),e.QueryParser.parsePresence;default:var n="Unexpected lexeme type '"+s.type+"'";throw new e.QueryParseError(n,s.start,s.end)}}},e.QueryParser.parseBoost=function(t){var r=t.consumeLexeme();if(void 0!=r){var i=parseInt(r.str,10);if(isNaN(i)){var n="boost must be numeric";throw new e.QueryParseError(n,r.start,r.end)}t.currentClause.boost=i;var s=t.peekLexeme();if(void 0==s)return void t.nextClause();switch(s.type){case e.QueryLexer.TERM:return t.nextClause(),e.QueryParser.parseTerm;case e.QueryLexer.FIELD:return t.nextClause(),e.QueryParser.parseField;case e.QueryLexer.EDIT_DISTANCE:return e.QueryParser.parseEditDistance;case e.QueryLexer.BOOST:return e.QueryParser.parseBoost;case e.QueryLexer.PRESENCE:return t.nextClause(),e.QueryParser.parsePresence;default:var n="Unexpected lexeme type '"+s.type+"'";throw new e.QueryParseError(n,s.start,s.end)}}},function(e,t){"function"==typeof define&&define.amd?define(t):"object"==typeof exports?module.exports=t():e.lunr=t()}(this,function(){return e})}();
@@ -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
+ }
data/bin/just-the-docs ADDED
@@ -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 @@
1
+ require "generators/nav-generator"
@@ -0,0 +1,31 @@
1
+ module NavGenerator
2
+ class Generator < Jekyll::Generator
3
+ # Generate a sorted page heirarchy based on parent / grand_parent
4
+ # TODO: If a new page is added to the site, need to hook into incremental rebuild and flush nav.html cache
5
+ def generate(site)
6
+ nav = nav_for_parent(site.pages, nil)
7
+
8
+ # Attach nav data to the default layout
9
+ site.layouts['default'].data['nav'] = nav
10
+ end
11
+
12
+ def nav_for_parent(page_list, parent)
13
+ pages = page_list
14
+ .filter { |page| page.data['parent'] == parent && page.data['title'] != nil && page.data['nav_exclude'] != true }
15
+ .sort_by { |page| [page.data['nav_order'] || 999, page.data['title']] }
16
+
17
+ nav = pages.map { |page|
18
+ children = page.data['has_children'] && nav_for_parent(page_list, page.data['title'])
19
+
20
+ # Attach the child data to the page itself, used to render the footer Table of Contents
21
+ page.data['nav'] = children
22
+
23
+ {
24
+ 'title' => page.data['title'],
25
+ 'url' => page.url,
26
+ 'children' => children
27
+ }
28
+ }
29
+ end
30
+ end
31
+ end