diff --git a/.prettierignore b/.prettierignore index 5dc073f5a..79588b6c4 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,9 +1,5 @@ package.json package-lock.json _site -assets/css/just-the-docs-default.scss -assets/css/just-the-docs-light.scss -assets/css/just-the-docs-dark.scss assets/js/vendor/lunr.min.js assets/js/search-data.json -assets/js/just-the-docs.js diff --git a/Gemfile b/Gemfile index b4b44ed8a..62a46ed15 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,2 @@ source "https://rubygems.org" -gem 'rake' -gem "jekyll-remote-theme" -gem 'jekyll-seo-tag' - -gem "webrick", "~> 1.7" +gem "github-pages", "~> 215", group: :jekyll_plugins diff --git a/Gemfile.lock b/Gemfile.lock index e20fd0916..40de7ce93 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,45 +1,209 @@ GEM remote: https://rubygems.org/ specs: + activesupport (6.0.4) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 0.7, < 2) + minitest (~> 5.1) + tzinfo (~> 1.1) + zeitwerk (~> 2.2, >= 2.2.2) addressable (2.7.0) public_suffix (>= 2.0.2, < 5.0) + coffee-script (2.4.1) + coffee-script-source + execjs + coffee-script-source (1.11.1) colorator (1.1.0) + commonmarker (0.17.13) + ruby-enum (~> 0.5) concurrent-ruby (1.1.9) + dnsruby (1.61.7) + simpleidn (~> 0.1) em-websocket (0.5.2) eventmachine (>= 0.12.9) http_parser.rb (~> 0.6.0) + ethon (0.14.0) + ffi (>= 1.15.0) eventmachine (1.2.7) + execjs (2.8.1) + faraday (1.4.2) + faraday-em_http (~> 1.0) + faraday-em_synchrony (~> 1.0) + faraday-excon (~> 1.1) + faraday-net_http (~> 1.0) + faraday-net_http_persistent (~> 1.1) + multipart-post (>= 1.2, < 3) + ruby2_keywords (>= 0.0.4) + faraday-em_http (1.0.0) + faraday-em_synchrony (1.0.0) + faraday-excon (1.1.0) + faraday-net_http (1.0.1) + faraday-net_http_persistent (1.1.0) ffi (1.15.3) forwardable-extended (2.6.0) + gemoji (3.0.1) + github-pages (215) + github-pages-health-check (= 1.17.2) + jekyll (= 3.9.0) + jekyll-avatar (= 0.7.0) + jekyll-coffeescript (= 1.1.1) + jekyll-commonmark-ghpages (= 0.1.6) + jekyll-default-layout (= 0.1.4) + jekyll-feed (= 0.15.1) + jekyll-gist (= 1.5.0) + jekyll-github-metadata (= 2.13.0) + jekyll-mentions (= 1.6.0) + jekyll-optional-front-matter (= 0.3.2) + jekyll-paginate (= 1.1.0) + jekyll-readme-index (= 0.3.0) + jekyll-redirect-from (= 0.16.0) + jekyll-relative-links (= 0.6.1) + jekyll-remote-theme (= 0.4.3) + jekyll-sass-converter (= 1.5.2) + jekyll-seo-tag (= 2.7.1) + jekyll-sitemap (= 1.4.0) + jekyll-swiss (= 1.0.0) + jekyll-theme-architect (= 0.1.1) + jekyll-theme-cayman (= 0.1.1) + jekyll-theme-dinky (= 0.1.1) + jekyll-theme-hacker (= 0.1.2) + jekyll-theme-leap-day (= 0.1.1) + jekyll-theme-merlot (= 0.1.1) + jekyll-theme-midnight (= 0.1.1) + jekyll-theme-minimal (= 0.1.1) + jekyll-theme-modernist (= 0.1.1) + jekyll-theme-primer (= 0.5.4) + jekyll-theme-slate (= 0.1.1) + jekyll-theme-tactile (= 0.1.1) + jekyll-theme-time-machine (= 0.1.1) + jekyll-titles-from-headings (= 0.5.3) + jemoji (= 0.12.0) + kramdown (= 2.3.1) + kramdown-parser-gfm (= 1.1.0) + liquid (= 4.0.3) + mercenary (~> 0.3) + minima (= 2.5.1) + nokogiri (>= 1.10.4, < 2.0) + rouge (= 3.26.0) + terminal-table (~> 1.4) + github-pages-health-check (1.17.2) + addressable (~> 2.3) + dnsruby (~> 1.60) + octokit (~> 4.0) + public_suffix (>= 2.0.2, < 5.0) + typhoeus (~> 1.3) + html-pipeline (2.14.0) + activesupport (>= 2) + nokogiri (>= 1.4) http_parser.rb (0.6.0) - i18n (1.8.10) + i18n (0.9.5) concurrent-ruby (~> 1.0) - jekyll (4.2.0) + jekyll (3.9.0) addressable (~> 2.4) colorator (~> 1.0) em-websocket (~> 0.5) - i18n (~> 1.0) - jekyll-sass-converter (~> 2.0) + i18n (~> 0.7) + jekyll-sass-converter (~> 1.0) jekyll-watch (~> 2.0) - kramdown (~> 2.3) - kramdown-parser-gfm (~> 1.0) + kramdown (>= 1.17, < 3) liquid (~> 4.0) - mercenary (~> 0.4.0) + mercenary (~> 0.3.3) pathutil (~> 0.9) - rouge (~> 3.0) + rouge (>= 1.7, < 4) safe_yaml (~> 1.0) - terminal-table (~> 2.0) + jekyll-avatar (0.7.0) + jekyll (>= 3.0, < 5.0) + jekyll-coffeescript (1.1.1) + coffee-script (~> 2.2) + coffee-script-source (~> 1.11.1) + jekyll-commonmark (1.3.1) + commonmarker (~> 0.14) + jekyll (>= 3.7, < 5.0) + jekyll-commonmark-ghpages (0.1.6) + commonmarker (~> 0.17.6) + jekyll-commonmark (~> 1.2) + rouge (>= 2.0, < 4.0) + jekyll-default-layout (0.1.4) + jekyll (~> 3.0) + jekyll-feed (0.15.1) + jekyll (>= 3.7, < 5.0) + jekyll-gist (1.5.0) + octokit (~> 4.2) + jekyll-github-metadata (2.13.0) + jekyll (>= 3.4, < 5.0) + octokit (~> 4.0, != 4.4.0) + jekyll-mentions (1.6.0) + html-pipeline (~> 2.3) + jekyll (>= 3.7, < 5.0) + jekyll-optional-front-matter (0.3.2) + jekyll (>= 3.0, < 5.0) + jekyll-paginate (1.1.0) + jekyll-readme-index (0.3.0) + jekyll (>= 3.0, < 5.0) + jekyll-redirect-from (0.16.0) + jekyll (>= 3.3, < 5.0) + jekyll-relative-links (0.6.1) + jekyll (>= 3.3, < 5.0) jekyll-remote-theme (0.4.3) addressable (~> 2.0) jekyll (>= 3.5, < 5.0) jekyll-sass-converter (>= 1.0, <= 3.0.0, != 2.0.0) rubyzip (>= 1.3.0, < 3.0) - jekyll-sass-converter (2.1.0) - sassc (> 2.0.1, < 3.0) + jekyll-sass-converter (1.5.2) + sass (~> 3.4) jekyll-seo-tag (2.7.1) jekyll (>= 3.8, < 5.0) + jekyll-sitemap (1.4.0) + jekyll (>= 3.7, < 5.0) + jekyll-swiss (1.0.0) + jekyll-theme-architect (0.1.1) + jekyll (~> 3.5) + jekyll-seo-tag (~> 2.0) + jekyll-theme-cayman (0.1.1) + jekyll (~> 3.5) + jekyll-seo-tag (~> 2.0) + jekyll-theme-dinky (0.1.1) + jekyll (~> 3.5) + jekyll-seo-tag (~> 2.0) + jekyll-theme-hacker (0.1.2) + jekyll (> 3.5, < 5.0) + jekyll-seo-tag (~> 2.0) + jekyll-theme-leap-day (0.1.1) + jekyll (~> 3.5) + jekyll-seo-tag (~> 2.0) + jekyll-theme-merlot (0.1.1) + jekyll (~> 3.5) + jekyll-seo-tag (~> 2.0) + jekyll-theme-midnight (0.1.1) + jekyll (~> 3.5) + jekyll-seo-tag (~> 2.0) + jekyll-theme-minimal (0.1.1) + jekyll (~> 3.5) + jekyll-seo-tag (~> 2.0) + jekyll-theme-modernist (0.1.1) + jekyll (~> 3.5) + jekyll-seo-tag (~> 2.0) + jekyll-theme-primer (0.5.4) + jekyll (> 3.5, < 5.0) + jekyll-github-metadata (~> 2.9) + jekyll-seo-tag (~> 2.0) + jekyll-theme-slate (0.1.1) + jekyll (~> 3.5) + jekyll-seo-tag (~> 2.0) + jekyll-theme-tactile (0.1.1) + jekyll (~> 3.5) + jekyll-seo-tag (~> 2.0) + jekyll-theme-time-machine (0.1.1) + jekyll (~> 3.5) + jekyll-seo-tag (~> 2.0) + jekyll-titles-from-headings (0.5.3) + jekyll (>= 3.3, < 5.0) jekyll-watch (2.2.1) listen (~> 3.0) + jemoji (0.12.0) + gemoji (~> 3.0) + html-pipeline (~> 2.2) + jekyll (>= 3.0, < 5.0) kramdown (2.3.1) rexml kramdown-parser-gfm (1.1.0) @@ -48,33 +212,62 @@ GEM listen (3.5.1) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) - mercenary (0.4.0) + mercenary (0.3.6) + mini_portile2 (2.5.3) + minima (2.5.1) + jekyll (>= 3.5, < 5.0) + jekyll-feed (~> 0.9) + jekyll-seo-tag (~> 2.1) + minitest (5.14.4) + multipart-post (2.1.1) + nokogiri (1.11.7) + mini_portile2 (~> 2.5.0) + racc (~> 1.4) + octokit (4.21.0) + faraday (>= 0.9) + sawyer (~> 0.8.0, >= 0.5.3) pathutil (0.16.2) forwardable-extended (~> 2.6) public_suffix (4.0.6) - rake (13.0.3) + racc (1.5.2) rb-fsevent (0.11.0) rb-inotify (0.10.1) ffi (~> 1.0) rexml (3.2.5) rouge (3.26.0) + ruby-enum (0.9.0) + i18n + ruby2_keywords (0.0.4) rubyzip (2.3.0) safe_yaml (1.0.5) - sassc (2.4.0) - ffi (~> 1.9) - terminal-table (2.0.0) + sass (3.7.4) + sass-listen (~> 4.0.0) + sass-listen (4.0.0) + rb-fsevent (~> 0.9, >= 0.9.4) + rb-inotify (~> 0.9, >= 0.9.7) + sawyer (0.8.2) + addressable (>= 2.3.5) + faraday (> 0.8, < 2.0) + simpleidn (0.2.1) + unf (~> 0.1.4) + terminal-table (1.8.0) unicode-display_width (~> 1.1, >= 1.1.1) + thread_safe (0.3.6) + typhoeus (1.4.0) + ethon (>= 0.9.0) + tzinfo (1.2.9) + thread_safe (~> 0.1) + unf (0.1.4) + unf_ext + unf_ext (0.0.7.7) unicode-display_width (1.7.0) - webrick (1.7.0) + zeitwerk (2.4.2) PLATFORMS ruby DEPENDENCIES - jekyll-remote-theme - jekyll-seo-tag - rake - webrick (~> 1.7) + github-pages (~> 215) BUNDLED WITH - 2.2.20 + 2.1.4 diff --git a/README.md b/README.md index 74358de74..3d4e07578 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,6 @@ This repository holds the code that generates the [Move2Kube Project's web page](https://movekube.konveyor.io/). -For more information refer [GitHub Pages Guide to Using Jekyll](https://help.github.com/en/github/working-with-github-pages/setting-up-a-github-pages-site-with-jekyll). - ## Contributing 1. If making changes to typescript files please run `yarn run build && yarn run bundle` to build typescript and update the bundle. diff --git a/Rakefile b/Rakefile deleted file mode 100644 index b8b42c4ba..000000000 --- a/Rakefile +++ /dev/null @@ -1 +0,0 @@ -Dir.glob('lib/tasks/*.rake').each {|r| import r} diff --git a/_config.yml b/_config.yml index afac5547d..2650e17d0 100644 --- a/_config.yml +++ b/_config.yml @@ -16,13 +16,10 @@ remote_theme: pmarsceill/just-the-docs title: Konveyor MoveKube description: A tool that accelerates the process of re-platforming to Kubernetes -baseurl: "/" # the subpath of your site, e.g. /blog -url: "" #"konveyor.github.io/move2kube" # the base hostname & protocol for your site, e.g. http://example.com -github: - repository_url: https://www.github.com/konveyor/move2kube/ - repository_name: Move2Kube +# baseurl: "/" # the subpath of your site, e.g. /blog +# url: "" #"konveyor.github.io/move2kube" # the base hostname & protocol for your site, e.g. http://example.com permalink: pretty -exclude: ["node_modules/", "*.gemspec", "*.gem", "Gemfile", "Gemfile.lock", "package.json", "package-lock.json", "script/", "LICENSE.txt", "lib/", "bin/", "README.md", "Rakefile"] +exclude: ["node_modules/", "*.gem", "Gemfile", "Gemfile.lock", "package.json", "package-lock.json", "script/", "LICENSE.txt", "bin/", "README.md", "vendor/"] # Set a path/url to a logo that will be displayed instead of the title logo: "/assets/images/konveyor-logo-move2kube-darkbg.png" @@ -101,10 +98,6 @@ color_scheme: konveyor # Google Tag Manager gtm_container_id: GTM-TKPDMS3 -plugins: - - jekyll-remote-theme - - jekyll-seo-tag - compress_html: clippings: all comments: all diff --git a/assets/css/just-the-docs-dark.scss b/assets/css/just-the-docs-dark.scss deleted file mode 100644 index ac92fb152..000000000 --- a/assets/css/just-the-docs-dark.scss +++ /dev/null @@ -1,3 +0,0 @@ ---- ---- -{% include css/just-the-docs.scss.liquid color_scheme="dark" %} diff --git a/assets/css/just-the-docs-default.scss b/assets/css/just-the-docs-default.scss deleted file mode 100644 index 63fde26e1..000000000 --- a/assets/css/just-the-docs-default.scss +++ /dev/null @@ -1,8 +0,0 @@ ---- ---- -{% if site.color_scheme and site.color_scheme != "nil" %} - {% assign color_scheme = site.color_scheme %} -{% else %} - {% assign color_scheme = "light" %} -{% endif %} -{% include css/just-the-docs.scss.liquid color_scheme=color_scheme %} diff --git a/assets/css/just-the-docs-light.scss b/assets/css/just-the-docs-light.scss deleted file mode 100644 index ac69688df..000000000 --- a/assets/css/just-the-docs-light.scss +++ /dev/null @@ -1,3 +0,0 @@ ---- ---- -{% include css/just-the-docs.scss.liquid color_scheme="light" %} diff --git a/assets/js/just-the-docs.js b/assets/js/just-the-docs.js deleted file mode 100644 index c287ec08c..000000000 --- a/assets/js/just-the-docs.js +++ /dev/null @@ -1,471 +0,0 @@ ---- ---- -(function (jtd, undefined) { - -// Event handling - -jtd.addEvent = function(el, type, handler) { - if (el.attachEvent) el.attachEvent('on'+type, handler); else el.addEventListener(type, handler); -} -jtd.removeEvent = function(el, type, handler) { - if (el.detachEvent) el.detachEvent('on'+type, handler); else el.removeEventListener(type, handler); -} -jtd.onReady = function(ready) { - // in case the document is already rendered - if (document.readyState!='loading') ready(); - // modern browsers - else if (document.addEventListener) document.addEventListener('DOMContentLoaded', ready); - // IE <= 8 - else document.attachEvent('onreadystatechange', function(){ - if (document.readyState=='complete') ready(); - }); -} - -// Show/hide mobile menu - -function initNav() { - jtd.addEvent(document, 'click', function(e){ - var target = e.target; - while (target && !(target.classList && target.classList.contains('nav-list-expander'))) { - target = target.parentNode; - } - if (target) { - e.preventDefault(); - target.parentNode.classList.toggle('active'); - } - }); - - const siteNav = document.getElementById('site-nav'); - const mainHeader = document.getElementById('main-header'); - const menuButton = document.getElementById('menu-button'); - - jtd.addEvent(menuButton, 'click', function(e){ - e.preventDefault(); - - if (menuButton.classList.toggle('nav-open')) { - siteNav.classList.add('nav-open'); - mainHeader.classList.add('nav-open'); - } else { - siteNav.classList.remove('nav-open'); - mainHeader.classList.remove('nav-open'); - } - }); - - {%- if site.search_enabled != false and site.search.button %} - const searchInput = document.getElementById('search-input'); - const searchButton = document.getElementById('search-button'); - - jtd.addEvent(searchButton, 'click', function(e){ - e.preventDefault(); - - mainHeader.classList.add('nav-open'); - searchInput.focus(); - }); - {%- endif %} -} - -{%- if site.search_enabled != false %} -// Site search - -function initSearch() { - var request = new XMLHttpRequest(); - request.open('GET', '{{ "assets/js/search-data.json" | absolute_url }}', true); - - request.onload = function(){ - if (request.status >= 200 && request.status < 400) { - var docs = JSON.parse(request.responseText); - - lunr.tokenizer.separator = {{ site.search.tokenizer_separator | default: site.search_tokenizer_separator | default: "/[\s\-/]+/" }} - - var index = lunr(function(){ - this.ref('id'); - this.field('title', { boost: 200 }); - this.field('content', { boost: 2 }); - {%- if site.search.rel_url != false %} - this.field('relUrl'); - {%- endif %} - this.metadataWhitelist = ['position'] - - for (var i in docs) { - this.add({ - id: i, - title: docs[i].title, - content: docs[i].content, - {%- if site.search.rel_url != false %} - relUrl: docs[i].relUrl - {%- endif %} - }); - } - }); - - searchLoaded(index, docs); - } else { - console.log('Error loading ajax request. Request status:' + request.status); - } - }; - - request.onerror = function(){ - console.log('There was a connection error'); - }; - - request.send(); -} - -function searchLoaded(index, docs) { - var index = index; - var docs = docs; - var searchInput = document.getElementById('search-input'); - var searchResults = document.getElementById('search-results'); - var mainHeader = document.getElementById('main-header'); - var currentInput; - var currentSearchIndex = 0; - - function showSearch() { - document.documentElement.classList.add('search-active'); - } - - function hideSearch() { - document.documentElement.classList.remove('search-active'); - } - - function update() { - currentSearchIndex++; - - var input = searchInput.value; - if (input === '') { - hideSearch(); - } else { - showSearch(); - // scroll search input into view, workaround for iOS Safari - window.scroll(0, -1); - setTimeout(function(){ window.scroll(0, 0); }, 0); - } - if (input === currentInput) { - return; - } - currentInput = input; - searchResults.innerHTML = ''; - if (input === '') { - return; - } - - var results = index.query(function (query) { - var tokens = lunr.tokenizer(input) - query.term(tokens, { - boost: 10 - }); - query.term(tokens, { - wildcard: lunr.Query.wildcard.TRAILING - }); - }); - - if ((results.length == 0) && (input.length > 2)) { - var tokens = lunr.tokenizer(input).filter(function(token, i) { - return token.str.length < 20; - }) - if (tokens.length > 0) { - results = index.query(function (query) { - query.term(tokens, { - editDistance: Math.round(Math.sqrt(input.length / 2 - 1)) - }); - }); - } - } - - if (results.length == 0) { - var noResultsDiv = document.createElement('div'); - noResultsDiv.classList.add('search-no-result'); - noResultsDiv.innerText = 'No results found'; - searchResults.appendChild(noResultsDiv); - - } else { - var resultsList = document.createElement('ul'); - resultsList.classList.add('search-results-list'); - searchResults.appendChild(resultsList); - - addResults(resultsList, results, 0, 10, 100, currentSearchIndex); - } - - function addResults(resultsList, results, start, batchSize, batchMillis, searchIndex) { - if (searchIndex != currentSearchIndex) { - return; - } - for (var i = start; i < (start + batchSize); i++) { - if (i == results.length) { - return; - } - addResult(resultsList, results[i]); - } - setTimeout(function() { - addResults(resultsList, results, start + batchSize, batchSize, batchMillis, searchIndex); - }, batchMillis); - } - - function addResult(resultsList, result) { - var doc = docs[result.ref]; - - var resultsListItem = document.createElement('li'); - resultsListItem.classList.add('search-results-list-item'); - resultsList.appendChild(resultsListItem); - - var resultLink = document.createElement('a'); - resultLink.classList.add('search-result'); - resultLink.setAttribute('href', doc.url); - resultsListItem.appendChild(resultLink); - - var resultTitle = document.createElement('div'); - resultTitle.classList.add('search-result-title'); - resultLink.appendChild(resultTitle); - - var resultDoc = document.createElement('div'); - resultDoc.classList.add('search-result-doc'); - resultDoc.innerHTML = ''; - resultTitle.appendChild(resultDoc); - - var resultDocTitle = document.createElement('div'); - resultDocTitle.classList.add('search-result-doc-title'); - resultDocTitle.innerHTML = doc.doc; - resultDoc.appendChild(resultDocTitle); - var resultDocOrSection = resultDocTitle; - - if (doc.doc != doc.title) { - resultDoc.classList.add('search-result-doc-parent'); - var resultSection = document.createElement('div'); - resultSection.classList.add('search-result-section'); - resultSection.innerHTML = doc.title; - resultTitle.appendChild(resultSection); - resultDocOrSection = resultSection; - } - - var metadata = result.matchData.metadata; - var titlePositions = []; - var contentPositions = []; - for (var j in metadata) { - var meta = metadata[j]; - if (meta.title) { - var positions = meta.title.position; - for (var k in positions) { - titlePositions.push(positions[k]); - } - } - if (meta.content) { - var positions = meta.content.position; - for (var k in positions) { - var position = positions[k]; - var previewStart = position[0]; - var previewEnd = position[0] + position[1]; - var ellipsesBefore = true; - var ellipsesAfter = true; - for (var k = 0; k < {{ site.search.preview_words_before | default: 5 }}; k++) { - var nextSpace = doc.content.lastIndexOf(' ', previewStart - 2); - var nextDot = doc.content.lastIndexOf('. ', previewStart - 2); - if ((nextDot >= 0) && (nextDot > nextSpace)) { - previewStart = nextDot + 1; - ellipsesBefore = false; - break; - } - if (nextSpace < 0) { - previewStart = 0; - ellipsesBefore = false; - break; - } - previewStart = nextSpace + 1; - } - for (var k = 0; k < {{ site.search.preview_words_after | default: 10 }}; k++) { - var nextSpace = doc.content.indexOf(' ', previewEnd + 1); - var nextDot = doc.content.indexOf('. ', previewEnd + 1); - if ((nextDot >= 0) && (nextDot < nextSpace)) { - previewEnd = nextDot; - ellipsesAfter = false; - break; - } - if (nextSpace < 0) { - previewEnd = doc.content.length; - ellipsesAfter = false; - break; - } - previewEnd = nextSpace; - } - contentPositions.push({ - highlight: position, - previewStart: previewStart, previewEnd: previewEnd, - ellipsesBefore: ellipsesBefore, ellipsesAfter: ellipsesAfter - }); - } - } - } - - if (titlePositions.length > 0) { - titlePositions.sort(function(p1, p2){ return p1[0] - p2[0] }); - resultDocOrSection.innerHTML = ''; - addHighlightedText(resultDocOrSection, doc.title, 0, doc.title.length, titlePositions); - } - - if (contentPositions.length > 0) { - contentPositions.sort(function(p1, p2){ return p1.highlight[0] - p2.highlight[0] }); - var contentPosition = contentPositions[0]; - var previewPosition = { - highlight: [contentPosition.highlight], - previewStart: contentPosition.previewStart, previewEnd: contentPosition.previewEnd, - ellipsesBefore: contentPosition.ellipsesBefore, ellipsesAfter: contentPosition.ellipsesAfter - }; - var previewPositions = [previewPosition]; - for (var j = 1; j < contentPositions.length; j++) { - contentPosition = contentPositions[j]; - if (previewPosition.previewEnd < contentPosition.previewStart) { - previewPosition = { - highlight: [contentPosition.highlight], - previewStart: contentPosition.previewStart, previewEnd: contentPosition.previewEnd, - ellipsesBefore: contentPosition.ellipsesBefore, ellipsesAfter: contentPosition.ellipsesAfter - } - previewPositions.push(previewPosition); - } else { - previewPosition.highlight.push(contentPosition.highlight); - previewPosition.previewEnd = contentPosition.previewEnd; - previewPosition.ellipsesAfter = contentPosition.ellipsesAfter; - } - } - - var resultPreviews = document.createElement('div'); - resultPreviews.classList.add('search-result-previews'); - resultLink.appendChild(resultPreviews); - - var content = doc.content; - for (var j = 0; j < Math.min(previewPositions.length, {{ site.search.previews | default: 3 }}); j++) { - var position = previewPositions[j]; - - var resultPreview = document.createElement('div'); - resultPreview.classList.add('search-result-preview'); - resultPreviews.appendChild(resultPreview); - - if (position.ellipsesBefore) { - resultPreview.appendChild(document.createTextNode('... ')); - } - addHighlightedText(resultPreview, content, position.previewStart, position.previewEnd, position.highlight); - if (position.ellipsesAfter) { - resultPreview.appendChild(document.createTextNode(' ...')); - } - } - } - - {%- if site.search.rel_url != false %} - var resultRelUrl = document.createElement('span'); - resultRelUrl.classList.add('search-result-rel-url'); - resultRelUrl.innerText = doc.relUrl; - resultTitle.appendChild(resultRelUrl); - {%- endif %} - } - - function addHighlightedText(parent, text, start, end, positions) { - var index = start; - for (var i in positions) { - var position = positions[i]; - var span = document.createElement('span'); - span.innerHTML = text.substring(index, position[0]); - parent.appendChild(span); - index = position[0] + position[1]; - var highlight = document.createElement('span'); - highlight.classList.add('search-result-highlight'); - highlight.innerHTML = text.substring(position[0], index); - parent.appendChild(highlight); - } - var span = document.createElement('span'); - span.innerHTML = text.substring(index, end); - parent.appendChild(span); - } - } - - jtd.addEvent(searchInput, 'focus', function(){ - setTimeout(update, 0); - }); - - jtd.addEvent(searchInput, 'keyup', function(e){ - switch (e.keyCode) { - case 27: // When esc key is pressed, hide the results and clear the field - searchInput.value = ''; - break; - case 38: // arrow up - case 40: // arrow down - case 13: // enter - e.preventDefault(); - return; - } - update(); - }); - - jtd.addEvent(searchInput, 'keydown', function(e){ - switch (e.keyCode) { - case 38: // arrow up - e.preventDefault(); - var active = document.querySelector('.search-result.active'); - if (active) { - active.classList.remove('active'); - if (active.parentElement.previousSibling) { - var previous = active.parentElement.previousSibling.querySelector('.search-result'); - previous.classList.add('active'); - } - } - return; - case 40: // arrow down - e.preventDefault(); - var active = document.querySelector('.search-result.active'); - if (active) { - if (active.parentElement.nextSibling) { - var next = active.parentElement.nextSibling.querySelector('.search-result'); - active.classList.remove('active'); - next.classList.add('active'); - } - } else { - var next = document.querySelector('.search-result'); - if (next) { - next.classList.add('active'); - } - } - return; - case 13: // enter - e.preventDefault(); - var active = document.querySelector('.search-result.active'); - if (active) { - active.click(); - } else { - var first = document.querySelector('.search-result'); - if (first) { - first.click(); - } - } - return; - } - }); - - jtd.addEvent(document, 'click', function(e){ - if (e.target != searchInput) { - hideSearch(); - } - }); -} -{%- endif %} - -// Switch theme - -jtd.getTheme = function() { - var cssFileHref = document.querySelector('[rel="stylesheet"]').getAttribute('href'); - return cssFileHref.substring(cssFileHref.lastIndexOf('-') + 1, cssFileHref.length - 4); -} - -jtd.setTheme = function(theme) { - var cssFile = document.querySelector('[rel="stylesheet"]'); - cssFile.setAttribute('href', '{{ "assets/css/just-the-docs-" | absolute_url }}' + theme + '.css'); -} - -// Document ready - -jtd.onReady(function(){ - initNav(); - {%- if site.search_enabled != false %} - initSearch(); - {%- endif %} -}); - -})(window.jtd = window.jtd || {}); - -{% include js/custom.js %} diff --git a/bin/just-the-docs b/bin/just-the-docs deleted file mode 100755 index 5a6229030..000000000 --- a/bin/just-the-docs +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env ruby - -gem_dir = File.expand_path("..",File.dirname(__FILE__)) -$LOAD_PATH.unshift gem_dir # Look in gem directory for resources first. -exec_type = ARGV[0] - -if exec_type == 'rake' then - require 'rake' - require 'pp' - pwd=Dir.pwd - Dir.chdir(gem_dir) # We'll load rakefile from the gem's dir. - Rake.application.init - Rake.application.load_rakefile - Dir.chdir(pwd) # Revert to original pwd for any path args passed to task. - Rake.application.invoke_task(ARGV[1]) -end diff --git a/lib/tasks/search.rake b/lib/tasks/search.rake deleted file mode 100644 index 8e6305a61..000000000 --- a/lib/tasks/search.rake +++ /dev/null @@ -1,72 +0,0 @@ -namespace :search do - desc 'Generate the files needed for search functionality' - task :init do - puts 'Creating search data json file...' - mkdir_p 'assets/js' - touch 'assets/js/zzzz-search-data.json' - puts 'Done.' - puts 'Generating content...' - - File.open('assets/js/zzzz-search-data.json', 'w') do |f| - f.puts '--- -permalink: /assets/js/search-data.json ---- -{ - {%- assign i = 0 -%} - {% for page in site.html_pages %} - {%- if page.title and page.search_exclude != true -%} - {%- assign page_content = page.content -%} - {%- assign heading_level = site.search.heading_level | default: 2 -%} - {%- for j in (2..heading_level) -%} - {%- assign tag = \'\' -%} - {%- assign title = titleAndContent[0] | replace_first: \'>\', \'

\' | split: \'

\' -%} - {%- assign title = title[1] | strip_html -%} - {%- assign content = titleAndContent[1] -%} - {%- assign url = page.url -%} - {%- if title == page.title and parts[0] == \'\' -%} - {%- assign title_found = true -%} - {%- else -%} - {%- assign id = titleAndContent[0] -%} - {%- assign id = id | split: \'id="\' -%} - {%- if id.size == 2 -%} - {%- assign id = id[1] -%} - {%- assign id = id | split: \'"\' -%} - {%- assign id = id[0] -%} - {%- capture url -%}{{ url | append: \'#\' | append: id }}{%- endcapture -%} - {%- endif -%} - {%- endif -%} - {%- unless i == 0 -%},{%- endunless -%} - "{{ i }}": { - "doc": {{ page.title | jsonify }}, - "title": {{ title | jsonify }}, - "content": {{ content | replace: \'