diff --git a/_config.yml b/_config.yml index ad2ca041ee8313ea2ed250b9c19bc8bb46dd1f0c..6470c0ee00099a18540c1d4260c9fab1a3fee86e 100644 --- a/_config.yml +++ b/_config.yml @@ -24,6 +24,9 @@ exclude: ["node_modules/", "*.gemspec", "*.gem", "Gemfile", "Gemfile.lock", "pac # Enable or disable the site search search_enabled: true +# Enable or disable heading anchors +heading_anchors: true + # Aux links for the upper right navigation aux_links: "Just the Docs on GitHub": @@ -41,3 +44,11 @@ ga_tracking: UA-2709176-10 plugins: - jekyll-seo-tag + +compress_html: + clippings: all + comments: all + endings: all + startings: [] + blank_lines: false + profile: false diff --git a/_includes/head.html b/_includes/head.html index 58d211c76d9d81cf5f1fcf35c1a44427df92da68..7aa7abb8a85e13f93635e8fad3d45bf067d1e77e 100644 --- a/_includes/head.html +++ b/_includes/head.html @@ -6,13 +6,13 @@ <title>{{ page.title }} - {{ site.title }}</title> {% if page.description %} - <meta name="Description" content="{{ page.description }}"> + <meta name="Description" content="{{ page.description }}"> {% endif %} {% endif %} - <link rel="shortcut icon" href="{{ "favicon.ico" | absolute_url }}" type="image/x-icon"> + <link rel="shortcut icon" href="{{ 'favicon.ico' | absolute_url }}" type="image/x-icon"> - <link rel="stylesheet" href="{{ "/assets/css/just-the-docs.css" | absolute_url }}"> + <link rel="stylesheet" href="{{ '/assets/css/just-the-docs.css' | absolute_url }}"> {% if site.ga_tracking != nil %} <script async src="https://www.googletagmanager.com/gtag/js?id={{ site.ga_tracking }}"></script> @@ -27,11 +27,14 @@ {% endif %} {% if site.search_enabled != nil %} - <script type="text/javascript" src="{{ "/assets/js/vendor/lunr.min.js" | absolute_url }}"></script> + <script type="text/javascript" src="{{ '/assets/js/vendor/lunr.min.js' | absolute_url }}"></script> {% endif %} - <script type="text/javascript" src="{{ "/assets/js/just-the-docs.js" | absolute_url }}"></script> + <script type="text/javascript" src="{{ '/assets/js/just-the-docs.js' | absolute_url }}"></script> <meta name="viewport" content="width=device-width, initial-scale=1"> {% seo %} + + {% include head_custom.html %} + </head> diff --git a/_includes/head_custom.html b/_includes/head_custom.html new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/_includes/js/custom.js b/_includes/js/custom.js new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/_includes/title.html b/_includes/title.html new file mode 100644 index 0000000000000000000000000000000000000000..f6d566937aa74477f4d6ea6409fce0e039ce3d33 --- /dev/null +++ b/_includes/title.html @@ -0,0 +1 @@ +{{ site.title }} \ No newline at end of file diff --git a/_includes/vendor/anchor_headings.html b/_includes/vendor/anchor_headings.html new file mode 100755 index 0000000000000000000000000000000000000000..25397df93635196eeee7c23d7fbcc18d37f1db2d --- /dev/null +++ b/_includes/vendor/anchor_headings.html @@ -0,0 +1,100 @@ +{% capture headingsWorkspace %} + {% comment %} + Version 1.0.3 + https://github.com/allejo/jekyll-anchor-headings + + "Be the pull request you wish to see in the world." ~Ben Balter + + Usage: + {% include anchor_headings.html html=content %} + + Parameters: + * html (string) - the HTML of compiled markdown generated by kramdown in Jekyll + + Optional Parameters: + * beforeHeading (bool) : false - Set to true if the anchor should be placed _before_ the heading's content + * anchorBody (string) : '' - The content that will be placed inside the anchor; the `%heading%` placeholder is available + * anchorClass (string) : '' - The class(es) that will be used for each anchor. Separate multiple classes with a space + * anchorTitle (string) : '' - The `title` attribute that will be used for anchors + * h_min (int) : 1 - The minimum header level to build an anchor for; any header lower than this value will be ignored + * h_max (int) : 6 - The maximum header level to build an anchor for; any header greater than this value will be ignored + * bodyPrefix (string) : '' - Anything that should be inserted inside of the heading tag _before_ its anchor and content + * bodySuffix (string) : '' - Anything that should be inserted inside of the heading tag _after_ its anchor and content + + Output: + The original HTML with the addition of anchors inside of all of the h1-h6 headings. + {% endcomment %} + + {% assign minHeader = include.h_min | default: 1 %} + {% assign maxHeader = include.h_max | default: 6 %} + {% assign beforeHeading = include.beforeHeading %} + {% assign nodes = include.html | split: '<h' %} + + {% capture edited_headings %}{% endcapture %} + + {% for _node in nodes %} + {% capture node %}{{ _node | strip }}{% endcapture %} + + {% if node == "" %} + {% continue %} + {% endif %} + + {% assign nextChar = node | replace: '"', '' | strip | slice: 0, 1 %} + {% assign headerLevel = nextChar | times: 1 %} + + <!-- If the level is cast to 0, it means it's not a h1-h6 tag, so let's try to fix it --> + {% if headerLevel == 0 %} + {% if nextChar != '<' and nextChar != '' %} + {% capture node %}<h{{ node }}{% endcapture %} + {% endif %} + + {% capture edited_headings %}{{ edited_headings }}{{ node }}{% endcapture %} + {% continue %} + {% endif %} + + {% assign _workspace = node | split: '</h' %} + {% assign _idWorkspace = _workspace[0] | split: 'id="' %} + {% assign _idWorkspace = _idWorkspace[1] | split: '"' %} + {% assign html_id = _idWorkspace[0] %} + + {% capture _hAttrToStrip %}{{ _workspace[0] | split: '>' | first }}>{% endcapture %} + {% assign header = _workspace[0] | replace: _hAttrToStrip, '' %} + + <!-- Build the anchor to inject for our heading --> + {% capture anchor %}{% endcapture %} + + {% if html_id and headerLevel >= minHeader and headerLevel <= maxHeader %} + {% capture anchor %}href="#{{ html_id}}"{% endcapture %} + + {% if include.anchorClass %} + {% capture anchor %}{{ anchor }} class="{{ include.anchorClass }}"{% endcapture %} + {% endif %} + + {% if include.anchorTitle %} + {% capture anchor %}{{ anchor }} title="{{ include.anchorTitle | replace: '%heading%', header }}"{% endcapture %} + {% endif %} + + {% capture anchor %}<a {{ anchor }}>{{ include.anchorBody | replace: '%heading%', header | default: '' }}</a>{% endcapture %} + + <!-- In order to prevent adding extra space after a heading, we'll let the 'anchor' value contain it --> + {% if beforeHeading %} + {% capture anchor %}{{ anchor }} {% endcapture %} + {% else %} + {% capture anchor %} {{ anchor }}{% endcapture %} + {% endif %} + {% endif %} + + {% capture new_heading %} + <h{{ _hAttrToStrip }} + {{ include.bodyPrefix }} + {% if beforeHeading %} + {{ anchor }}{{ header }} + {% else %} + {{ header }}{{ anchor }} + {% endif %} + {{ include.bodySuffix }} + </h{{ _workspace | last }} + {% endcapture %} + {% capture edited_headings %}{{ edited_headings }}{{ new_heading }}{% endcapture %} + {% endfor %} +{% endcapture %}{% assign headingsWorkspace = '' %}{{ edited_headings | strip }} \ No newline at end of file diff --git a/_layouts/default.html b/_layouts/default.html index 206bcba43a1c81f92762d9bb035e54e59dc55fae..b28c413da55a1662479d4a10fca5b88c3fbe7976 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -1,3 +1,7 @@ +--- +layout: table_wrappers +--- + <!DOCTYPE html> <html lang="{{ site.lang | default: "en-US" }}"> @@ -6,22 +10,23 @@ <div class="page-wrap"> <div class="side-bar"> - <a href="{{ site.baseurl }}/" class="site-title fs-6 lh-tight">{{ site.title }}</a> - <span class="fs-3"><button class="js-main-nav-trigger navigation-list-toggle btn btn-outline" type="button" data-text-toggle="Hide">Menu</button></span> - <nav role="navigation" aria-label="Main navigation" class="navigation-wrapper"> - <div class="navigation main-nav js-main-nav"> - {% include nav.html %} - </div> - <footer class="site-footer"> - <p class="text-small text-grey-dk-000 mb-4">This site uses <a href="https://github.com/pmarsceill/just-the-docs">Just the Docs</a>, a documentation theme for Jekyll.</p> - </footer> - </nav> + <div class="site-header"> + <a href="{{ site.url }}{{ site.baseurl }}" class="site-title">{% include title.html %}</a> + <button class="menu-button fs-3 js-main-nav-trigger" data-text-toggle="Hide" type="button">Menu</button> + </div> + + <div class="navigation main-nav js-main-nav"> + {% include nav.html %} + </div> + <footer class="site-footer"> + <p class="text-small text-grey-dk-000 mb-4">This site uses <a href="https://github.com/pmarsceill/just-the-docs">Just the Docs</a>, a documentation theme for Jekyll.</p> + </footer> </div> <div class="main-content-wrap js-main-content" tabindex="0"> - <div class="page-header"> - <div class="main-content"> + <div class="main-content"> + <div class="page-header js-page-header"> {% if site.search_enabled != nil %} - <div class="search js-search"> + <div class="search"> <div class="search-input-wrap"> <input type="text" class="js-search-input search-input" tabindex="0" placeholder="Search {{ site.title }}" aria-label="Search {{ site.title }}" autocomplete="off"> <svg width="14" height="14" viewBox="0 0 28 28" xmlns="http://www.w3.org/2000/svg" class="search-icon"><title>Search</title><g fill-rule="nonzero"><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> @@ -30,54 +35,58 @@ </div> {% endif %} {% if site.aux_links != nil %} - <ul class="list-style-none text-small mt-md-1 mb-md-1 pb-4 pb-md-0 js-aux-nav aux-nav"> + <ul class="list-style-none text-small aux-nav"> {% for link in site.aux_links %} <li class="d-inline-block my-0{% unless forloop.last %} mr-2{% endunless %}"><a href="{{ link.last }}">{{ link.first }}</a></li> {% endfor %} </ul> {% endif %} </div> - </div> - <div class="main-content"> - {% unless page.url == "/" %} - {% if page.parent %} - <nav class="breadcrumb-nav"> - <ol class="breadcrumb-nav-list"> - {% if page.grand_parent %} - <li class="breadcrumb-nav-list-item"><a href="{{ first_level_url }}">{{ page.grand_parent }}</a></li> - <li class="breadcrumb-nav-list-item"><a href="{{ second_level_url }}">{{ page.parent }}</a></li> - {% else %} - <li class="breadcrumb-nav-list-item"><a href="{{ first_level_url }}">{{ page.parent }}</a></li> - {% endif %} - <li class="breadcrumb-nav-list-item"><span>{{ page.title }}</span></li> - </ol> - </nav> - {% endif %} - {% endunless %} - <div id="main-content" class="page-content" role="main"> - {{ content }} + <div class="page"> + {% unless page.url == "/" %} + {% if page.parent %} + <nav class="breadcrumb-nav"> + <ol class="breadcrumb-nav-list"> + {% if page.grand_parent %} + <li class="breadcrumb-nav-list-item"><a href="{{ first_level_url }}">{{ page.grand_parent }}</a></li> + <li class="breadcrumb-nav-list-item"><a href="{{ second_level_url }}">{{ page.parent }}</a></li> + {% else %} + <li class="breadcrumb-nav-list-item"><a href="{{ first_level_url }}">{{ page.parent }}</a></li> + {% endif %} + <li class="breadcrumb-nav-list-item"><span>{{ page.title }}</span></li> + </ol> + </nav> + {% endif %} + {% endunless %} + <div id="main-content" class="page-content" role="main"> + {% if site.heading_anchors != nil %} + {% include vendor/anchor_headings.html html=content beforeHeading = "true" anchorBody="<svg class=\"d-inline-block v-align-middle\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"18\" height=\"18\" aria-hidden=\"true\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg>" anchorClass="anchor-heading" %} + {% else %} + {{ content }} + {% endif %} {% if page.has_children == true and page.has_toc != false %} - <hr> - <h2 class="text-delta">Table of contents</h2> - {% assign children_list = site.pages | sort:"nav_order" %} - <ul> - {% for child in children_list %} - {% if child.parent == page.title and child.title != page.title %} - <li> - <a href="{{ child.url | absolute_url }}">{{ child.title }}</a> - </li> - {% endif %} - {% endfor %} - </ul> + <hr> + <h2 class="text-delta">Table of contents</h2> + {% assign children_list = site.pages | sort:"nav_order" %} + <ul> + {% for child in children_list %} + {% if child.parent == page.title and child.title != page.title %} + <li> + <a href="{{ child.url | absolute_url }}">{{ child.title }}</a> + </li> + {% endif %} + {% endfor %} + </ul> {% endif %} {% if site.footer_content != nil %} - <hr> - <footer role="contentinfo"> - <p class="text-small text-grey-dk-000 mb-0">{{ site.footer_content }}</p> - </footer> + <hr> + <footer role="contentinfo"> + <p class="text-small text-grey-dk-000 mb-0">{{ site.footer_content }}</p> + </footer> {% endif %} + </div> </div> </div> diff --git a/_layouts/table_wrappers.html b/_layouts/table_wrappers.html new file mode 100644 index 0000000000000000000000000000000000000000..cc6187addf3034552467d9841b89b40404a9a631 --- /dev/null +++ b/_layouts/table_wrappers.html @@ -0,0 +1,7 @@ +--- +layout: vendor/compress +--- + +{% assign content_ = content | replace: '<table', '<div class="table-wrapper"><table' %} +{% assign content_ = content_ | replace: '</table>', '</table></div>' %} +{{ content_ }} \ No newline at end of file diff --git a/_layouts/vendor/compress.html b/_layouts/vendor/compress.html new file mode 100644 index 0000000000000000000000000000000000000000..bb34487d2a7560006f1ece3831335d1882ec5aa4 --- /dev/null +++ b/_layouts/vendor/compress.html @@ -0,0 +1,10 @@ +--- +# Jekyll layout that compresses HTML +# v3.1.0 +# http://jch.penibelst.de/ +# © 2014–2015 Anatol Broder +# MIT License +--- + +{% capture _LINE_FEED %} +{% endcapture %}{% if site.compress_html.ignore.envs contains jekyll.environment or site.compress_html.ignore.envs == "all" %}{{ content }}{% else %}{% capture _content %}{{ content }}{% endcapture %}{% assign _profile = site.compress_html.profile %}{% if site.compress_html.endings == "all" %}{% assign _endings = "html head body li dt dd optgroup option colgroup caption thead tbody tfoot tr td th" | split: " " %}{% else %}{% assign _endings = site.compress_html.endings %}{% endif %}{% for _element in _endings %}{% capture _end %}</{{ _element }}>{% endcapture %}{% assign _content = _content | remove: _end %}{% endfor %}{% if _profile and _endings %}{% assign _profile_endings = _content | size | plus: 1 %}{% endif %}{% for _element in site.compress_html.startings %}{% capture _start %}<{{ _element }}>{% endcapture %}{% assign _content = _content | remove: _start %}{% endfor %}{% if _profile and site.compress_html.startings %}{% assign _profile_startings = _content | size | plus: 1 %}{% endif %}{% if site.compress_html.comments == "all" %}{% assign _comments = "<!-- -->" | split: " " %}{% else %}{% assign _comments = site.compress_html.comments %}{% endif %}{% if _comments.size == 2 %}{% capture _comment_befores %}.{{ _content }}{% endcapture %}{% assign _comment_befores = _comment_befores | split: _comments.first %}{% for _comment_before in _comment_befores %}{% if forloop.first %}{% continue %}{% endif %}{% capture _comment_outside %}{% if _carry %}{{ _comments.first }}{% endif %}{{ _comment_before }}{% endcapture %}{% capture _comment %}{% unless _carry %}{{ _comments.first }}{% endunless %}{{ _comment_outside | split: _comments.last | first }}{% if _comment_outside contains _comments.last %}{{ _comments.last }}{% assign _carry = false %}{% else %}{% assign _carry = true %}{% endif %}{% endcapture %}{% assign _content = _content | remove_first: _comment %}{% endfor %}{% if _profile %}{% assign _profile_comments = _content | size | plus: 1 %}{% endif %}{% endif %}{% assign _pre_befores = _content | split: "<pre" %}{% assign _content = "" %}{% for _pre_before in _pre_befores %}{% assign _pres = _pre_before | split: "</pre>" %}{% assign _pres_after = "" %}{% if _pres.size != 0 %}{% if site.compress_html.blanklines %}{% assign _lines = _pres.last | split: _LINE_FEED %}{% capture _pres_after %}{% for _line in _lines %}{% assign _trimmed = _line | split: " " | join: " " %}{% if _trimmed != empty or forloop.last %}{% unless forloop.first %}{{ _LINE_FEED }}{% endunless %}{{ _line }}{% endif %}{% endfor %}{% endcapture %}{% else %}{% assign _pres_after = _pres.last | split: " " | join: " " %}{% endif %}{% endif %}{% capture _content %}{{ _content }}{% if _pre_before contains "</pre>" %}<pre{{ _pres.first }}</pre>{% endif %}{% unless _pre_before contains "</pre>" and _pres.size == 1 %}{{ _pres_after }}{% endunless %}{% endcapture %}{% endfor %}{% if _profile %}{% assign _profile_collapse = _content | size | plus: 1 %}{% endif %}{% if site.compress_html.clippings == "all" %}{% assign _clippings = "html head title base link meta style body article section nav aside h1 h2 h3 h4 h5 h6 hgroup header footer address p hr blockquote ol ul li dl dt dd figure figcaption main div table caption colgroup col tbody thead tfoot tr td th" | split: " " %}{% else %}{% assign _clippings = site.compress_html.clippings %}{% endif %}{% for _element in _clippings %}{% assign _edges = " <e;<e; </e>;</e>;</e> ;</e>" | replace: "e", _element | split: ";" %}{% assign _content = _content | replace: _edges[0], _edges[1] | replace: _edges[2], _edges[3] | replace: _edges[4], _edges[5] %}{% endfor %}{% if _profile and _clippings %}{% assign _profile_clippings = _content | size | plus: 1 %}{% endif %}{{ _content }}{% if _profile %} <table id="compress_html_profile_{{ site.time | date: "%Y%m%d" }}" class="compress_html_profile"> <thead> <tr> <td>Step <td>Bytes <tbody> <tr> <td>raw <td>{{ content | size }}{% if _profile_endings %} <tr> <td>endings <td>{{ _profile_endings }}{% endif %}{% if _profile_startings %} <tr> <td>startings <td>{{ _profile_startings }}{% endif %}{% if _profile_comments %} <tr> <td>comments <td>{{ _profile_comments }}{% endif %}{% if _profile_collapse %} <tr> <td>collapse <td>{{ _profile_collapse }}{% endif %}{% if _profile_clippings %} <tr> <td>clippings <td>{{ _profile_clippings }}{% endif %} </table>{% endif %}{% endif %} diff --git a/_sass/buttons.scss b/_sass/buttons.scss index 05db0ed9015e1a1142d211b6464f95d812fe7d68..57660e05ce726ea866d4bd309819b36db8ea7f3a 100644 --- a/_sass/buttons.scss +++ b/_sass/buttons.scss @@ -21,7 +21,7 @@ cursor: pointer; background-color: $base-button-color; border-width: 0; - border-radius: 3px; + border-radius: $border-radius; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12), 0 3px 10px rgba(0, 0, 0, 0.08); appearance: none; diff --git a/_sass/color_schemes/dark.scss b/_sass/color_schemes/dark.scss index 6c2e8a9caabfbfa35c6101b769c24ace2d23e7f4..f0e65057c864918b5b1f103876862b6892b579c7 100644 --- a/_sass/color_schemes/dark.scss +++ b/_sass/color_schemes/dark.scss @@ -6,9 +6,12 @@ $border-color: $grey-dk-200; $body-text-color: $grey-lt-300; $body-heading-color: $grey-lt-000; $nav-child-link-color: $grey-dk-000; +$search-result-preview-color: $grey-dk-000; $link-color: $blue-000; $btn-primary-color: $blue-200; $base-button-color: $grey-dk-250; $code-background-color: $grey-dk-250; +$search-background-color: $grey-dk-250; +$table-background-color: $grey-dk-250; diff --git a/_sass/content.scss b/_sass/content.scss index 7361bfc5101ad9b40a1d44c09c9926b8a23aa12c..96b0659be5323f37f65a0e8a625f418e2ed8e648 100644 --- a/_sass/content.scss +++ b/_sass/content.scss @@ -6,6 +6,8 @@ // stylelint-disable selector-no-type, max-nesting-depth, selector-max-compound-selectors, selector-max-type .page-content { + line-height: $content-line-height; + a { overflow: hidden; text-overflow: ellipsis; @@ -111,4 +113,36 @@ margin-left: 1em; font-weight: 500; } + + .anchor-heading { + position: absolute; + right: -$sp-3; + width: $sp-5; + height: 100%; + fill: $link-color; + visibility: hidden; + + @include mq(md) { + right: auto; + left: -$sp-5; + } + } + + h1:hover > .anchor-heading, + h2:hover > .anchor-heading, + h3:hover > .anchor-heading, + h4:hover > .anchor-heading, + h5:hover > .anchor-heading, + h6:hover > .anchor-heading { + visibility: visible; + } + + h1, + h2, + h3, + h4, + h5, + h6 { + position: relative; + } } diff --git a/_sass/custom/custom.scss b/_sass/custom/custom.scss index 82064a55700a2194eabb21c1357a191535a17950..9ac503b64b875103c2b99d2d8cde8bb91c49ca78 100644 --- a/_sass/custom/custom.scss +++ b/_sass/custom/custom.scss @@ -1,120 +1,129 @@ -// // -// // Typography -// // -// -// $body-font-family: -apple-system, BlinkMacSystemFont, "helvetica neue", helvetica, roboto, noto, "segoe ui", arial, sans-serif; -// $mono-font-family: "SFMono-Regular", Menlo, Consolas, Monospace; -// $root-font-size: 16px; // Base font-size for rems -// $body-line-height: 1.4; -// $body-heading-line-height: 1.15; -// -// // -// // Colors -// // -// -// $white: #fff; -// -// $grey-dk-000: #959396; -// $grey-dk-100: #5c5962; -// $grey-dk-200: #44434d; -// $grey-dk-250: #302d36 !default; -// $grey-dk-300: #27262b; -// -// $grey-lt-000: #f5f6fa; -// $grey-lt-100: #eeebee; -// $grey-lt-200: #ecebed; -// $grey-lt-300: #e6e1e8; -// -// $purple-000: #7253ed; -// $purple-100: #5e41d0; -// $purple-200: #4e26af; -// $purple-300: #381885; -// -// $blue-000: #2c84fa; -// $blue-100: #2869e6; -// $blue-200: #264caf; -// $blue-300: #183385; -// -// $green-000: #41d693; -// $green-100: #11b584; -// $green-200: #009c7b; -// $green-300: #026e57; -// -// $body-background-color: $white !default; -// $sidebar-color: $grey-lt-000 !default; -// $code-background-color: $grey-lt-000 !default; - -// $body-text-color: $grey-dk-100 !default; -// $body-heading-color: $grey-dk-300 !default; -// $nav-child-link-color: $grey-dk-100 !default; -// $link-color: $purple-000 !default; -// $btn-primary-color: $purple-100 !default; -// $base-button-color: #f7f7f7 !default; -// -// // -// // Media queries in pixels -// // -// -// $media-queries: ( -// xs: 320px, -// sm: 500px, -// md: 740px, -// lg: 1120px, -// xl: 1400px -// ); -// -// // -// // Spacing -// // -// -// $spacing-unit: 1rem; // 1rem == 16px -// -// $spacers: ( -// sp-0: 0, -// sp-1: $spacing-unit * 0.25, -// sp-2: $spacing-unit * 0.5, -// sp-3: $spacing-unit * 0.75, -// sp-4: $spacing-unit, -// sp-5: $spacing-unit * 1.5, -// sp-6: $spacing-unit * 2, -// sp-7: $spacing-unit * 2.5, -// sp-8: $spacing-unit * 3, -// sp-9: $spacing-unit * 3.5, -// sp-10: $spacing-unit * 4 -// ); -// -// $sp-1: map-get($spacers, sp-1); // 0.25 rem == 4px -// $sp-2: map-get($spacers, sp-2); // 0.5 rem == 8px -// $sp-3: map-get($spacers, sp-3); // 0.75 rem == 12px -// $sp-4: map-get($spacers, sp-4); // 1 rem == 16px -// $sp-5: map-get($spacers, sp-5); // 1.5 rem == 24px -// $sp-6: map-get($spacers, sp-6); // 2 rem == 32px -// $sp-7: map-get($spacers, sp-7); // 2.5 rem == 40px -// $sp-8: map-get($spacers, sp-8); // 3 rem == 48px -// $sp-9: map-get($spacers, sp-9); // 4 rem == 48px -// $sp-10: map-get($spacers, sp-10); // 4.5 rem == 48px -// -// // -// // Borders -// // -// -// $border: 1px solid; -// $border-radius: 4px; -// $border-color: $grey-lt-100; -// -// // -// // Grid system -// // -// -// $gutter-spacing: $sp-6; -// $gutter-spacing-sm: $sp-4; -// $nav-width: 232px; -// $content-width: 800px; -// -// $media-queries: ( -// xs: 320px, -// sm: 500px, -// md: 740px, -// lg: 800px, -// xl: 1316px -// ); +//// +//// Typography +//// + +//$body-font-family: -apple-system, BlinkMacSystemFont, "helvetica neue", helvetica, roboto, noto, "segoe ui", arial, sans-serif; +//$mono-font-family: "SFMono-Regular", Menlo, Consolas, Monospace; +//$root-font-size: 16px; // Base font-size for rems +//$body-line-height: 1.4; +//$content-line-height: 1.5; +//$body-heading-line-height: 1.15; + +//// +//// Colors +//// + +//$white: #fff; + +//$grey-dk-000: #959396; +//$grey-dk-100: #5c5962; +//$grey-dk-200: #44434d; +//$grey-dk-250: #302d36; +//$grey-dk-300: #27262b; + +//$grey-lt-000: #f5f6fa; +//$grey-lt-100: #eeebee; +//$grey-lt-200: #ecebed; +//$grey-lt-300: #e6e1e8; + +//$purple-000: #7253ed; +//$purple-100: #5e41d0; +//$purple-200: #4e26af; +//$purple-300: #381885; + +//$blue-000: #2c84fa; +//$blue-100: #2869e6; +//$blue-200: #264caf; +//$blue-300: #183385; + +//$green-000: #41d693; +//$green-100: #11b584; +//$green-200: #009c7b; +//$green-300: #026e57; + +//$yellow-000: #ffeb82; +//$yellow-100: #fadf50; +//$yellow-200: #f7d12e; +//$yellow-300: #e7af06; + +//$red-000: #f77e7e; +//$red-100: #f96e65; +//$red-200: #e94c4c; +//$red-300: #dd2e2e; + +//$body-background-color: $white; +//$sidebar-color: $grey-lt-000; +//$search-background-color: $white; +//$table-background-color: $white; +//$code-background-color: $grey-lt-000; + +//$body-text-color: $grey-dk-100; +//$body-heading-color: $grey-dk-300; +//$search-result-preview-color: $grey-dk-000; +//$nav-child-link-color: $grey-dk-100; +//$link-color: $purple-000; +//$btn-primary-color: $purple-100; +//$base-button-color: #f7f7f7; + +//// +//// Spacing +//// + +//$spacing-unit: 1rem; // 1rem == 16px + +//$spacers: ( +//sp-0: 0, +//sp-1: $spacing-unit * 0.25, +//sp-2: $spacing-unit * 0.5, +//sp-3: $spacing-unit * 0.75, +//sp-4: $spacing-unit, +//sp-5: $spacing-unit * 1.5, +//sp-6: $spacing-unit * 2, +//sp-7: $spacing-unit * 2.5, +//sp-8: $spacing-unit * 3, +//sp-9: $spacing-unit * 3.5, +//sp-10: $spacing-unit * 4 +//); + +//$sp-1: map-get($spacers, sp-1); // 0.25 rem == 4px +//$sp-2: map-get($spacers, sp-2); // 0.5 rem == 8px +//$sp-3: map-get($spacers, sp-3); // 0.75 rem == 12px +//$sp-4: map-get($spacers, sp-4); // 1 rem == 16px +//$sp-5: map-get($spacers, sp-5); // 1.5 rem == 24px +//$sp-6: map-get($spacers, sp-6); // 2 rem == 32px +//$sp-7: map-get($spacers, sp-7); // 2.5 rem == 40px +//$sp-8: map-get($spacers, sp-8); // 3 rem == 48px +//$sp-9: map-get($spacers, sp-9); // 4 rem == 48px +//$sp-10: map-get($spacers, sp-10); // 4.5 rem == 48px + +//// +//// Borders +//// + +//$border: 1px solid; +//$border-radius: 4px; +//$border-color: $grey-lt-100; + +//// +//// Grid system +//// + +//$gutter-spacing: $sp-6; +//$gutter-spacing-sm: $sp-4; +//$nav-width: 264px; +//$nav-width-md: 248px; +//$content-width: 800px; +//$header-height: 60px; +//$search-results-width: 500px; + +//// +//// Media queries in pixels +//// + +//$media-queries: ( +//xs: 320px, +//sm: 500px, +//md: $content-width, +//lg: $content-width + $nav-width, +//xl: 1400px +//); diff --git a/_sass/layout.scss b/_sass/layout.scss index 79268795fae04bdae487f68b3aeebd13cc334d9f..4c214ea44e75562c109a45cebb00c38b680c0ce8 100644 --- a/_sass/layout.scss +++ b/_sass/layout.scss @@ -19,17 +19,13 @@ z-index: 100; display: flex; flex-wrap: wrap; - padding-top: $gutter-spacing-sm; - padding-bottom: $gutter-spacing-sm; background-color: $sidebar-color; @include mq(md) { flex-wrap: nowrap; position: absolute; - width: $nav-width + 16px; + width: $nav-width-md; height: 100%; - padding-top: $gutter-spacing * 2; - padding-bottom: 0; flex-direction: column; border-right: $border $border-color; align-items: flex-end; @@ -48,7 +44,6 @@ left: 0; width: 100%; height: 100%; - min-height: 600px; -webkit-overflow-scrolling: touch; overflow-x: hidden; overflow-y: scroll; @@ -56,20 +51,13 @@ } .main-content { - padding-top: $gutter-spacing-sm; - @include container; - @include mq(md) { position: relative; max-width: $content-width; - padding-top: $gutter-spacing; - padding-bottom: $gutter-spacing; - padding-left: $gutter-spacing * 1.5; - margin-left: $nav-width; + margin-left: $nav-width-md; } @include mq(lg) { - padding-left: $gutter-spacing; margin-left: calc((100% - #{$nav-width + $content-width}) / 2 + #{$nav-width}); } } @@ -78,48 +66,104 @@ outline: none; } +.page { + @include container; + padding-top: $gutter-spacing-sm; + padding-bottom: $gutter-spacing-sm; + + @include mq(md) { + padding-top: $gutter-spacing; + padding-bottom: $gutter-spacing; + } +} + .page-header { + @include container; + display: none; + padding-top: $gutter-spacing-sm; + padding-bottom: $gutter-spacing-sm; background-color: $sidebar-color; @include mq(md) { + display: flex; + justify-content: flex-end; + height: $header-height; background-color: $body-background-color; + border-bottom: $border $border-color; } - .main-content { - padding-top: 0; + &.nav-open { + display: block; @include mq(md) { display: flex; - justify-content: flex-end; - height: 60px; - padding-top: $sp-4; - padding-bottom: $sp-4; - border-bottom: $border $border-color; } } } .navigation, -.site-title, +.site-header, .site-footer { - @include container; - width: 100%; @include mq(lg) { - width: $nav-width + 32px; + width: $nav-width; } } .navigation { + @include container; + @include mq(md) { padding-top: $sp-8; + padding-bottom: $gutter-spacing-sm; overflow-y: auto; flex: 1 1 auto; } } +.site-header { + display: flex; + align-items: center; + + @include mq(md) { + z-index: 101; + height: $header-height; + min-height: $header-height; + max-height: $header-height; + border-bottom: $border $border-color; + } +} + +.site-title { + @include container; + flex-grow: 1; + display: flex; + height: 100%; + align-items: center; + padding-top: $gutter-spacing-sm; + padding-bottom: $gutter-spacing-sm; + color: $body-heading-color; + @include fs-6; +} + +.menu-button { + appearance: none; + display: flex; + height: 100%; + padding: $gutter-spacing-sm; + align-items: center; + color: $link-color; + text-transform: uppercase; + background: transparent; + border: 0; + + @include mq(md) { + display: none; + } +} + // stylelint-disable selector-max-type body { @@ -135,6 +179,7 @@ body { // stylelint-enable selector-max-type .site-footer { + @include container; position: absolute; bottom: 0; left: 0; @@ -143,8 +188,6 @@ body { @include mq(md) { position: static; - align-self: flex-end; justify-self: end; - background-color: $sidebar-color; } } diff --git a/_sass/navigation.scss b/_sass/navigation.scss index 6d276b219d19b49b2797f1df001648aebeca52b8..c77490437b280e519fd7916d6dcad1244f4f63b7 100644 --- a/_sass/navigation.scss +++ b/_sass/navigation.scss @@ -1,39 +1,11 @@ // // Main nav, breadcrumb, etc... // - -.site-title { - display: block; - flex: 1 1 auto; - color: $body-heading-color; - background-color: $sidebar-color; - - @include mq(md) { - position: absolute; - top: 0; - right: 0; - z-index: 101; - height: 60px; - padding-top: $sp-4; - border-bottom: $border $border-color; - } -} - -.navigation-wrapper { - display: flex; - flex-direction: column; - flex: 1 1 auto; -} - .navigation-list { padding: 0; - margin-top: $sp-4; + margin-top: 0; margin-bottom: 0; list-style: none; - - @include mq(md) { - margin-top: 0; - } } .navigation-list-child-list { @@ -96,8 +68,7 @@ // Small screen nav -.main-nav, -.aux-nav { +.main-nav { display: none; &.nav-open { @@ -108,13 +79,8 @@ } } -.navigation-list-toggle { - position: absolute; - right: $sp-4; - - @include mq(md) { - display: none !important; - } +.aux-nav { + align-self: center; } // Breadcrumb nav diff --git a/_sass/search.scss b/_sass/search.scss index 32ec1dbe225ecc5f1ca4f09fe3eb3522ccb9bfb7..bef2df733563e250e92f80bc97d39ef197bb0fa8 100644 --- a/_sass/search.scss +++ b/_sass/search.scss @@ -5,60 +5,46 @@ .search { position: relative; z-index: 99; - display: none; flex-grow: 1; - padding: $sp-2; + height: 100%; margin-bottom: $sp-3; - background-color: $white; - border-radius: 3px; - box-shadow: 0 1px 2px rgba(0, 0, 0, 0.07), 0 3px 10px rgba(0, 0, 0, 0.05); @include mq(md) { - display: block; - padding-top: $sp-1; - padding-right: 0; - padding-bottom: 0; - padding-left: 0; margin-bottom: 0; - background-color: transparent; - box-shadow: none; - } - - &.nav-open { - display: block; - } -} - -.search-results-wrap { - display: none; - - &.active { - position: absolute; - top: $sp-1; - z-index: 100; - display: block; - width: 300px; - margin-top: $gutter-spacing; - background: lighten($body-background-color, 1%); - box-shadow: 0 1px 3px rgba(0, 0, 0, 0.07), 0 4px 14px rgba(0, 0, 0, 0.05); } } .search-input-wrap { display: flex; - background-color: $body-background-color; + height: 100%; + padding: $sp-2; + background-color: $search-background-color; + border-radius: $border-radius; + box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12), 0 3px 10px rgba(0, 0, 0, 0.08); + + @include mq(md) { + padding-top: 0; + padding-right: 0; + padding-bottom: 0; + padding-left: 0; + background-color: $body-background-color; + border-radius: 0; + box-shadow: none; + } } .search-input { + align-self: center; width: 100%; padding-top: $sp-1; padding-bottom: $sp-1; - background-color: $body-background-color; + background-color: $search-background-color; border-top: 0; border-right: 0; border-bottom: 0; border-left: 0; order: 2; + @include fs-4; &:focus { outline: 0; @@ -69,14 +55,9 @@ } } - @include fs-5; - - @include mq(sm) { - @include fs-3; - } - @include mq(md) { - @include fs-2; + background-color: $body-background-color; + @include fs-3; } } @@ -87,12 +68,34 @@ order: 1; } +.search-results-wrap { + position: absolute; + z-index: 100; + display: none; + width: 100%; + background: $search-background-color; + border-radius: $border-radius; + box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12), 0 3px 10px rgba(0, 0, 0, 0.08); + + &.active { + display: block; + } + + @include mq(md) { + width: $search-results-width; + } +} + .search-results-list { padding-left: 0; margin-top: $sp-1; margin-bottom: $sp-1; list-style: none; - @include fs-3; + @include fs-4; + + @include mq(md) { + @include fs-3; + } } .search-results-list-item { @@ -100,15 +103,65 @@ margin: 0; } -.search-results-link { +.search-result { display: block; padding-top: $sp-1; padding-right: $sp-3; padding-bottom: $sp-1; padding-left: $sp-3; - &:hover { - color: $body-heading-color; - background-color: darken($body-background-color, 2%); + &:hover, + &.active { + background-color: $sidebar-color; + } + + @include mq(md) { + padding-right: $sp-4; + padding-left: $sp-4; } } + +.search-result-title { + display: block; + padding-top: $sp-2; + padding-right: $sp-4; + padding-bottom: $sp-2; + + @include mq(sm) { + display: inline-block; + width: 40%; + word-wrap: break-word; + vertical-align: top; + } +} + +.search-result-rel-url { + display: block; + overflow: hidden; + color: $search-result-preview-color; + text-overflow: ellipsis; + white-space: nowrap; + @include fs-1; +} + +.search-result-preview { + display: block; + padding-top: $sp-2; + padding-bottom: $sp-2; + padding-left: $sp-4; + color: $search-result-preview-color; + border-left: $border; + border-left-color: $border-color; + @include fs-2; + + @include mq(sm) { + display: inline-block; + width: 60%; + vertical-align: top; + } +} + +.search-result-highlight { + font-weight: bold; + color: $link-color; +} diff --git a/_sass/support/_variables.scss b/_sass/support/_variables.scss index 8a09eda365c8675d38387928e96a0852e70be8bc..127c0e297aca01b00ba730576639b67f55051377 100644 --- a/_sass/support/_variables.scss +++ b/_sass/support/_variables.scss @@ -6,6 +6,7 @@ $body-font-family: -apple-system, BlinkMacSystemFont, "helvetica neue", helvetic $mono-font-family: "SFMono-Regular", Menlo, Consolas, Monospace !default; $root-font-size: 16px !default; // Base font-size for rems $body-line-height: 1.4 !default; +$content-line-height: 1.5 !default; $body-heading-line-height: 1.15 !default !default; // @@ -52,27 +53,18 @@ $red-300: #dd2e2e !default; $body-background-color: $white !default; $sidebar-color: $grey-lt-000 !default; +$search-background-color: $white !default; +$table-background-color: $white !default; $code-background-color: $grey-lt-000 !default; $body-text-color: $grey-dk-100 !default; $body-heading-color: $grey-dk-300 !default; +$search-result-preview-color: $grey-dk-000 !default; $nav-child-link-color: $grey-dk-100 !default; $link-color: $purple-000 !default; $btn-primary-color: $purple-100 !default; $base-button-color: #f7f7f7 !default; -// -// Media queries in pixels -// - -$media-queries: ( - xs: 320px, - sm: 500px, - md: 740px, - lg: 1120px, - xl: 1400px -) !default; - // // Spacing // @@ -118,13 +110,20 @@ $border-color: $grey-lt-100 !default; $gutter-spacing: $sp-6 !default; $gutter-spacing-sm: $sp-4 !default; -$nav-width: 232px !default; +$nav-width: 264px !default; +$nav-width-md: 248px !default; $content-width: 800px !default; +$header-height: 60px !default; +$search-results-width: 500px !default; + +// +// Media queries in pixels +// $media-queries: ( xs: 320px, sm: 500px, - md: 740px, - lg: 800px, - xl: 1316px + md: $content-width, + lg: $content-width + $nav-width, + xl: 1400px ) !default; diff --git a/_sass/tables.scss b/_sass/tables.scss index 39bc0dc38e9dcd5a30b1f0969db3537fd34b8a16..b2ac7cdb8fa187c7a1a4542cf51a0855d6c82d22 100644 --- a/_sass/tables.scss +++ b/_sass/tables.scss @@ -3,18 +3,20 @@ // // stylelint-disable max-nesting-depth, selector-no-type, selector-max-type -table { +.table-wrapper { display: block; width: 100%; max-width: 100%; margin-bottom: $sp-5; overflow-x: auto; - border-collapse: separate; - box-shadow: 0 1px 3px rgba(0, 0, 0, 0.07), 0 4px 14px rgba(0, 0, 0, 0.05); + border-radius: $border-radius; + box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12), 0 3px 10px rgba(0, 0, 0, 0.08); +} - @include mq(sm) { - display: table; - } +table { + display: table; + min-width: 100%; + border-collapse: separate; } th, @@ -25,7 +27,7 @@ td { padding-right: $sp-3; padding-bottom: $sp-2; padding-left: $sp-3; - background-color: lighten($body-background-color, 2%); + background-color: $table-background-color; border-bottom: $border rgba($border-color, 0.5); border-left: $border $border-color; @@ -34,38 +36,16 @@ td { } } -thead, -tbody:first-child { - tr { - &:first-of-type { - th, - td { - &:first-of-type { - border-top-left-radius: $border-radius; - } - - &:last-of-type { - border-top-right-radius: $border-radius; - } - } - } - } -} - tbody { tr { &:last-of-type { th, td { border-bottom: 0; + } - &:first-of-type { - border-bottom-left-radius: $border-radius; - } - - &:last-of-type { - border-bottom-right-radius: $border-radius; - } + td { + padding-bottom: $sp-3; } } } @@ -73,6 +53,6 @@ tbody { thead { th { - border-bottom: 1px solid $border-color; + border-bottom: $border $border-color; } } diff --git a/assets/js/just-the-docs.js b/assets/js/just-the-docs.js index b3fca27ade7afc5dae388fba003f6e7664b3f304..aadbf82670d9386ccf8315378d4be7265bb87ff6 100644 --- a/assets/js/just-the-docs.js +++ b/assets/js/just-the-docs.js @@ -1,28 +1,41 @@ +--- +--- +(function (jtd, undefined) { + // Event handling -function addEvent(el, type, handler) { - if (el.attachEvent) el.attachEvent('on'+type, handler); else el.addEventListener(type, handler); +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); } -function removeEvent(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 toggleNav(){ - const nav = document.querySelector('.js-main-nav'); - const auxNav = document.querySelector('.js-aux-nav'); +function initNav() { + const mainNav = document.querySelector('.js-main-nav'); + const pageHeader = document.querySelector('.js-page-header'); const navTrigger = document.querySelector('.js-main-nav-trigger'); - const search = document.querySelector('.js-search'); - addEvent(navTrigger, 'click', function(){ + jtd.addEvent(navTrigger, 'click', function(e){ + e.preventDefault(); var text = navTrigger.innerText; var textToggle = navTrigger.getAttribute('data-text-toggle'); - nav.classList.toggle('nav-open'); - auxNav.classList.toggle('nav-open'); + mainNav.classList.toggle('nav-open'); + pageHeader.classList.toggle('nav-open'); navTrigger.classList.toggle('nav-open'); - search.classList.toggle('nav-open'); navTrigger.innerText = textToggle; navTrigger.setAttribute('data-text-toggle', text); textToggle = text; @@ -32,119 +45,230 @@ function toggleNav(){ // Site search function initSearch() { - var index = lunr(function () { - this.ref('id'); - this.field('title', { boost: 20 }); - this.field('content', { boost: 10 }); - this.field('url'); - }); - - // Get the generated search_data.json file so lunr.js can search it locally. - - sc = document.getElementsByTagName("script"); - source = ''; - - for(idx = 0; idx < sc.length; idx++) - { - s = sc.item(idx); - - if(s.src && s.src.match(/just-the-docs\.js$/)) - { source = s.src; } - } - - jsPath = source.replace('just-the-docs.js', ''); - - jsonPath = jsPath + 'search-data.json'; - var request = new XMLHttpRequest(); - request.open('GET', jsonPath, true); + request.open('GET', '{{ "assets/js/search-data.json" | absolute_url }}', true); - request.onload = function() { + request.onload = function(){ if (request.status >= 200 && request.status < 400) { // Success! var data = JSON.parse(request.responseText); - var keys = Object.keys(data); - - for(var i in data) { - index.add({ - id: data[i].id, - title: data[i].title, - content: data[i].content, - url: data[i].url - }); - } - searchResults(data); + + lunr.tokenizer.separator = /[\s\-/]+/ + var index = lunr(function () { + this.ref('id'); + this.field('title', { boost: 200 }); + this.field('content', { boost: 2 }); + this.field('url'); + this.metadataWhitelist = ['position'] + + for (var i in data) { + this.add({ + id: i, + title: data[i].title, + content: data[i].content, + url: data[i].url + }); + } + }); + + searchResults(index, data); } else { // We reached our target server, but it returned an error console.log('Error loading ajax request. Request status:' + request.status); } }; - request.onerror = function() { + request.onerror = function(){ // There was a connection error of some sort console.log('There was a connection error'); }; request.send(); - function searchResults(dataStore) { + function searchResults(index, data) { + var index = index; + var docs = data; var searchInput = document.querySelector('.js-search-input'); var searchResults = document.querySelector('.js-search-results'); - var store = dataStore; function hideResults() { searchResults.innerHTML = ''; searchResults.classList.remove('active'); } - addEvent(searchInput, 'keyup', function(e){ - var query = this.value; - - searchResults.innerHTML = ''; - searchResults.classList.remove('active'); - - if (query === '') { - hideResults(); - } else { - var results = index.search(query); - - if (results.length > 0) { - searchResults.classList.add('active'); - var resultsList = document.createElement('ul'); - searchResults.appendChild(resultsList); - - for (var i in results) { - var resultsListItem = document.createElement('li'); - var resultsLink = document.createElement('a'); - var resultsUrlDesc = document.createElement('span'); - var resultsUrl = store[results[i].ref].url; - var resultsRelUrl = store[results[i].ref].relUrl; - var resultsTitle = store[results[i].ref].title; - - resultsLink.setAttribute('href', resultsUrl); - resultsLink.innerText = resultsTitle; - resultsUrlDesc.innerText = resultsRelUrl; - - resultsList.classList.add('search-results-list'); - resultsListItem.classList.add('search-results-list-item'); - resultsLink.classList.add('search-results-link'); - resultsUrlDesc.classList.add('fs-2','text-grey-dk-000','d-block'); - - resultsList.appendChild(resultsListItem); - resultsListItem.appendChild(resultsLink); - resultsLink.appendChild(resultsUrlDesc); + 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; + } + }); - // When esc key is pressed, hide the results and clear the field - if (e.keyCode == 27) { + jtd.addEvent(searchInput, 'keyup', function(e){ + switch (e.keyCode) { + case 27: // When esc key is pressed, hide the results and clear the field hideResults(); searchInput.value = ''; + return; + case 38: // arrow up + case 40: // arrow down + case 13: // enter + e.preventDefault(); + return; + } + + hideResults(); + + var input = this.value; + 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) { + searchResults.classList.add('active'); + var resultsList = document.createElement('ul'); + resultsList.classList.add('search-results-list'); + searchResults.appendChild(resultsList); + + for (var i in results) { + var result = results[i]; + 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'); + resultTitle.innerText = doc.title; + resultLink.appendChild(resultTitle); + + var resultRelUrl = document.createElement('span'); + resultRelUrl.classList.add('search-result-rel-url'); + resultRelUrl.innerText = doc.relUrl; + resultTitle.appendChild(resultRelUrl); + + var metadata = result.matchData.metadata; + var contentFound = false; + for (var j in metadata) { + if (metadata[j].title) { + var position = metadata[j].title.position[0]; + var start = position[0]; + var end = position[0] + position[1]; + resultTitle.innerHTML = doc.title.substring(0, start) + '<span class="search-result-highlight">' + doc.title.substring(start, end) + '</span>' + doc.title.substring(end, doc.title.length)+'<span class="search-result-rel-url">'+doc.relUrl+'</span>'; + + } else if (metadata[j].content && !contentFound) { + contentFound = true; + + var position = metadata[j].content.position[0]; + var start = position[0]; + var end = position[0] + position[1]; + var previewStart = start; + var previewEnd = end; + var ellipsesBefore = true; + var ellipsesAfter = true; + for (var k = 0; k < 3; 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 < 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; + } + var preview = doc.content.substring(previewStart, start); + if (ellipsesBefore) { + preview = '... ' + preview; + } + preview += '<span class="search-result-highlight">' + doc.content.substring(start, end) + '</span>'; + preview += doc.content.substring(end, previewEnd); + if (ellipsesAfter) { + preview += ' ...'; + } + + var resultPreview = document.createElement('div'); + resultPreview.classList.add('search-result-preview'); + resultPreview.innerHTML = preview; + resultLink.appendChild(resultPreview); + } + } } } }); - addEvent(searchInput, 'blur', function(){ + jtd.addEvent(searchInput, 'blur', function(){ setTimeout(function(){ hideResults() }, 300); }); } @@ -155,22 +279,16 @@ function pageFocus() { mainContent.focus(); } - // Document ready -function ready(){ - toggleNav(); +jtd.onReady(function(){ + initNav(); pageFocus(); if (typeof lunr !== 'undefined') { initSearch(); } -} - -// 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(); }); + +})(window.jtd = window.jtd || {}); + +{% include js/custom.js %} diff --git a/assets/js/search-data.json b/assets/js/search-data.json index 49cbc9dcbc2eeea44a9d48c8f0cbf3a14def27a9..6f728cda154c8940884e25104dcecdd3955e6fd2 100644 --- a/assets/js/search-data.json +++ b/assets/js/search-data.json @@ -2,9 +2,8 @@ --- { {% for page in site.html_pages %}{% if page.search_exclude != true %}"{{ forloop.index0 }}": { - "id": "{{ forloop.index0 }}", "title": "{{ page.title | replace: '&', '&' }}", - "content": "{{ page.content | markdownify | strip_html | escape_once | remove: 'Table of contents' | remove: '```' | remove: '---' | replace: '\', ' ' | normalize_whitespace }}", + "content": "{{ page.content | markdownify | replace: '</h', ' . </h' | replace: '<hr', ' . <hr' | replace: '</p', ' . </p' | replace: '</ul', ' . </ul' | replace: '</tr', ' . </tr' | replace: '</li', ' | </li' | replace: '</td', ' | </td' | strip_html | escape_once | remove: 'Table of contents' | remove: '```' | remove: '---' | replace: '\', ' ' | replace: ' . . . ', ' . ' | replace: ' . . ', ' . ' | normalize_whitespace }}", "url": "{{ page.url | absolute_url }}", "relUrl": "{{ page.url }}" }{% unless forloop.last %},{% endunless %} diff --git a/assets/js/vendor/lunr.min.js b/assets/js/vendor/lunr.min.js index 9960ccd23f6f24b89680f80e2e21bf26d5ccc6d2..34b279dac0d52672a135c25a435981c13a3ca3d8 100644 --- a/assets/js/vendor/lunr.min.js +++ b/assets/js/vendor/lunr.min.js @@ -1,6 +1,6 @@ /** - * lunr - http://lunrjs.com - A bit like Solr, but much smaller and not as bright - 1.0.0 - * Copyright (C) 2017 Oliver Nightingale + * lunr - http://lunrjs.com - A bit like Solr, but much smaller and not as bright - 2.3.6 + * Copyright (C) 2019 Oliver Nightingale * @license MIT */ -!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})}(); \ No newline at end of file +!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})}(); diff --git a/docs/configuration.md b/docs/configuration.md index 3b797506e3c3cf468c617402a2952fa6d2a20a4a..14422fdfa64bcc58eec9f6ee8cbce802d5a4104e 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -26,6 +26,7 @@ View this site's [_config.yml](https://github.com/pmarsceill/just-the-docs/tree/ ```yaml # Enable or disable the site search +# Support true (default) or false search_enabled: true ``` @@ -38,6 +39,17 @@ aux_links: - "//github.com/pmarsceill/just-the-docs" ``` +## Heading anchor links + +```yaml +# Heading anchor links appear on hover over h1-h6 tags +# in page content allowing users to deep link to a particular +# heading on a page. +# +# Supprts true (default) or false/nil +heading_anchors: true +``` + ## Footer content ```yaml @@ -54,16 +66,16 @@ color_scheme: "dark" <button class="btn js-toggle-dark-mode">Preview dark color scheme</button> <script> -const toggleDarkMode = document.querySelector('.js-toggle-dark-mode') -const cssFile = document.querySelector('[rel="stylesheet"]') -const originalCssRef = cssFile.getAttribute('href') -const darkModeCssRef = originalCssRef.replace('just-the-docs.css', 'dark-mode-preview.css') +const toggleDarkMode = document.querySelector('.js-toggle-dark-mode'); +const cssFile = document.querySelector('[rel="stylesheet"]'); +const originalCssRef = cssFile.getAttribute('href'); +const darkModeCssRef = originalCssRef.replace('just-the-docs.css', 'dark-mode-preview.css'); -addEvent(toggleDarkMode, 'click', function(){ +jtd.addEvent(toggleDarkMode, 'click', function(){ if (cssFile.getAttribute('href') === originalCssRef) { - cssFile.setAttribute('href', darkModeCssRef) + cssFile.setAttribute('href', darkModeCssRef); } else { - cssFile.setAttribute('href', originalCssRef) + cssFile.setAttribute('href', originalCssRef); } }) </script> diff --git a/docs/customization.md b/docs/customization.md index d33a69b13b1613e074b069c0955a339dcafb676c..eccb4bc2791e3e1867d9aa06dbbcda139e66f9db 100644 --- a/docs/customization.md +++ b/docs/customization.md @@ -35,16 +35,16 @@ color_scheme: "dark" <button class="btn js-toggle-dark-mode">Preview dark color scheme</button> <script> -const toggleDarkMode = document.querySelector('.js-toggle-dark-mode') -const cssFile = document.querySelector('[rel="stylesheet"]') -const originalCssRef = cssFile.getAttribute('href') -const darkModeCssRef = originalCssRef.replace('just-the-docs.css', 'dark-mode-preview.css') +const toggleDarkMode = document.querySelector('.js-toggle-dark-mode'); +const cssFile = document.querySelector('[rel="stylesheet"]'); +const originalCssRef = cssFile.getAttribute('href'); +const darkModeCssRef = originalCssRef.replace('just-the-docs.css', 'dark-mode-preview.css'); -addEvent(toggleDarkMode, 'click', function(){ +jtd.addEvent(toggleDarkMode, 'click', function(){ if (cssFile.getAttribute('href') === originalCssRef) { - cssFile.setAttribute('href', darkModeCssRef) + cssFile.setAttribute('href', darkModeCssRef); } else { - cssFile.setAttribute('href', originalCssRef) + cssFile.setAttribute('href', originalCssRef); } }) </script>