mirror of
https://github.com/snachodog/just-the-docs.git
synced 2025-09-16 14:23:31 -06:00
Compare commits
93 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
c20129c32c | ||
|
dac6e45451 | ||
|
3ecef3be5c | ||
|
74b468058a | ||
|
960d347f68 | ||
|
3573db5d34 | ||
|
dc29db592f | ||
|
805eadb4bb | ||
|
f0bb38e1b8 | ||
|
b52f66a2ee | ||
|
100b7277b3 | ||
|
28bafabd72 | ||
|
559e210503 | ||
|
4814fbce64 | ||
|
2568b05fe7 | ||
|
7c24af0745 | ||
|
410085dd28 | ||
|
bfce0f57d3 | ||
|
379a976387 | ||
|
6540493df2 | ||
|
6ecde7eeec | ||
|
8f6f4b761a | ||
|
fa40528acd | ||
|
0a5edea9d8 | ||
|
32b708cb58 | ||
|
b98cac8620 | ||
|
c6ca6f61ab | ||
|
e41c1701a5 | ||
|
d11e332dc6 | ||
|
45eea0efb6 | ||
|
3730de18ea | ||
|
4b8e051303 | ||
|
3418332411 | ||
|
bde21167f4 | ||
|
5ac39f75a1 | ||
|
1ef94683df | ||
|
35c98605d7 | ||
|
11a4269d1c | ||
|
2f7d0f18a5 | ||
|
8968860b4b | ||
|
aa5a4e529c | ||
|
a0251b32d1 | ||
|
8d144f1530 | ||
|
af3e9f07c7 | ||
|
aa4ec995cd | ||
|
657ce6b750 | ||
|
ee4759c772 | ||
|
3acf927eb7 | ||
|
b7db5e73a3 | ||
|
9c70c7f081 | ||
|
d5ef35c5a4 | ||
|
aa9a68b1be | ||
|
94d640b80e | ||
|
f92fd09a12 | ||
|
d8a90f70c1 | ||
|
11ee5e7762 | ||
|
74693a0b2a | ||
|
6400e79e02 | ||
|
6a6efba27a | ||
|
d554236ba3 | ||
|
6d14c454f1 | ||
|
9d51b4601c | ||
|
62fc067441 | ||
|
ea61589b12 | ||
|
89f9c5f38c | ||
|
caf5311feb | ||
|
3a32d20f18 | ||
|
651ed922b0 | ||
|
64ed5ef369 | ||
|
82e1873460 | ||
|
46782d9352 | ||
|
d558234885 | ||
|
b6ed3643f1 | ||
|
6ebfb5c77e | ||
|
86402106e7 | ||
|
53b093474f | ||
|
c8a93a9a3c | ||
|
8bffcd06cd | ||
|
dc0d4a0c84 | ||
|
886654d86d | ||
|
4177f965df | ||
|
f97f504284 | ||
|
45abf03b48 | ||
|
debc7d3310 | ||
|
ea23134560 | ||
|
2ad43933cf | ||
|
1afc26cc33 | ||
|
b64368873c | ||
|
89a3e86ebf | ||
|
952a016807 | ||
|
6c05ef8b9d | ||
|
3752c58af2 | ||
|
6e534b63c2 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -3,3 +3,4 @@
|
|||||||
.sass-cache
|
.sass-cache
|
||||||
_site
|
_site
|
||||||
Gemfile.lock
|
Gemfile.lock
|
||||||
|
node_modules
|
||||||
|
@@ -1,4 +1,9 @@
|
|||||||
{
|
{
|
||||||
|
"ignoreFiles" : [
|
||||||
|
"assets/css/just-the-docs.scss",
|
||||||
|
"assets/css/dark-mode-preview.scss",
|
||||||
|
"_sass/vendor/**/*.scss"
|
||||||
|
],
|
||||||
"extends": [
|
"extends": [
|
||||||
"stylelint-config-primer"
|
"stylelint-config-primer"
|
||||||
]
|
]
|
||||||
|
14
.travis.yml
Normal file
14
.travis.yml
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
language: ruby
|
||||||
|
rvm:
|
||||||
|
- 2.3.0
|
||||||
|
env:
|
||||||
|
- TRAVIS_NODE_VERSION="9.3.0"
|
||||||
|
|
||||||
|
install:
|
||||||
|
- npm install
|
||||||
|
- gem install bundler --version '>=1.17.1'
|
||||||
|
- bundle install
|
||||||
|
|
||||||
|
script:
|
||||||
|
- npm run test
|
||||||
|
- bundle exec jekyll build
|
37
README.md
37
README.md
@@ -1,10 +1,17 @@
|
|||||||
# Just the Docs
|
<p align="right">
|
||||||
|
<a href="https://badge.fury.io/rb/just-the-docs"><img src="https://badge.fury.io/rb/just-the-docs.svg" alt="Gem version"></a> <a href="https://travis-ci.com/pmarsceill/just-the-docs"><img src="https://travis-ci.com/pmarsceill/just-the-docs.svg?branch=master" alt="Build status"></a>
|
||||||
|
</p>
|
||||||
|
<br><br>
|
||||||
|
<p align="center">
|
||||||
|
<h1 align="center">Just the Docs</h1>
|
||||||
|
<p align="center">A modern, high customizable, responsive Jekyll theme for documentation with built-in search.<br>Easily hosted on GitHub pages with few dependencies.</p>
|
||||||
|
<p align="center"><strong><a href="https://pmarsceill.github.io/just-the-docs">See it in action!</a></strong></p>
|
||||||
|
<br><br><br>
|
||||||
|
</p>
|
||||||
|
|
||||||
A nice looking, high customizable, responsive Jekyll theme for documention with built-in search. Easily hosted on GitHub pages.
|
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
Add this line to your Jekyll site's Gemfile:
|
Add this line to your Jekyll site's Gemfile:
|
||||||
@@ -35,6 +42,20 @@ Or install it yourself as:
|
|||||||
|
|
||||||
Bug reports and pull requests are welcome on GitHub at https://github.com/pmarsceill/just-the-docs. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
Bug reports and pull requests are welcome on GitHub at https://github.com/pmarsceill/just-the-docs. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
||||||
|
|
||||||
|
### Submitting code changes:
|
||||||
|
|
||||||
|
- Open a [Pull Request](https://github.com/pmarsceill/just-the-docs/pulls)
|
||||||
|
- Ensure all CI tests pass
|
||||||
|
- Await code review
|
||||||
|
- Bump the version number in `just-the-docs.gemspec` and `package.json` according to [semantic versioning](https://semver.org/).
|
||||||
|
|
||||||
|
### Design and development principles of this theme:
|
||||||
|
|
||||||
|
1. As few dependencies as possible
|
||||||
|
2. No build script needed
|
||||||
|
3. First class mobile experience
|
||||||
|
4. Make the content shine
|
||||||
|
|
||||||
## Development
|
## Development
|
||||||
|
|
||||||
To set up your environment to develop this theme, run `bundle install`.
|
To set up your environment to develop this theme, run `bundle install`.
|
||||||
@@ -43,16 +64,6 @@ Your theme is setup just like a normal Jekyll site! To test your theme, run `bun
|
|||||||
|
|
||||||
When the theme is released, only the files in `_layouts`, `_includes`, and `_sass` tracked with Git will be released.
|
When the theme is released, only the files in `_layouts`, `_includes`, and `_sass` tracked with Git will be released.
|
||||||
|
|
||||||
|
|
||||||
### When your changes are ready:
|
|
||||||
|
|
||||||
- Open a [Pull Request](https://github.com/pmarsceill/just-the-docs/pulls)
|
|
||||||
- Await code review
|
|
||||||
- Bump the version number in `just-the-docs.gemspec`
|
|
||||||
- Run `script/build` to package the gem
|
|
||||||
- Run `gem push just-the-docs-<version>.gem` to publish the gem to Rubygems.org
|
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
The theme is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
The theme is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
||||||
|
|
||||||
|
13
_config.yml
13
_config.yml
@@ -15,18 +15,19 @@
|
|||||||
# in the templates via {{ site.myvariable }}.
|
# in the templates via {{ site.myvariable }}.
|
||||||
title: Just the Docs
|
title: Just the Docs
|
||||||
description: A Jekyll theme for documentation
|
description: A Jekyll theme for documentation
|
||||||
baseurl: "/just-the-docs" # the subpath of your site, e.g. /blog
|
baseurl: "/just-the-docs/" # the subpath of your site, e.g. /blog
|
||||||
# url: "" # the base hostname & protocol for your site, e.g. http://example.com
|
# url: "" # the base hostname & protocol for your site, e.g. http://example.com
|
||||||
|
|
||||||
sass:
|
|
||||||
# Load dependancies
|
|
||||||
load_paths:
|
|
||||||
- node_modules/
|
|
||||||
|
|
||||||
permalink: pretty
|
permalink: pretty
|
||||||
exclude: ["node_modules/", "*.gemspec", "*.gem", "Gemfile", "Gemfile.lock", "package.json", "script/", "LICENSE.txt", "lib/", "bin/", "README.md", "Rakefile"]
|
exclude: ["node_modules/", "*.gemspec", "*.gem", "Gemfile", "Gemfile.lock", "package.json", "script/", "LICENSE.txt", "lib/", "bin/", "README.md", "Rakefile"]
|
||||||
|
|
||||||
|
# Enable or disable the site search
|
||||||
|
search_enabled: true
|
||||||
|
|
||||||
# Aux links for the upper right navigation
|
# Aux links for the upper right navigation
|
||||||
aux_links:
|
aux_links:
|
||||||
"Just the Docs on GitHub":
|
"Just the Docs on GitHub":
|
||||||
- "//github.com/pmarsceill/just-the-docs"
|
- "//github.com/pmarsceill/just-the-docs"
|
||||||
|
|
||||||
|
# Color scheme currently only supports "dark" or nil (default)
|
||||||
|
color_scheme: nil
|
||||||
|
@@ -4,7 +4,9 @@
|
|||||||
|
|
||||||
<title>{{ page.title }} - {{ site.title }}</title>
|
<title>{{ page.title }} - {{ site.title }}</title>
|
||||||
<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.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">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
@@ -2,23 +2,43 @@
|
|||||||
<ul class="navigation-list">
|
<ul class="navigation-list">
|
||||||
{% assign pages_list = site.html_pages | sort:"nav_order" %}
|
{% assign pages_list = site.html_pages | sort:"nav_order" %}
|
||||||
{% for node in pages_list %}
|
{% for node in pages_list %}
|
||||||
<li class="navigation-list-item{% if page.url == node.url %} active{% endif %} js-side-nav-item">
|
{% unless node.nav_exclude %}
|
||||||
{% if node.parent == nil or node.has_children == true %}
|
{% if node.parent == nil %}
|
||||||
<a href="{{ node.url | absolute_url }}" class="navigation-list-link{% if page.url == node.url or (page.parent != nil and page.parent == node.parent) %} active{% endif %}">{{ node.title }}</a>
|
<li class="navigation-list-item{% if page.url == node.url or page.parent == node.title or page.grand_parent == node.title %} active{% endif %}">
|
||||||
{% if (node.has_children == true and node.parent == page.parent) %}
|
{% if page.parent == node.title or page.grand_parent == node.title %}
|
||||||
|
{% assign first_level_url = node.url | absolute_url %}
|
||||||
|
{% endif %}
|
||||||
|
<a href="{{ node.url | absolute_url }}" class="navigation-list-link{% if page.url == node.url %} active{% endif %}">{{ node.title }}</a>
|
||||||
|
{% if node.has_children %}
|
||||||
{% assign children_list = site.html_pages | sort:"nav_order" %}
|
{% assign children_list = site.html_pages | sort:"nav_order" %}
|
||||||
<ul class="navigation-list-child-list">
|
<ul class="navigation-list-child-list ">
|
||||||
{% for child in children_list %}
|
{% for child in children_list %}
|
||||||
{% if child.parent == node.parent and child.title != node.title %}
|
{% if child.parent == node.title %}
|
||||||
<li class="navigation-list-item {% if page.url == child.url %} active{% endif %}">
|
<li class="navigation-list-item {% if page.url == child.url or page.parent == child.title %} active{% endif %}">
|
||||||
|
{% if page.url == child.url or page.parent == child.title %}
|
||||||
|
{% assign second_level_url = child.url | absolute_url %}
|
||||||
|
{% endif %}
|
||||||
<a href="{{ child.url | absolute_url }}" class="navigation-list-link{% if page.url == child.url %} active{% endif %}">{{ child.title }}</a>
|
<a href="{{ child.url | absolute_url }}" class="navigation-list-link{% if page.url == child.url %} active{% endif %}">{{ child.title }}</a>
|
||||||
|
{% if child.has_children %}
|
||||||
|
{% assign grand_children_list = site.html_pages | sort:"nav_order" %}
|
||||||
|
<ul class="navigation-list-child-list">
|
||||||
|
{% for grand_child in grand_children_list %}
|
||||||
|
{% if grand_child.parent == child.title %}
|
||||||
|
<li class="navigation-list-item {% if page.url == grand_child.url %} active{% endif %}">
|
||||||
|
<a href="{{ grand_child.url | absolute_url }}" class="navigation-list-link{% if page.url == grand_child.url %} active{% endif %}">{{ grand_child.title }}</a>
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</li>
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
{% endunless %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
|
5
_layouts/about.html
Normal file
5
_layouts/about.html
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
layout: default
|
||||||
|
---
|
||||||
|
|
||||||
|
{{ content }}
|
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
<div class="page-wrap">
|
<div class="page-wrap">
|
||||||
<div class="side-bar">
|
<div class="side-bar">
|
||||||
<a href="{{ site.baseurl }}" class="site-title fs-6 text-grey-dk-300 lh-tight">{{ site.title }}</a>
|
<a href="{{ site.url }}{{ 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>
|
<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>
|
||||||
<div class="navigation main-nav js-main-nav">
|
<div class="navigation main-nav js-main-nav">
|
||||||
{% include nav.html %}
|
{% include nav.html %}
|
||||||
@@ -16,16 +16,18 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="main-content-wrap">
|
<div class="main-content-wrap">
|
||||||
<div class="page-header">
|
<div class="page-header">
|
||||||
<div class="main-content pb-0">
|
<div class="main-content">
|
||||||
|
{% if site.search_enabled != nil %}
|
||||||
<div class="search js-search">
|
<div class="search js-search">
|
||||||
<div class="search-input-wrap">
|
<div class="search-input-wrap">
|
||||||
<input type="text" class="js-search-input search-input fs-2" placeholder="Search {{ site.title }}" aria-label="Search {{ site.title }}" autocomplete="off">
|
<input type="text" class="js-search-input search-input" 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>
|
<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>
|
||||||
</div>
|
</div>
|
||||||
<div class="js-search-results search-results-wrap"></div>
|
<div class="js-search-results search-results-wrap"></div>
|
||||||
</div>
|
</div>
|
||||||
|
{% endif %}
|
||||||
{% if site.aux_links != nil %}
|
{% if site.aux_links != nil %}
|
||||||
<ul class="list-style-none text-small mt-md-2 pb-4 pb-md-0 js-aux-nav aux-nav">
|
<ul class="list-style-none text-small mt-md-1 mb-md-1 pb-4 pb-md-0 js-aux-nav aux-nav">
|
||||||
{% for link in site.aux_links %}
|
{% 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>
|
<li class="d-inline-block my-0{% unless forloop.last %} mr-2{% endunless %}"><a href="{{ link.last }}">{{ link.first }}</a></li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
@@ -35,10 +37,15 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="main-content">
|
<div class="main-content">
|
||||||
{% unless page.url == "/" %}
|
{% unless page.url == "/" %}
|
||||||
{% if page.parent != nil and page.parent != page.title %}
|
{% if page.parent %}
|
||||||
<nav class="breadcrumb-nav">
|
<nav class="breadcrumb-nav">
|
||||||
<ol class="breadcrumb-nav-list">
|
<ol class="breadcrumb-nav-list">
|
||||||
<li class="breadcrumb-nav-list-item"><a href="{{ site.url }}{{ site.baseurl }}{{ page.parent | slugify }}">{{ page.parent }}</a></li>
|
{% 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>
|
<li class="breadcrumb-nav-list-item"><span>{{ page.title }}</span></li>
|
||||||
</ol>
|
</ol>
|
||||||
</nav>
|
</nav>
|
||||||
|
5
_layouts/home.html
Normal file
5
_layouts/home.html
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
layout: default
|
||||||
|
---
|
||||||
|
|
||||||
|
{{ content }}
|
@@ -1,12 +1,17 @@
|
|||||||
//
|
//
|
||||||
// Base element style overrides
|
// Base element style overrides
|
||||||
//
|
//
|
||||||
// stylelint-disable selector-no-type
|
// stylelint-disable selector-no-type, selector-max-type
|
||||||
|
|
||||||
* {
|
* {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
::selection {
|
||||||
|
color: $white;
|
||||||
|
background: $link-color;
|
||||||
|
}
|
||||||
|
|
||||||
html {
|
html {
|
||||||
@include fs-4;
|
@include fs-4;
|
||||||
}
|
}
|
||||||
@@ -16,6 +21,7 @@ body {
|
|||||||
font-size: inherit;
|
font-size: inherit;
|
||||||
line-height: $body-line-height;
|
line-height: $body-line-height;
|
||||||
color: $body-text-color;
|
color: $body-text-color;
|
||||||
|
background-color: $body-background-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
p,
|
p,
|
||||||
@@ -64,7 +70,7 @@ a {
|
|||||||
|
|
||||||
a:not([class]) {
|
a:not([class]) {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
background-image: linear-gradient($grey-lt-100 0%, $grey-lt-100 100%);
|
background-image: linear-gradient($border-color 0%, $border-color 100%);
|
||||||
background-repeat: repeat-x;
|
background-repeat: repeat-x;
|
||||||
background-position: 0 100%;
|
background-position: 0 100%;
|
||||||
background-size: 1px 1px;
|
background-size: 1px 1px;
|
||||||
@@ -99,6 +105,6 @@ hr {
|
|||||||
height: 1px;
|
height: 1px;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
margin: $sp-6 0;
|
margin: $sp-6 0;
|
||||||
background-color: $grey-lt-100;
|
background-color: $border-color;
|
||||||
border: 0;
|
border: 0;
|
||||||
}
|
}
|
||||||
|
@@ -15,11 +15,11 @@
|
|||||||
font-size: inherit;
|
font-size: inherit;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
color: $purple-200;
|
color: $link-color;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
vertical-align: baseline;
|
vertical-align: baseline;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
background-color: #f7f7f7;
|
background-color: $base-button-color;
|
||||||
border-width: 0;
|
border-width: 0;
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12), 0 3px 10px rgba(0, 0, 0, 0.08);
|
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12), 0 3px 10px rgba(0, 0, 0, 0.08);
|
||||||
@@ -38,7 +38,7 @@
|
|||||||
|
|
||||||
&:hover,
|
&:hover,
|
||||||
&.zeroclipboard-is-hover {
|
&.zeroclipboard-is-hover {
|
||||||
color: $purple-300;
|
color: darken($link-color, 2%);
|
||||||
}
|
}
|
||||||
|
|
||||||
&:hover,
|
&:hover,
|
||||||
@@ -46,13 +46,13 @@
|
|||||||
&.zeroclipboard-is-hover,
|
&.zeroclipboard-is-hover,
|
||||||
&.zeroclipboard-is-active {
|
&.zeroclipboard-is-active {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
background-color: #f4f4f4;
|
background-color: darken($base-button-color, 1%);
|
||||||
}
|
}
|
||||||
|
|
||||||
&:active,
|
&:active,
|
||||||
&.selected,
|
&.selected,
|
||||||
&.zeroclipboard-is-active {
|
&.zeroclipboard-is-active {
|
||||||
background-color: #ededed;
|
background-color: darken($base-button-color, 3%);
|
||||||
background-image: none;
|
background-image: none;
|
||||||
box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15);
|
box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15);
|
||||||
}
|
}
|
||||||
@@ -75,7 +75,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.btn-outline {
|
.btn-outline {
|
||||||
color: $blue-100;
|
color: $link-color;
|
||||||
background: transparent;
|
background: transparent;
|
||||||
box-shadow: inset 0 0 0 2px $grey-lt-300;
|
box-shadow: inset 0 0 0 2px $grey-lt-300;
|
||||||
|
|
||||||
@@ -83,7 +83,7 @@
|
|||||||
&:active,
|
&:active,
|
||||||
&.zeroclipboard-is-hover,
|
&.zeroclipboard-is-hover,
|
||||||
&.zeroclipboard-is-active {
|
&.zeroclipboard-is-active {
|
||||||
color: $grey-dk-100;
|
color: darken($link-color, 4%);
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
box-shadow: inset 0 0 0 3px $grey-lt-300;
|
box-shadow: inset 0 0 0 3px $grey-lt-300;
|
||||||
@@ -101,6 +101,10 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.btn-primary {
|
||||||
|
@include btn-color($white, $btn-primary-color);
|
||||||
|
}
|
||||||
|
|
||||||
.btn-purple {
|
.btn-purple {
|
||||||
@include btn-color($white, $purple-100);
|
@include btn-color($white, $purple-100);
|
||||||
}
|
}
|
||||||
|
@@ -1,20 +1,20 @@
|
|||||||
//
|
//
|
||||||
// Code and syntax highlighting
|
// Code and syntax highlighting
|
||||||
//
|
//
|
||||||
// stylelint-disable selector-no-qualifying-type, declaration-block-semicolon-newline-after,declaration-block-single-line-max-declarations, selector-no-type
|
// stylelint-disable selector-no-qualifying-type, declaration-block-semicolon-newline-after,declaration-block-single-line-max-declarations, selector-no-type, selector-max-type
|
||||||
|
|
||||||
code {
|
code {
|
||||||
padding: 0.2em 0.15em;
|
padding: 0.2em 0.15em;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
background-color: $grey-lt-000;
|
background-color: $code-background-color;
|
||||||
border: $border $border-color;
|
border: $border $border-color;
|
||||||
border-radius: $border-radius;
|
border-radius: $border-radius;
|
||||||
}
|
}
|
||||||
|
|
||||||
.highlight {
|
pre.highlight {
|
||||||
padding: $sp-3;
|
padding: $sp-3;
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
background-color: $grey-lt-000;
|
background-color: $code-background-color;
|
||||||
|
|
||||||
code {
|
code {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
14
_sass/color_schemes/dark.scss
Normal file
14
_sass/color_schemes/dark.scss
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
|
||||||
|
$body-background-color: $grey-dk-300;
|
||||||
|
$sidebar-color: $grey-dk-300;
|
||||||
|
$border-color: $grey-dk-200;
|
||||||
|
|
||||||
|
$body-text-color: $grey-lt-300;
|
||||||
|
$body-heading-color: $grey-lt-000;
|
||||||
|
$nav-child-link-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;
|
@@ -1,12 +1,17 @@
|
|||||||
//
|
//
|
||||||
// Styles for rendered markdown in the .main-content container
|
// Styles for rendered markdown in the .main-content container
|
||||||
//
|
//
|
||||||
// stylelint-disable selector-no-type, max-nesting-depth, selector-max-compound-selectors
|
// stylelint-disable selector-no-type, max-nesting-depth, selector-max-compound-selectors, selector-max-type
|
||||||
|
|
||||||
.page-content {
|
.page-content {
|
||||||
|
a {
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
ul,
|
ul,
|
||||||
ol,
|
ol {
|
||||||
dl {
|
|
||||||
padding-left: 1.5em;
|
padding-left: 1.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,6 +62,23 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.task-list {
|
||||||
|
padding-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.task-list-item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
&::before {
|
||||||
|
content: "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.task-list-item-checkbox {
|
||||||
|
margin-right: 0.6em;
|
||||||
|
}
|
||||||
|
|
||||||
hr + * {
|
hr + * {
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
}
|
}
|
||||||
@@ -64,4 +86,27 @@
|
|||||||
h1:first-of-type {
|
h1:first-of-type {
|
||||||
margin-top: 0.5em;
|
margin-top: 0.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dl {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: max-content 1fr;
|
||||||
|
}
|
||||||
|
|
||||||
|
dt,
|
||||||
|
dd {
|
||||||
|
margin: 0.25em 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
dt {
|
||||||
|
text-align: right;
|
||||||
|
|
||||||
|
&::after {
|
||||||
|
content: ":";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dd {
|
||||||
|
margin-left: 1em;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -17,6 +17,7 @@
|
|||||||
// $grey-dk-000: #959396;
|
// $grey-dk-000: #959396;
|
||||||
// $grey-dk-100: #5c5962;
|
// $grey-dk-100: #5c5962;
|
||||||
// $grey-dk-200: #44434d;
|
// $grey-dk-200: #44434d;
|
||||||
|
// $grey-dk-250: #302d36 !default;
|
||||||
// $grey-dk-300: #27262b;
|
// $grey-dk-300: #27262b;
|
||||||
//
|
//
|
||||||
// $grey-lt-000: #f5f6fa;
|
// $grey-lt-000: #f5f6fa;
|
||||||
@@ -39,9 +40,16 @@
|
|||||||
// $green-200: #009c7b;
|
// $green-200: #009c7b;
|
||||||
// $green-300: #026e57;
|
// $green-300: #026e57;
|
||||||
//
|
//
|
||||||
// $body-text-color: $grey-dk-100;
|
// $body-background-color: $white !default;
|
||||||
// $body-heading-color: $grey-dk-300;
|
// $sidebar-color: $grey-lt-000 !default;
|
||||||
// $link-color: $purple-000;
|
// $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 in pixels
|
||||||
|
@@ -12,9 +12,9 @@
|
|||||||
margin-right: $sp-1;
|
margin-right: $sp-1;
|
||||||
margin-left: $sp-1;
|
margin-left: $sp-1;
|
||||||
color: $white;
|
color: $white;
|
||||||
|
text-transform: uppercase;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
background-color: $blue-100;
|
background-color: $blue-100;
|
||||||
text-transform: uppercase;
|
|
||||||
@include fs-2;
|
@include fs-2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -17,13 +17,15 @@
|
|||||||
|
|
||||||
.side-bar {
|
.side-bar {
|
||||||
z-index: 100;
|
z-index: 100;
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
padding-top: $gutter-spacing-sm;
|
padding-top: $gutter-spacing-sm;
|
||||||
padding-bottom: $gutter-spacing-sm;
|
padding-bottom: $gutter-spacing-sm;
|
||||||
background-color: $grey-lt-000;
|
background-color: $sidebar-color;
|
||||||
|
|
||||||
@include mq(md) {
|
@include mq(md) {
|
||||||
|
flex-wrap: nowrap;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
display: flex;
|
|
||||||
width: $nav-width + 16px;
|
width: $nav-width + 16px;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
padding-top: $gutter-spacing * 2;
|
padding-top: $gutter-spacing * 2;
|
||||||
@@ -73,12 +75,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.page-header {
|
.page-header {
|
||||||
background-color: $grey-lt-000;
|
background-color: $sidebar-color;
|
||||||
|
|
||||||
@include mq(md) {
|
@include mq(md) {
|
||||||
background-color: $white;
|
background-color: $body-background-color;
|
||||||
border-bottom: $border $border-color;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.main-content {
|
.main-content {
|
||||||
@@ -86,8 +86,11 @@
|
|||||||
|
|
||||||
@include mq(md) {
|
@include mq(md) {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: flex-end;
|
||||||
|
height: 60px;
|
||||||
padding-top: $sp-4;
|
padding-top: $sp-4;
|
||||||
|
padding-bottom: $sp-4;
|
||||||
|
border-bottom: $border $border-color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -107,14 +110,13 @@
|
|||||||
|
|
||||||
.navigation {
|
.navigation {
|
||||||
@include mq(md) {
|
@include mq(md) {
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
right: 0;
|
|
||||||
height: 100%;
|
|
||||||
padding-top: $sp-8;
|
padding-top: $sp-8;
|
||||||
|
overflow-y: auto;
|
||||||
|
flex: 1 1 auto;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// stylelint-disable selector-no-type
|
||||||
body {
|
body {
|
||||||
position: relative;
|
position: relative;
|
||||||
padding-bottom: $sp-10;
|
padding-bottom: $sp-10;
|
||||||
@@ -124,12 +126,18 @@ body {
|
|||||||
padding-bottom: 0;
|
padding-bottom: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// stylelint-enable selector-no-type
|
||||||
|
|
||||||
.site-footer {
|
.site-footer {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
bottom: $sp-3;
|
bottom: 0;
|
||||||
|
padding-top: $sp-4;
|
||||||
|
padding-bottom: $sp-4;
|
||||||
|
|
||||||
@include mq(md) {
|
@include mq(md) {
|
||||||
right: 0;
|
position: static;
|
||||||
|
align-self: flex-end;
|
||||||
|
justify-self: end;
|
||||||
|
background-color: $sidebar-color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -4,19 +4,18 @@
|
|||||||
|
|
||||||
.site-title {
|
.site-title {
|
||||||
display: block;
|
display: block;
|
||||||
flex-grow: 1;
|
flex: 1 1 auto;
|
||||||
flex-shrink: 1;
|
color: $body-heading-color;
|
||||||
flex-basis: auto;
|
background-color: $sidebar-color;
|
||||||
background-color: $grey-lt-000;
|
|
||||||
|
|
||||||
@include mq(md) {
|
@include mq(md) {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
|
z-index: 101;
|
||||||
height: 60px;
|
height: 60px;
|
||||||
padding-top: $sp-4;
|
padding-top: $sp-4;
|
||||||
z-index: 101;
|
border-bottom: $border $border-color;
|
||||||
box-shadow: inset 0 -1px 0 $border-color;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -27,7 +26,7 @@
|
|||||||
list-style: none;
|
list-style: none;
|
||||||
|
|
||||||
@include mq(md) {
|
@include mq(md) {
|
||||||
margin-top: $sp-10;
|
margin-top: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -36,21 +35,23 @@
|
|||||||
list-style: none;
|
list-style: none;
|
||||||
|
|
||||||
.navigation-list-link {
|
.navigation-list-link {
|
||||||
color: $grey-dk-100;
|
color: $nav-child-link-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
.navigation-list-item {
|
.navigation-list-item {
|
||||||
|
position: relative;
|
||||||
|
|
||||||
&::before {
|
&::before {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
margin-top: 0.3em;
|
margin-top: 0.3em;
|
||||||
margin-left: -0.8em;
|
margin-left: -0.8em;
|
||||||
color: $grey-dk-000;
|
color: rgba($body-text-color, 0.3);
|
||||||
content: "- ";
|
content: "- ";
|
||||||
}
|
}
|
||||||
|
|
||||||
&.active {
|
&.active {
|
||||||
&::before {
|
&::before {
|
||||||
color: $grey-dk-100;
|
color: $body-text-color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -63,6 +64,16 @@
|
|||||||
@include mq(md) {
|
@include mq(md) {
|
||||||
@include fs-3;
|
@include fs-3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.navigation-list-child-list {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.active {
|
||||||
|
.navigation-list-child-list {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.navigation-list-link {
|
.navigation-list-link {
|
||||||
@@ -72,7 +83,7 @@
|
|||||||
|
|
||||||
&.active {
|
&.active {
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
color: $grey-dk-200;
|
color: $body-heading-color;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -91,16 +102,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.side-bar {
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
|
|
||||||
@include mq(md) {
|
|
||||||
display: block;
|
|
||||||
overflow-y: auto;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.navigation-list-toggle {
|
.navigation-list-toggle {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: $sp-4;
|
right: $sp-4;
|
||||||
@@ -111,6 +112,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Breadcrumb nav
|
// Breadcrumb nav
|
||||||
|
.breadcrumb-nav {
|
||||||
|
@include mq(md) {
|
||||||
|
margin-top: -$sp-4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.breadcrumb-nav-list {
|
.breadcrumb-nav-list {
|
||||||
padding-left: 0;
|
padding-left: 0;
|
||||||
|
@@ -7,19 +7,21 @@
|
|||||||
z-index: 99;
|
z-index: 99;
|
||||||
display: none;
|
display: none;
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
padding-bottom: $gutter-spacing / 2;
|
|
||||||
background-color: $white;
|
|
||||||
padding: $sp-2;
|
padding: $sp-2;
|
||||||
margin-bottom: $sp-3;
|
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) {
|
@include mq(md) {
|
||||||
display: block;
|
display: block;
|
||||||
padding-top: $sp-1;
|
padding-top: $sp-1;
|
||||||
padding-right: 0;
|
padding-right: 0;
|
||||||
padding-bottom: $sp-4;
|
padding-bottom: 0;
|
||||||
padding-left: 0;
|
padding-left: 0;
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
|
box-shadow: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.nav-open {
|
&.nav-open {
|
||||||
@@ -37,20 +39,21 @@
|
|||||||
display: block;
|
display: block;
|
||||||
width: 300px;
|
width: 300px;
|
||||||
margin-top: $gutter-spacing;
|
margin-top: $gutter-spacing;
|
||||||
background: $white;
|
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);
|
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.07), 0 4px 14px rgba(0, 0, 0, 0.05);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.search-input-wrap {
|
.search-input-wrap {
|
||||||
display: flex;
|
display: flex;
|
||||||
background-color: $white;
|
background-color: $body-background-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
.search-input {
|
.search-input {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding-top: $sp-1;
|
padding-top: $sp-1;
|
||||||
padding-bottom: $sp-1;
|
padding-bottom: $sp-1;
|
||||||
|
background-color: $body-background-color;
|
||||||
border-top: 0;
|
border-top: 0;
|
||||||
border-right: 0;
|
border-right: 0;
|
||||||
border-bottom: 0;
|
border-bottom: 0;
|
||||||
@@ -62,9 +65,19 @@
|
|||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
|
|
||||||
+ .search-icon {
|
+ .search-icon {
|
||||||
fill: $purple-000;
|
fill: $link-color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@include fs-5;
|
||||||
|
|
||||||
|
@include mq(sm) {
|
||||||
|
@include fs-3;
|
||||||
|
}
|
||||||
|
|
||||||
|
@include mq(md) {
|
||||||
|
@include fs-2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.search-icon {
|
.search-icon {
|
||||||
@@ -95,6 +108,7 @@
|
|||||||
padding-left: $sp-3;
|
padding-left: $sp-3;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
background-color: $grey-lt-000;
|
color: $body-heading-color;
|
||||||
|
background-color: darken($body-background-color, 2%);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -17,6 +17,7 @@ $white: #fff !default;
|
|||||||
$grey-dk-000: #959396 !default;
|
$grey-dk-000: #959396 !default;
|
||||||
$grey-dk-100: #5c5962 !default;
|
$grey-dk-100: #5c5962 !default;
|
||||||
$grey-dk-200: #44434d !default;
|
$grey-dk-200: #44434d !default;
|
||||||
|
$grey-dk-250: #302d36 !default;
|
||||||
$grey-dk-300: #27262b !default;
|
$grey-dk-300: #27262b !default;
|
||||||
|
|
||||||
$grey-lt-000: #f5f6fa !default;
|
$grey-lt-000: #f5f6fa !default;
|
||||||
@@ -49,9 +50,16 @@ $red-100: #f96e65 !default;
|
|||||||
$red-200: #e94c4c !default;
|
$red-200: #e94c4c !default;
|
||||||
$red-300: #dd2e2e !default;
|
$red-300: #dd2e2e !default;
|
||||||
|
|
||||||
|
$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-text-color: $grey-dk-100 !default;
|
||||||
$body-heading-color: $grey-dk-300 !default;
|
$body-heading-color: $grey-dk-300 !default;
|
||||||
|
$nav-child-link-color: $grey-dk-100 !default;
|
||||||
$link-color: $purple-000 !default;
|
$link-color: $purple-000 !default;
|
||||||
|
$btn-primary-color: $purple-100 !default;
|
||||||
|
$base-button-color: #f7f7f7 !default;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Media queries in pixels
|
// Media queries in pixels
|
||||||
|
@@ -15,7 +15,9 @@
|
|||||||
@media (min-width: rem($value)) {
|
@media (min-width: rem($value)) {
|
||||||
@content;
|
@content;
|
||||||
}
|
}
|
||||||
} @else {
|
}
|
||||||
|
|
||||||
|
@else {
|
||||||
@warn "No value could be retrieved from `#{$media-query}`. "
|
@warn "No value could be retrieved from `#{$media-query}`. "
|
||||||
+ "Please make sure it is defined in `$media-queries` map.";
|
+ "Please make sure it is defined in `$media-queries` map.";
|
||||||
}
|
}
|
||||||
@@ -24,11 +26,11 @@
|
|||||||
// Responsive container
|
// Responsive container
|
||||||
|
|
||||||
@mixin container {
|
@mixin container {
|
||||||
padding-left: $gutter-spacing-sm;
|
|
||||||
padding-right: $gutter-spacing-sm;
|
padding-right: $gutter-spacing-sm;
|
||||||
|
padding-left: $gutter-spacing-sm;
|
||||||
|
|
||||||
@include mq(md) {
|
@include mq(md) {
|
||||||
padding-left: $gutter-spacing;
|
|
||||||
padding-right: $gutter-spacing;
|
padding-right: $gutter-spacing;
|
||||||
|
padding-left: $gutter-spacing;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// Tables
|
// Tables
|
||||||
//
|
//
|
||||||
// stylelint-disable max-nesting-depth, selector-no-type
|
// stylelint-disable max-nesting-depth, selector-no-type, selector-max-type
|
||||||
|
|
||||||
table {
|
table {
|
||||||
display: block;
|
display: block;
|
||||||
@@ -25,7 +25,8 @@ td {
|
|||||||
padding-right: $sp-3;
|
padding-right: $sp-3;
|
||||||
padding-bottom: $sp-2;
|
padding-bottom: $sp-2;
|
||||||
padding-left: $sp-3;
|
padding-left: $sp-3;
|
||||||
border-bottom: $border $grey-lt-000;
|
background-color: lighten($body-background-color, 2%);
|
||||||
|
border-bottom: $border rgba($border-color, 0.5);
|
||||||
border-left: $border $border-color;
|
border-left: $border $border-color;
|
||||||
|
|
||||||
&:first-of-type {
|
&:first-of-type {
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// Typography
|
// Typography
|
||||||
//
|
//
|
||||||
// stylelint-disable primer/selector-no-utility, selector-no-type
|
// stylelint-disable primer/selector-no-utility, selector-no-type, selector-max-type
|
||||||
|
|
||||||
h1,
|
h1,
|
||||||
.text-alpha {
|
.text-alpha {
|
||||||
|
@@ -16,6 +16,10 @@
|
|||||||
color: $grey-dk-200 !important;
|
color: $grey-dk-200 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.text-grey-dk-250 {
|
||||||
|
color: $grey-dk-250 !important;
|
||||||
|
}
|
||||||
|
|
||||||
.text-grey-dk-300 {
|
.text-grey-dk-300 {
|
||||||
color: $grey-dk-300 !important;
|
color: $grey-dk-300 !important;
|
||||||
}
|
}
|
||||||
@@ -130,6 +134,10 @@
|
|||||||
background-color: $grey-dk-200 !important;
|
background-color: $grey-dk-200 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.bg-grey-dk-250 {
|
||||||
|
background-color: $grey-dk-250 !important;
|
||||||
|
}
|
||||||
|
|
||||||
.bg-grey-dk-300 {
|
.bg-grey-dk-300 {
|
||||||
background-color: $grey-dk-300 !important;
|
background-color: $grey-dk-300 !important;
|
||||||
}
|
}
|
||||||
|
41
assets/css/dark-mode-preview.scss
Normal file
41
assets/css/dark-mode-preview.scss
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
---
|
||||||
|
# this ensures Jekyll reads the file to be transformed into CSS later
|
||||||
|
# only Main files contain this front matter, not partials.
|
||||||
|
---
|
||||||
|
|
||||||
|
//
|
||||||
|
// Import external dependencies
|
||||||
|
//
|
||||||
|
|
||||||
|
@import "./vendor/normalize.scss/normalize.scss";
|
||||||
|
|
||||||
|
//
|
||||||
|
// Import Just the docs scss
|
||||||
|
//
|
||||||
|
|
||||||
|
// Support
|
||||||
|
@import "./support/support";
|
||||||
|
|
||||||
|
//
|
||||||
|
// Import custom color scheme scss
|
||||||
|
//
|
||||||
|
|
||||||
|
@import "./color_schemes/dark.scss";
|
||||||
|
|
||||||
|
// Modules
|
||||||
|
@import "./base";
|
||||||
|
@import "./layout";
|
||||||
|
@import "./content";
|
||||||
|
@import "./navigation";
|
||||||
|
@import "./typography";
|
||||||
|
@import "./labels";
|
||||||
|
@import "./buttons";
|
||||||
|
@import "./search";
|
||||||
|
@import "./tables";
|
||||||
|
@import "./code";
|
||||||
|
@import "./utilities/utilities";
|
||||||
|
|
||||||
|
//
|
||||||
|
// Import custom overrides
|
||||||
|
//
|
||||||
|
@import "./custom/custom";
|
@@ -4,10 +4,10 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
//
|
//
|
||||||
// Import dependancies
|
// Import external dependencies
|
||||||
//
|
//
|
||||||
|
|
||||||
@import "./normalize.scss/normalize.scss";
|
@import "./vendor/normalize.scss/normalize.scss";
|
||||||
|
|
||||||
//
|
//
|
||||||
// Import Just the docs scss
|
// Import Just the docs scss
|
||||||
@@ -16,8 +16,13 @@
|
|||||||
// Support
|
// Support
|
||||||
@import "./support/support";
|
@import "./support/support";
|
||||||
|
|
||||||
// Custom overrides
|
//
|
||||||
@import "./custom/custom";
|
// Import custom color scheme scss
|
||||||
|
//
|
||||||
|
|
||||||
|
{% if site.color_scheme == "dark" %}
|
||||||
|
@import "./color_schemes/dark.scss";
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
// Modules
|
// Modules
|
||||||
@import "./base";
|
@import "./base";
|
||||||
@@ -31,3 +36,8 @@
|
|||||||
@import "./tables";
|
@import "./tables";
|
||||||
@import "./code";
|
@import "./code";
|
||||||
@import "./utilities/utilities";
|
@import "./utilities/utilities";
|
||||||
|
|
||||||
|
//
|
||||||
|
// Import custom overrides
|
||||||
|
//
|
||||||
|
@import "./custom/custom";
|
||||||
|
@@ -155,7 +155,9 @@ function initSearch() {
|
|||||||
|
|
||||||
function ready(){
|
function ready(){
|
||||||
toggleNav();
|
toggleNav();
|
||||||
|
if (typeof lunr !== 'undefined') {
|
||||||
initSearch();
|
initSearch();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// in case the document is already rendered
|
// in case the document is already rendered
|
||||||
|
50
docs/configuration.md
Normal file
50
docs/configuration.md
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
---
|
||||||
|
layout: default
|
||||||
|
title: Configuration
|
||||||
|
nav_order: 2
|
||||||
|
---
|
||||||
|
|
||||||
|
# Configuration
|
||||||
|
|
||||||
|
Just the Docs has some specific configuration parameters that can be definied in your Jekyll site's `_config.yml` file.
|
||||||
|
|
||||||
|
## Search enabled
|
||||||
|
|
||||||
|
```yml
|
||||||
|
# Enable or disable the site search
|
||||||
|
search_enabled: true
|
||||||
|
```
|
||||||
|
|
||||||
|
## Aux links
|
||||||
|
|
||||||
|
```yml
|
||||||
|
# Aux links for the upper right navigation
|
||||||
|
aux_links:
|
||||||
|
"Just the Docs on GitHub":
|
||||||
|
- "//github.com/pmarsceill/just-the-docs"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Color scheme
|
||||||
|
|
||||||
|
```yml
|
||||||
|
# Color scheme currently only supports "dark" or nil (default)
|
||||||
|
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')
|
||||||
|
|
||||||
|
addEvent(toggleDarkMode, 'click', function(){
|
||||||
|
if (cssFile.getAttribute('href') === originalCssRef) {
|
||||||
|
cssFile.setAttribute('href', darkModeCssRef)
|
||||||
|
} else {
|
||||||
|
cssFile.setAttribute('href', originalCssRef)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
See [Customization]({{site.baseurl }}{% link docs/customization.md %}) for more information.
|
@@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
layout: default
|
layout: default
|
||||||
title: Customization
|
title: Customization
|
||||||
nav_order: 5
|
nav_order: 6
|
||||||
---
|
---
|
||||||
|
|
||||||
# Customization
|
# Customization
|
||||||
@@ -15,11 +15,49 @@ nav_order: 5
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Visual customization
|
## Color schemes
|
||||||
|
{: .d-inline-block :}
|
||||||
|
|
||||||
|
New
|
||||||
|
{: .label .label-green :}
|
||||||
|
|
||||||
|
Just the Docs supports two color schemes: light (default), and dark.
|
||||||
|
|
||||||
|
To enable a color scheme, set the `color_scheme` parameter in your site's `_config.yml` file:
|
||||||
|
|
||||||
|
#### Example
|
||||||
|
{: no_toc }
|
||||||
|
|
||||||
|
```yml
|
||||||
|
# Color scheme currently only supports "dark" or nil (default)
|
||||||
|
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')
|
||||||
|
|
||||||
|
addEvent(toggleDarkMode, 'click', function(){
|
||||||
|
if (cssFile.getAttribute('href') === originalCssRef) {
|
||||||
|
cssFile.setAttribute('href', darkModeCssRef)
|
||||||
|
} else {
|
||||||
|
cssFile.setAttribute('href', originalCssRef)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
## Specific visual customization
|
||||||
|
|
||||||
To customize your site’s aesthetic, open `_sass/custom/custom.scss` in your editor to see if there is a variable that you can override. Most styles like fonts, colors, spacing, etc.. are derived from these variables. To override a specific variable, uncomment out it’s line and change it’s value.
|
To customize your site’s aesthetic, open `_sass/custom/custom.scss` in your editor to see if there is a variable that you can override. Most styles like fonts, colors, spacing, etc.. are derived from these variables. To override a specific variable, uncomment out it’s line and change it’s value.
|
||||||
|
|
||||||
For example, to change the link color from the purple default to blue, open `_sass/custom/custom.css` and find the link color variable on line `44`. Uncomment it out, and change it's value to our `$blue-000` variable, or another shade of your choosing.
|
For example, to change the link color from the purple default to blue, open `_sass/custom/custom.css` and find the `$link-color` variable on line `50`. Uncomment it out, and change it's value to our `$blue-000` variable, or another shade of your choosing.
|
||||||
|
|
||||||
|
#### Example
|
||||||
|
{: no_toc }
|
||||||
|
|
||||||
```scss
|
```scss
|
||||||
// ...
|
// ...
|
||||||
@@ -35,10 +73,3 @@ _Note:_ Editing the variables directly in `_sass/support/variables.scss` is not
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Themes
|
|
||||||
{: .d-inline-block :}
|
|
||||||
|
|
||||||
Coming soon
|
|
||||||
{: .label .label-yellow :}
|
|
||||||
|
|
||||||
Hard at work on a dark theme, and more.
|
|
||||||
|
@@ -94,6 +94,12 @@ end
|
|||||||
- level 2 item
|
- level 2 item
|
||||||
- level 1 item
|
- level 1 item
|
||||||
|
|
||||||
|
### And a task list
|
||||||
|
|
||||||
|
- [ ] Hello, this is a TODO item
|
||||||
|
- [ ] Hello, this is another TODO item
|
||||||
|
- [x] Goodbye, this item is done
|
||||||
|
|
||||||
### Small image
|
### Small image
|
||||||
|
|
||||||

|

|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
layout: default
|
layout: default
|
||||||
title: Navigation Structure
|
title: Navigation Structure
|
||||||
nav_order: 4
|
nav_order: 5
|
||||||
---
|
---
|
||||||
|
|
||||||
# Navigation Structure
|
# Navigation Structure
|
||||||
@@ -17,16 +17,18 @@ nav_order: 4
|
|||||||
|
|
||||||
## Main navigation
|
## Main navigation
|
||||||
|
|
||||||
The main navigation for your Just the Docs site is on the left side of the page at large screens and on the top (behind a tap) on small screens. The main navigation can be structured to accommodate a multi-level menu system (parent pages with children).
|
The main navigation for your Just the Docs site is on the left side of the page at large screens and on the top (behind a tap) on small screens. The main navigation can be structured to accommodate a multi-level menu system (pages with children and grandchildren).
|
||||||
|
|
||||||
### Top level pages
|
By default, all pages will appear as top level pages in the main nav unless a parent page is defined (see [Pages with Children](#pages-with-children)).
|
||||||
|
|
||||||
By default, all pages will appear as top level pages in the main nav.
|
---
|
||||||
|
|
||||||
### Ordering pages
|
## Ordering pages
|
||||||
|
|
||||||
To specify a page order, use the `nav_order` variable in your pages' YAML front matter.
|
To specify a page order, use the `nav_order` variable in your pages' YAML front matter.
|
||||||
|
|
||||||
|
#### Example
|
||||||
|
{: .no_toc }
|
||||||
```yaml
|
```yaml
|
||||||
---
|
---
|
||||||
layout: default
|
layout: default
|
||||||
@@ -35,9 +37,27 @@ nav_order: 4
|
|||||||
---
|
---
|
||||||
```
|
```
|
||||||
|
|
||||||
### Pages with children
|
---
|
||||||
|
|
||||||
Sometimes you will want to create a page with many children (a section). To accomplish this you need to a few things. First, it is recommended that you keep pages that are related in a directory together... For example, in these docs, we keep all of the written documentation in the `./docs` directory and each of the sections in subdirectories like `./docs/ui-components` and `./docs/utilities`. This gives is an organization like:
|
## Excluding pages
|
||||||
|
|
||||||
|
For specific pages that you do not wish to include in the main navigation, e.g. a 404 page or a landing page. Use the `nav_exclude: true` parameter in the YAML front matter for that page.
|
||||||
|
|
||||||
|
#### Example
|
||||||
|
{: .no_toc }
|
||||||
|
```yaml
|
||||||
|
---
|
||||||
|
layout: default
|
||||||
|
title: 404
|
||||||
|
nav_exclude: true
|
||||||
|
---
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Pages with children
|
||||||
|
|
||||||
|
Sometimes you will want to create a page with many children (a section). First, it is recommended that you keep pages that are related in a directory together... For example, in these docs, we keep all of the written documentation in the `./docs` directory and each of the sections in subdirectories like `./docs/ui-components` and `./docs/utilities`. This gives is an organization like:
|
||||||
|
|
||||||
```
|
```
|
||||||
+-- ..
|
+-- ..
|
||||||
@@ -66,45 +86,105 @@ Sometimes you will want to create a page with many children (a section). To acco
|
|||||||
+-- ..
|
+-- ..
|
||||||
```
|
```
|
||||||
|
|
||||||
On the parent pages, add 3 YAML front matter variables:
|
On the parent pages, add 2 YAML front matter variables:
|
||||||
- `has_children: true` (tells us that this a parent page)
|
- `has_children: true` (tells us that this a parent page)
|
||||||
- `parent: ` set this to the title of the parent page (in this case, it's this page's title)
|
- `permalink:` set this to the site directories that the contains the pages
|
||||||
- `permalink: ` set this to the directory that the contains the pages
|
|
||||||
|
|
||||||
#### Example
|
#### Example
|
||||||
{: .no_toc }
|
{: .no_toc }
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
|
---
|
||||||
layout: default
|
layout: default
|
||||||
title: UI Components
|
title: UI Components
|
||||||
nav_order: 2
|
nav_order: 2
|
||||||
has_children: true
|
has_children: true
|
||||||
parent: UI Components
|
permalink: /docs/ui-components
|
||||||
permalink: /ui-components
|
---
|
||||||
```
|
```
|
||||||
|
|
||||||
Here we're setting up the UI Components landing page that is available at `/ui-components`, has children and is ordered second in the main nav.
|
Here we're setting up the UI Components landing page that is available at `/docs/ui-components`, it has children and is ordered second in the main nav.
|
||||||
|
|
||||||
### Child pages
|
### Child pages
|
||||||
|
{: .text-gamma }
|
||||||
|
|
||||||
On child pages, simply set the `parent:` YAML front matter to whatever the parent's page title is and set a nav order (this number is now scoped within the section).
|
On child pages, simply set the `parent:` YAML front matter to whatever the parent's page title is and set a nav order (this number is now scoped within the section).
|
||||||
|
|
||||||
#### Example
|
#### Example
|
||||||
{: .no_toc }
|
{: .no_toc }
|
||||||
```yaml
|
```yaml
|
||||||
|
---
|
||||||
layout: default
|
layout: default
|
||||||
title: Buttons
|
title: Buttons
|
||||||
parent: UI Components
|
parent: UI Components
|
||||||
nav_order: 2
|
nav_order: 2
|
||||||
|
---
|
||||||
```
|
```
|
||||||
|
|
||||||
The Buttons page appears a child of UI Components and appears second in the UI Components section.
|
The Buttons page appears a child of UI Components and appears second in the UI Components section.
|
||||||
|
|
||||||
|
### Children with children
|
||||||
|
{: .text-gamma }
|
||||||
|
|
||||||
|
Child pages can also have children (grand children). This is achieved by using a similar pattern on the child and grand child pages.
|
||||||
|
|
||||||
|
1. Add the `has_children` attribute to the child
|
||||||
|
1. Add the `parent` and `grand_parent` attribute to the grandchild
|
||||||
|
|
||||||
|
#### Example
|
||||||
|
{: .no_toc }
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
---
|
||||||
|
layout: default
|
||||||
|
title: Buttons
|
||||||
|
parent: UI Components
|
||||||
|
nav_order: 2
|
||||||
|
has_children: true
|
||||||
|
---
|
||||||
|
```
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
---
|
||||||
|
layout: default
|
||||||
|
title: Buttons Child Page
|
||||||
|
parent: Buttons
|
||||||
|
grand_parent: UI Components
|
||||||
|
nav_order: 1
|
||||||
|
---
|
||||||
|
```
|
||||||
|
|
||||||
|
Would create the following navigation structure:
|
||||||
|
|
||||||
|
```
|
||||||
|
+-- ..
|
||||||
|
|
|
||||||
|
|-- UI Components
|
||||||
|
| |-- ..
|
||||||
|
| |
|
||||||
|
| |-- Buttons
|
||||||
|
| | |-- Button Child Page
|
||||||
|
| |
|
||||||
|
| |-- ..
|
||||||
|
|
|
||||||
|
+-- ..
|
||||||
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Breadcrumbs
|
## Auxiliary Navigation
|
||||||
|
|
||||||
Breadcrumbs are auto generated based on the parent/child structure and the directory structure for the site. In order for breadcrumbs to work correctly for pages children, the URL structure must be the slugified version of the parent page's title. For example, the page UI Components, must use the `/ui-components` directory to house its descendant pages.
|
To add a auxiliary navigation item to your site (in the upper right on all pages), add it to the `aux_nav` [configuration option]({{ site.baseurl }}{% link docs/configuration.md %}#aux-nav) in your site's `_config.yml` file.
|
||||||
|
|
||||||
|
#### Example
|
||||||
|
{: .no_toc }
|
||||||
|
|
||||||
|
```yml
|
||||||
|
# Aux links for the upper right navigation
|
||||||
|
aux_links:
|
||||||
|
"Just the Docs on GitHub":
|
||||||
|
- "//github.com/pmarsceill/just-the-docs"
|
||||||
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
layout: default
|
layout: default
|
||||||
title: Search
|
title: Search
|
||||||
nav_order: 6
|
nav_order: 7
|
||||||
---
|
---
|
||||||
|
|
||||||
# Search
|
# Search
|
||||||
@@ -12,7 +12,9 @@ Just the docs uses [lunr.js](http://lunrjs.com) to add a client-side search inte
|
|||||||
- Page content
|
- Page content
|
||||||
- Page URL
|
- Page URL
|
||||||
|
|
||||||
## Setup search
|
## Set up search
|
||||||
|
|
||||||
|
### 1. Generate search index
|
||||||
|
|
||||||
Before you can use search, you must initialize the feature by running this
|
Before you can use search, you must initialize the feature by running this
|
||||||
rake command that comes with the `just-the-docs`
|
rake command that comes with the `just-the-docs`
|
||||||
@@ -23,7 +25,7 @@ $ bundle exec just-the-docs rake search:init
|
|||||||
|
|
||||||
This command creates the `search-data.json` file that Jekyll uses to create
|
This command creates the `search-data.json` file that Jekyll uses to create
|
||||||
your search index. Alternatively, you can create the file manually in the
|
your search index. Alternatively, you can create the file manually in the
|
||||||
root of your Jekyll site with this content:
|
`assets/js/` of your Jekyll site with this content:
|
||||||
|
|
||||||
```{% raw %}
|
```{% raw %}
|
||||||
---
|
---
|
||||||
@@ -33,10 +35,20 @@ root of your Jekyll site with this content:
|
|||||||
"id": "{{ forloop.index0 }}",
|
"id": "{{ forloop.index0 }}",
|
||||||
"title": "{{ page.title | xml_escape }}",
|
"title": "{{ page.title | xml_escape }}",
|
||||||
"content": "{{ page.content | markdownify | strip_html | xml_escape | remove: 'Table of contents' | remove: page.title | strip_newlines | replace: '\', ' '}}",
|
"content": "{{ page.content | markdownify | strip_html | xml_escape | remove: 'Table of contents' | remove: page.title | strip_newlines | replace: '\', ' '}}",
|
||||||
"url": "{{ page.url | xml_escape }}"
|
"url": "{{ page.url | absolute_url | xml_escape }}",
|
||||||
|
"relUrl": "{{ page.url | xml_escape }}"
|
||||||
}{% if forloop.last %}{% else %},
|
}{% if forloop.last %}{% else %},
|
||||||
{% endif %}{% endfor %}
|
{% endif %}{% endfor %}
|
||||||
}{% endraw %}
|
}{% endraw %}
|
||||||
```
|
```
|
||||||
|
|
||||||
You can modify this by modifying the forloop in `search-data.json` and the javascript in `just-the-docs.js` on line 30.
|
_Note: If you don't run this rake command or create this file manually, search will not work (or it will use the search index data from this docs site, not your site's content)._
|
||||||
|
|
||||||
|
### 2. Enable search in configuration
|
||||||
|
|
||||||
|
In your site's `_config.yml` enable search:
|
||||||
|
|
||||||
|
```yml
|
||||||
|
# Enable or disable the site search
|
||||||
|
search_enabled: true
|
||||||
|
```
|
||||||
|
@@ -21,7 +21,6 @@ nav_order: 2
|
|||||||
### Links that look like buttons
|
### Links that look like buttons
|
||||||
|
|
||||||
<div class="code-example" markdown="1">
|
<div class="code-example" markdown="1">
|
||||||
|
|
||||||
[Link button](http://example.com/){: .btn }
|
[Link button](http://example.com/){: .btn }
|
||||||
|
|
||||||
[Link button](http://example.com/){: .btn .btn-purple }
|
[Link button](http://example.com/){: .btn .btn-purple }
|
||||||
@@ -32,7 +31,6 @@ nav_order: 2
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
```markdown
|
```markdown
|
||||||
|
|
||||||
[Link button](http://example.com/){: .btn }
|
[Link button](http://example.com/){: .btn }
|
||||||
|
|
||||||
[Link button](http://example.com/){: .btn .btn-purple }
|
[Link button](http://example.com/){: .btn .btn-purple }
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
layout: default
|
layout: default
|
||||||
title: Code
|
title: Code
|
||||||
parent: UI Components
|
parent: UI Components
|
||||||
nav_order: 5
|
nav_order: 6
|
||||||
---
|
---
|
||||||
|
|
||||||
# Code
|
# Code
|
||||||
|
@@ -31,7 +31,6 @@ Deprecated
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
```markdown
|
```markdown
|
||||||
|
|
||||||
Default label
|
Default label
|
||||||
{: .label }
|
{: .label }
|
||||||
|
|
||||||
@@ -49,5 +48,4 @@ Coming soon
|
|||||||
|
|
||||||
Deprecated
|
Deprecated
|
||||||
{: .label .label-red}
|
{: .label .label-red}
|
||||||
|
|
||||||
```
|
```
|
||||||
|
98
docs/ui-components/lists.md
Normal file
98
docs/ui-components/lists.md
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
---
|
||||||
|
layout: default
|
||||||
|
title: Lists
|
||||||
|
parent: UI Components
|
||||||
|
nav_order: 5
|
||||||
|
---
|
||||||
|
|
||||||
|
# Lists
|
||||||
|
{:.no_toc}
|
||||||
|
|
||||||
|
## Table of contents
|
||||||
|
{: .no_toc .text-delta }
|
||||||
|
|
||||||
|
1. TOC
|
||||||
|
{:toc}
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Most lists can be rendered with pure markdown...
|
||||||
|
|
||||||
|
## Unordered list
|
||||||
|
<div class="code-example" markdown="1">
|
||||||
|
- Item 1
|
||||||
|
- Item 2
|
||||||
|
- Item 3
|
||||||
|
|
||||||
|
_or_
|
||||||
|
|
||||||
|
* Item 1
|
||||||
|
* Item 2
|
||||||
|
* Item 3
|
||||||
|
</div>
|
||||||
|
```markdown
|
||||||
|
- Item 1
|
||||||
|
- Item 2
|
||||||
|
- Item 3
|
||||||
|
|
||||||
|
_or_
|
||||||
|
|
||||||
|
* Item 1
|
||||||
|
* Item 2
|
||||||
|
* Item 3
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## Ordered list
|
||||||
|
<div class="code-example" markdown="1">
|
||||||
|
1. Item 1
|
||||||
|
1. Item 2
|
||||||
|
1. Item 3
|
||||||
|
</div>
|
||||||
|
```markdown
|
||||||
|
1. Item 1
|
||||||
|
1. Item 2
|
||||||
|
1. Item 3
|
||||||
|
```
|
||||||
|
## Task list
|
||||||
|
|
||||||
|
<div class="code-example" markdown="1">
|
||||||
|
- [ ] hello, this is a todo item
|
||||||
|
- [ ] hello, this is another todo item
|
||||||
|
- [x] goodbye, this item is done
|
||||||
|
</div>
|
||||||
|
```markdown
|
||||||
|
- [ ] hello, this is a todo item
|
||||||
|
- [ ] hello, this is another todo item
|
||||||
|
- [x] goodbye, this item is done
|
||||||
|
```
|
||||||
|
|
||||||
|
## Definition list
|
||||||
|
|
||||||
|
Definition lists require HTML syntax and aren't supported with the GitHub flavored markdown compiler.
|
||||||
|
|
||||||
|
<div class="code-example" markdown="1">
|
||||||
|
<dl>
|
||||||
|
<dt>Name</dt>
|
||||||
|
<dd>Godzilla</dd>
|
||||||
|
<dt>Born</dt>
|
||||||
|
<dd>1952</dd>
|
||||||
|
<dt>Birthplace</dt>
|
||||||
|
<dd>Japan</dd>
|
||||||
|
<dt>Color</dt>
|
||||||
|
<dd>Green</dd>
|
||||||
|
</dl>
|
||||||
|
</div>
|
||||||
|
```html
|
||||||
|
<dl>
|
||||||
|
<dt>Name</dt>
|
||||||
|
<dd>Godzilla</dd>
|
||||||
|
<dt>Born</dt>
|
||||||
|
<dd>1952</dd>
|
||||||
|
<dt>Birthplace</dt>
|
||||||
|
<dd>Japan</dd>
|
||||||
|
<dt>Color</dt>
|
||||||
|
<dd>Green</dd>
|
||||||
|
</dl>
|
||||||
|
```
|
||||||
|
|
@@ -1,10 +1,9 @@
|
|||||||
---
|
---
|
||||||
layout: default
|
layout: default
|
||||||
title: UI Components
|
title: UI Components
|
||||||
nav_order: 2
|
nav_order: 3
|
||||||
has_children: true
|
has_children: true
|
||||||
parent: UI Components
|
permalink: /docs/ui-components
|
||||||
permalink: /ui-components
|
|
||||||
---
|
---
|
||||||
|
|
||||||
# UI Components
|
# UI Components
|
||||||
|
@@ -34,6 +34,7 @@ All the colors used in Just the Docs have been systemsized into a series of vari
|
|||||||
| <span class="d-inline-block p-2 mr-1 v-align-middle bg-grey-dk-000"></span> `grey-dk-000` | `.text-grey-dk-000` | `.bg-grey-dk-000` |
|
| <span class="d-inline-block p-2 mr-1 v-align-middle bg-grey-dk-000"></span> `grey-dk-000` | `.text-grey-dk-000` | `.bg-grey-dk-000` |
|
||||||
| <span class="d-inline-block p-2 mr-1 v-align-middle bg-grey-dk-100"></span> `grey-dk-100` | `.text-grey-dk-100` | `.bg-grey-dk-100` |
|
| <span class="d-inline-block p-2 mr-1 v-align-middle bg-grey-dk-100"></span> `grey-dk-100` | `.text-grey-dk-100` | `.bg-grey-dk-100` |
|
||||||
| <span class="d-inline-block p-2 mr-1 v-align-middle bg-grey-dk-200"></span> `grey-dk-200` | `.text-grey-dk-200` | `.bg-grey-dk-200` |
|
| <span class="d-inline-block p-2 mr-1 v-align-middle bg-grey-dk-200"></span> `grey-dk-200` | `.text-grey-dk-200` | `.bg-grey-dk-200` |
|
||||||
|
| <span class="d-inline-block p-2 mr-1 v-align-middle bg-grey-dk-250"></span> `grey-dk-250` | `.text-grey-dk-250` | `.bg-grey-dk-250` |
|
||||||
| <span class="d-inline-block p-2 mr-1 v-align-middle bg-grey-dk-300"></span> `grey-dk-300` | `.text-grey-dk-300` | `.bg-grey-dk-300` |
|
| <span class="d-inline-block p-2 mr-1 v-align-middle bg-grey-dk-300"></span> `grey-dk-300` | `.text-grey-dk-300` | `.bg-grey-dk-300` |
|
||||||
|
|
||||||
## Purples
|
## Purples
|
||||||
|
@@ -3,6 +3,7 @@ layout: default
|
|||||||
title: Layout
|
title: Layout
|
||||||
nav_order: 2
|
nav_order: 2
|
||||||
parent: Utilities
|
parent: Utilities
|
||||||
|
has_children: true
|
||||||
---
|
---
|
||||||
|
|
||||||
# Layout Utilities
|
# Layout Utilities
|
||||||
|
@@ -1,10 +1,9 @@
|
|||||||
---
|
---
|
||||||
layout: default
|
layout: default
|
||||||
title: Utilities
|
title: Utilities
|
||||||
nav_order: 3
|
nav_order: 4
|
||||||
parent: Utilities
|
|
||||||
has_children: true
|
has_children: true
|
||||||
permalink: /utilities
|
permalink: docs/utilities
|
||||||
---
|
---
|
||||||
|
|
||||||
# Utilities
|
# Utilities
|
||||||
|
18
index.md
18
index.md
@@ -2,6 +2,7 @@
|
|||||||
layout: default
|
layout: default
|
||||||
title: Home
|
title: Home
|
||||||
nav_order: 1
|
nav_order: 1
|
||||||
|
permalink: /
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
@@ -11,7 +12,7 @@ nav_order: 1
|
|||||||
Just the Docs gives your documentation a jumpstart with a responsive Jekyll theme that is easily customizable and hosted on GitHub pages.
|
Just the Docs gives your documentation a jumpstart with a responsive Jekyll theme that is easily customizable and hosted on GitHub pages.
|
||||||
{: .fs-6 .fw-300 }
|
{: .fs-6 .fw-300 }
|
||||||
|
|
||||||
[Get started now](#getting-started){: .btn .btn-purple .fs-5 .mb-4 .mb-md-0 .mr-2 } [View it on GitHub](https://github.com/pmarsceill/just-the-docs){: .btn .fs-5 }
|
[Get started now](#getting-started){: .btn .btn-primary .fs-5 .mb-4 .mb-md-0 .mr-2 } [View it on GitHub](https://github.com/pmarsceill/just-the-docs){: .btn .fs-5 }
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -19,7 +20,14 @@ Just the Docs gives your documentation a jumpstart with a responsive Jekyll them
|
|||||||
### Dependencies
|
### Dependencies
|
||||||
Just the Docs is built for [Jekyll](https://jekyllrb.com), a static site generator. View the [quick start guide](https://jekyllrb.com/docs/quickstart/) for more information. Just the Docs requires no special Jekyll plugins and can run on GitHub Pages standard Jekyll compiler.
|
Just the Docs is built for [Jekyll](https://jekyllrb.com), a static site generator. View the [quick start guide](https://jekyllrb.com/docs/quickstart/) for more information. Just the Docs requires no special Jekyll plugins and can run on GitHub Pages standard Jekyll compiler.
|
||||||
|
|
||||||
### Installation
|
### Quick start: Use as a GitHub Pages remote theme
|
||||||
|
1. Add Just the Docs to your Jekyll site's `_config.yml` as a [remote theme](https://blog.github.com/2017-11-29-use-any-theme-with-github-pages/)
|
||||||
|
```yaml
|
||||||
|
remote_theme: pmarsceill/just-the-docs
|
||||||
|
```
|
||||||
|
<small>You must have GitHub pages enabled on your repo, one or more markdown files, and a `_config.yml` file. [See an example repository](https://github.com/pmarsceill/jtd-remote)</small>
|
||||||
|
|
||||||
|
### Local installation: Use the gem-based theme
|
||||||
1. Install the Ruby Gem
|
1. Install the Ruby Gem
|
||||||
```bash
|
```bash
|
||||||
$ gem install just-the-docs
|
$ gem install just-the-docs
|
||||||
@@ -28,7 +36,7 @@ $ gem install just-the-docs
|
|||||||
# .. or add it to your your Jekyll site’s Gemfile
|
# .. or add it to your your Jekyll site’s Gemfile
|
||||||
gem "just-the-docs"
|
gem "just-the-docs"
|
||||||
```
|
```
|
||||||
2. Add Just the Docs to your Jekyll site’s `config.yml`
|
2. Add Just the Docs to your Jekyll site’s `_config.yml`
|
||||||
```yaml
|
```yaml
|
||||||
theme: "just-the-docs"
|
theme: "just-the-docs"
|
||||||
```
|
```
|
||||||
@@ -46,6 +54,10 @@ $ bundle exec jekyll serve
|
|||||||
```
|
```
|
||||||
4. Point your web browser to [http://localhost:4000](http://localhost:4000)
|
4. Point your web browser to [http://localhost:4000](http://localhost:4000)
|
||||||
|
|
||||||
|
### Configure Just the Docs
|
||||||
|
- [See configuration options]({{ site.baseurl }}{% link docs/configuration.md %})
|
||||||
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## About the project
|
## About the project
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
Gem::Specification.new do |spec|
|
Gem::Specification.new do |spec|
|
||||||
spec.name = "just-the-docs"
|
spec.name = "just-the-docs"
|
||||||
spec.version = "0.1.3"
|
spec.version = "0.1.6"
|
||||||
spec.authors = ["Patrick Marsceill"]
|
spec.authors = ["Patrick Marsceill"]
|
||||||
spec.email = ["patrick.marsceill@gmail.com"]
|
spec.email = ["patrick.marsceill@gmail.com"]
|
||||||
|
|
||||||
@@ -13,8 +13,8 @@ Gem::Specification.new do |spec|
|
|||||||
spec.files = `git ls-files -z`.split("\x0").select { |f| f.match(%r{^(assets|bin|_layouts|_includes|lib|Rakefile|_sass|LICENSE|README)}i) }
|
spec.files = `git ls-files -z`.split("\x0").select { |f| f.match(%r{^(assets|bin|_layouts|_includes|lib|Rakefile|_sass|LICENSE|README)}i) }
|
||||||
spec.executables << 'just-the-docs'
|
spec.executables << 'just-the-docs'
|
||||||
|
|
||||||
spec.add_runtime_dependency "jekyll", "~> 3.3"
|
spec.add_runtime_dependency "jekyll", "~> 3.8.5"
|
||||||
|
spec.add_runtime_dependency "rake", "~> 12.3.1"
|
||||||
|
|
||||||
spec.add_development_dependency "bundler", "~> 1.12"
|
spec.add_development_dependency "bundler", "~> 1.17.1"
|
||||||
spec.add_development_dependency "rake", "~> 10.0"
|
|
||||||
end
|
end
|
||||||
|
@@ -2,6 +2,7 @@ namespace :search do
|
|||||||
desc 'Generate the files needed for search functionality'
|
desc 'Generate the files needed for search functionality'
|
||||||
task :init do
|
task :init do
|
||||||
puts 'Creating search data json file...'
|
puts 'Creating search data json file...'
|
||||||
|
mkdir_p 'assets/js'
|
||||||
touch 'assets/js/search-data.json'
|
touch 'assets/js/search-data.json'
|
||||||
content = %Q[{{ page.content | markdownify | strip_html | xml_escape | remove: 'Table of contents' | strip_newlines | replace: '\\', ' ' }}]
|
content = %Q[{{ page.content | markdownify | strip_html | xml_escape | remove: 'Table of contents' | strip_newlines | replace: '\\', ' ' }}]
|
||||||
puts 'Done.'
|
puts 'Done.'
|
||||||
@@ -15,7 +16,8 @@ namespace :search do
|
|||||||
"id": "{{ forloop.index0 }}",
|
"id": "{{ forloop.index0 }}",
|
||||||
"title": "{{ page.title | xml_escape }}",
|
"title": "{{ page.title | xml_escape }}",
|
||||||
"content": "'+content+'",
|
"content": "'+content+'",
|
||||||
"url": "{{ page.url | xml_escape }}"
|
"url": "{{ page.url | absolute_url | xml_escape }}",
|
||||||
|
"relUrl": "{{ page.url | xml_escape }}"
|
||||||
}{% if forloop.last %}{% else %},
|
}{% if forloop.last %}{% else %},
|
||||||
{% endif %}{% endfor %}
|
{% endif %}{% endfor %}
|
||||||
}'
|
}'
|
||||||
|
1
node_modules/.bin/JSONStream
generated
vendored
1
node_modules/.bin/JSONStream
generated
vendored
@@ -1 +0,0 @@
|
|||||||
../JSONStream/index.js
|
|
1
node_modules/.bin/browserslist
generated
vendored
1
node_modules/.bin/browserslist
generated
vendored
@@ -1 +0,0 @@
|
|||||||
../browserslist/cli.js
|
|
1
node_modules/.bin/colorguard
generated
vendored
1
node_modules/.bin/colorguard
generated
vendored
@@ -1 +0,0 @@
|
|||||||
../colorguard/bin/colorguard
|
|
1
node_modules/.bin/css-rule-stream
generated
vendored
1
node_modules/.bin/css-rule-stream
generated
vendored
@@ -1 +0,0 @@
|
|||||||
../css-rule-stream/index.js
|
|
1
node_modules/.bin/doiuse
generated
vendored
1
node_modules/.bin/doiuse
generated
vendored
@@ -1 +0,0 @@
|
|||||||
../doiuse/cli.js
|
|
1
node_modules/.bin/esparse
generated
vendored
1
node_modules/.bin/esparse
generated
vendored
@@ -1 +0,0 @@
|
|||||||
../esprima/bin/esparse.js
|
|
1
node_modules/.bin/esvalidate
generated
vendored
1
node_modules/.bin/esvalidate
generated
vendored
@@ -1 +0,0 @@
|
|||||||
../esprima/bin/esvalidate.js
|
|
1
node_modules/.bin/js-yaml
generated
vendored
1
node_modules/.bin/js-yaml
generated
vendored
@@ -1 +0,0 @@
|
|||||||
../js-yaml/bin/js-yaml.js
|
|
1
node_modules/.bin/jsonfilter
generated
vendored
1
node_modules/.bin/jsonfilter
generated
vendored
@@ -1 +0,0 @@
|
|||||||
../jsonfilter/cli.js
|
|
1
node_modules/.bin/semver
generated
vendored
1
node_modules/.bin/semver
generated
vendored
@@ -1 +0,0 @@
|
|||||||
../semver/bin/semver
|
|
1
node_modules/.bin/specificity
generated
vendored
1
node_modules/.bin/specificity
generated
vendored
@@ -1 +0,0 @@
|
|||||||
../specificity/bin/specificity
|
|
1
node_modules/.bin/strip-indent
generated
vendored
1
node_modules/.bin/strip-indent
generated
vendored
@@ -1 +0,0 @@
|
|||||||
../strip-indent/cli.js
|
|
1
node_modules/.bin/stylehacks
generated
vendored
1
node_modules/.bin/stylehacks
generated
vendored
@@ -1 +0,0 @@
|
|||||||
../stylehacks/dist/cli.js
|
|
1
node_modules/.bin/stylelint
generated
vendored
1
node_modules/.bin/stylelint
generated
vendored
@@ -1 +0,0 @@
|
|||||||
../stylelint/bin/stylelint.js
|
|
1
node_modules/.bin/window-size
generated
vendored
1
node_modules/.bin/window-size
generated
vendored
@@ -1 +0,0 @@
|
|||||||
../window-size/cli.js
|
|
2
node_modules/JSONStream/.npmignore
generated
vendored
2
node_modules/JSONStream/.npmignore
generated
vendored
@@ -1,2 +0,0 @@
|
|||||||
node_modules/*
|
|
||||||
node_modules
|
|
4
node_modules/JSONStream/.travis.yml
generated
vendored
4
node_modules/JSONStream/.travis.yml
generated
vendored
@@ -1,4 +0,0 @@
|
|||||||
language: node_js
|
|
||||||
node_js:
|
|
||||||
- "0.8"
|
|
||||||
- "0.10"
|
|
15
node_modules/JSONStream/LICENSE.APACHE2
generated
vendored
15
node_modules/JSONStream/LICENSE.APACHE2
generated
vendored
@@ -1,15 +0,0 @@
|
|||||||
Apache License, Version 2.0
|
|
||||||
|
|
||||||
Copyright (c) 2011 Dominic Tarr
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
24
node_modules/JSONStream/LICENSE.MIT
generated
vendored
24
node_modules/JSONStream/LICENSE.MIT
generated
vendored
@@ -1,24 +0,0 @@
|
|||||||
The MIT License
|
|
||||||
|
|
||||||
Copyright (c) 2011 Dominic Tarr
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge,
|
|
||||||
to any person obtaining a copy of this software and
|
|
||||||
associated documentation files (the "Software"), to
|
|
||||||
deal in the Software without restriction, including
|
|
||||||
without limitation the rights to use, copy, modify,
|
|
||||||
merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom
|
|
||||||
the Software is furnished to do so,
|
|
||||||
subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice
|
|
||||||
shall be included in all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
||||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
||||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
|
||||||
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
||||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
||||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
13
node_modules/JSONStream/examples/all_docs.js
generated
vendored
13
node_modules/JSONStream/examples/all_docs.js
generated
vendored
@@ -1,13 +0,0 @@
|
|||||||
var request = require('request')
|
|
||||||
, JSONStream = require('JSONStream')
|
|
||||||
, es = require('event-stream')
|
|
||||||
|
|
||||||
var parser = JSONStream.parse(['rows', true]) //emit parts that match this path (any element of the rows array)
|
|
||||||
, req = request({url: 'http://isaacs.couchone.com/registry/_all_docs'})
|
|
||||||
, logger = es.mapSync(function (data) { //create a stream that logs to stderr,
|
|
||||||
console.error(data)
|
|
||||||
return data
|
|
||||||
})
|
|
||||||
|
|
||||||
req.pipe(parser)
|
|
||||||
parser.pipe(logger)
|
|
192
node_modules/JSONStream/index.js
generated
vendored
192
node_modules/JSONStream/index.js
generated
vendored
@@ -1,192 +0,0 @@
|
|||||||
#! /usr/bin/env node
|
|
||||||
|
|
||||||
var Parser = require('jsonparse')
|
|
||||||
, through = require('through')
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
the value of this.stack that creationix's jsonparse has is weird.
|
|
||||||
|
|
||||||
it makes this code ugly, but his problem is way harder that mine,
|
|
||||||
so i'll forgive him.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
exports.parse = function (path, map) {
|
|
||||||
|
|
||||||
var parser = new Parser()
|
|
||||||
var stream = through(function (chunk) {
|
|
||||||
if('string' === typeof chunk)
|
|
||||||
chunk = new Buffer(chunk)
|
|
||||||
parser.write(chunk)
|
|
||||||
},
|
|
||||||
function (data) {
|
|
||||||
if(data)
|
|
||||||
stream.write(data)
|
|
||||||
stream.queue(null)
|
|
||||||
})
|
|
||||||
|
|
||||||
if('string' === typeof path)
|
|
||||||
path = path.split('.').map(function (e) {
|
|
||||||
if (e === '*')
|
|
||||||
return true
|
|
||||||
else if (e === '') // '..'.split('.') returns an empty string
|
|
||||||
return {recurse: true}
|
|
||||||
else
|
|
||||||
return e
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
var count = 0, _key
|
|
||||||
if(!path || !path.length)
|
|
||||||
path = null
|
|
||||||
|
|
||||||
parser.onValue = function () {
|
|
||||||
if (!this.root && this.stack.length == 1)
|
|
||||||
stream.root = this.value
|
|
||||||
|
|
||||||
if(! path) return
|
|
||||||
|
|
||||||
var i = 0 // iterates on path
|
|
||||||
var j = 0 // iterates on stack
|
|
||||||
while (i < path.length) {
|
|
||||||
var key = path[i]
|
|
||||||
var c
|
|
||||||
j++
|
|
||||||
|
|
||||||
if (key && !key.recurse) {
|
|
||||||
c = (j === this.stack.length) ? this : this.stack[j]
|
|
||||||
if (!c) return
|
|
||||||
if (! check(key, c.key)) return
|
|
||||||
i++
|
|
||||||
} else {
|
|
||||||
i++
|
|
||||||
var nextKey = path[i]
|
|
||||||
if (! nextKey) return
|
|
||||||
while (true) {
|
|
||||||
c = (j === this.stack.length) ? this : this.stack[j]
|
|
||||||
if (!c) return
|
|
||||||
if (check(nextKey, c.key)) { i++; break}
|
|
||||||
j++
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (j !== this.stack.length) return
|
|
||||||
|
|
||||||
count ++
|
|
||||||
var data = this.value[this.key]
|
|
||||||
if(null != data)
|
|
||||||
if(null != (data = map ? map(data) : data))
|
|
||||||
stream.queue(data)
|
|
||||||
delete this.value[this.key]
|
|
||||||
}
|
|
||||||
parser._onToken = parser.onToken;
|
|
||||||
|
|
||||||
parser.onToken = function (token, value) {
|
|
||||||
parser._onToken(token, value);
|
|
||||||
if (this.stack.length === 0) {
|
|
||||||
if (stream.root) {
|
|
||||||
if(!path)
|
|
||||||
stream.queue(stream.root)
|
|
||||||
stream.emit('root', stream.root, count)
|
|
||||||
count = 0;
|
|
||||||
stream.root = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
parser.onError = function (err) {
|
|
||||||
stream.emit('error', err)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return stream
|
|
||||||
}
|
|
||||||
|
|
||||||
function check (x, y) {
|
|
||||||
if ('string' === typeof x)
|
|
||||||
return y == x
|
|
||||||
else if (x && 'function' === typeof x.exec)
|
|
||||||
return x.exec(y)
|
|
||||||
else if ('boolean' === typeof x)
|
|
||||||
return x
|
|
||||||
else if ('function' === typeof x)
|
|
||||||
return x(y)
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
exports.stringify = function (op, sep, cl, indent) {
|
|
||||||
indent = indent || 0
|
|
||||||
if (op === false){
|
|
||||||
op = ''
|
|
||||||
sep = '\n'
|
|
||||||
cl = ''
|
|
||||||
} else if (op == null) {
|
|
||||||
|
|
||||||
op = '[\n'
|
|
||||||
sep = '\n,\n'
|
|
||||||
cl = '\n]\n'
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//else, what ever you like
|
|
||||||
|
|
||||||
var stream
|
|
||||||
, first = true
|
|
||||||
, anyData = false
|
|
||||||
stream = through(function (data) {
|
|
||||||
anyData = true
|
|
||||||
var json = JSON.stringify(data, null, indent)
|
|
||||||
if(first) { first = false ; stream.queue(op + json)}
|
|
||||||
else stream.queue(sep + json)
|
|
||||||
},
|
|
||||||
function (data) {
|
|
||||||
if(!anyData)
|
|
||||||
stream.queue(op)
|
|
||||||
stream.queue(cl)
|
|
||||||
stream.queue(null)
|
|
||||||
})
|
|
||||||
|
|
||||||
return stream
|
|
||||||
}
|
|
||||||
|
|
||||||
exports.stringifyObject = function (op, sep, cl, indent) {
|
|
||||||
indent = indent || 0
|
|
||||||
if (op === false){
|
|
||||||
op = ''
|
|
||||||
sep = '\n'
|
|
||||||
cl = ''
|
|
||||||
} else if (op == null) {
|
|
||||||
|
|
||||||
op = '{\n'
|
|
||||||
sep = '\n,\n'
|
|
||||||
cl = '\n}\n'
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//else, what ever you like
|
|
||||||
|
|
||||||
var first = true
|
|
||||||
, anyData = false
|
|
||||||
stream = through(function (data) {
|
|
||||||
anyData = true
|
|
||||||
var json = JSON.stringify(data[0]) + ':' + JSON.stringify(data[1], null, indent)
|
|
||||||
if(first) { first = false ; this.queue(op + json)}
|
|
||||||
else this.queue(sep + json)
|
|
||||||
},
|
|
||||||
function (data) {
|
|
||||||
if(!anyData) this.queue(op)
|
|
||||||
this.queue(cl)
|
|
||||||
|
|
||||||
this.queue(null)
|
|
||||||
})
|
|
||||||
|
|
||||||
return stream
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!module.parent && process.title !== 'browser') {
|
|
||||||
process.stdin
|
|
||||||
.pipe(exports.parse(process.argv[2]))
|
|
||||||
.pipe(exports.stringify('[', ',\n', ']\n', 2))
|
|
||||||
.pipe(process.stdout)
|
|
||||||
}
|
|
93
node_modules/JSONStream/package.json
generated
vendored
93
node_modules/JSONStream/package.json
generated
vendored
@@ -1,93 +0,0 @@
|
|||||||
{
|
|
||||||
"_args": [
|
|
||||||
[
|
|
||||||
"JSONStream@^0.8.4",
|
|
||||||
"/Users/pmarsceill/_projects/just-the-docs/node_modules/jsonfilter"
|
|
||||||
]
|
|
||||||
],
|
|
||||||
"_from": "JSONStream@>=0.8.4 <0.9.0",
|
|
||||||
"_id": "JSONStream@0.8.4",
|
|
||||||
"_inCache": true,
|
|
||||||
"_installable": true,
|
|
||||||
"_location": "/JSONStream",
|
|
||||||
"_npmUser": {
|
|
||||||
"email": "dominic.tarr@gmail.com",
|
|
||||||
"name": "dominictarr"
|
|
||||||
},
|
|
||||||
"_npmVersion": "1.4.9",
|
|
||||||
"_phantomChildren": {},
|
|
||||||
"_requested": {
|
|
||||||
"name": "JSONStream",
|
|
||||||
"raw": "JSONStream@^0.8.4",
|
|
||||||
"rawSpec": "^0.8.4",
|
|
||||||
"scope": null,
|
|
||||||
"spec": ">=0.8.4 <0.9.0",
|
|
||||||
"type": "range"
|
|
||||||
},
|
|
||||||
"_requiredBy": [
|
|
||||||
"/jsonfilter"
|
|
||||||
],
|
|
||||||
"_resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-0.8.4.tgz",
|
|
||||||
"_shasum": "91657dfe6ff857483066132b4618b62e8f4887bd",
|
|
||||||
"_shrinkwrap": null,
|
|
||||||
"_spec": "JSONStream@^0.8.4",
|
|
||||||
"_where": "/Users/pmarsceill/_projects/just-the-docs/node_modules/jsonfilter",
|
|
||||||
"author": {
|
|
||||||
"email": "dominic.tarr@gmail.com",
|
|
||||||
"name": "Dominic Tarr",
|
|
||||||
"url": "http://bit.ly/dominictarr"
|
|
||||||
},
|
|
||||||
"bin": {
|
|
||||||
"JSONStream": "./index.js"
|
|
||||||
},
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/dominictarr/JSONStream/issues"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"jsonparse": "0.0.5",
|
|
||||||
"through": ">=2.2.7 <3"
|
|
||||||
},
|
|
||||||
"description": "rawStream.pipe(JSONStream.parse()).pipe(streamOfObjects)",
|
|
||||||
"devDependencies": {
|
|
||||||
"assertions": "~2.2.2",
|
|
||||||
"event-stream": "~0.7.0",
|
|
||||||
"it-is": "~1",
|
|
||||||
"render": "~0.1.1",
|
|
||||||
"tape": "~2.12.3",
|
|
||||||
"trees": "~0.0.3"
|
|
||||||
},
|
|
||||||
"directories": {},
|
|
||||||
"dist": {
|
|
||||||
"shasum": "91657dfe6ff857483066132b4618b62e8f4887bd",
|
|
||||||
"tarball": "https://registry.npmjs.org/JSONStream/-/JSONStream-0.8.4.tgz"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": "*"
|
|
||||||
},
|
|
||||||
"homepage": "http://github.com/dominictarr/JSONStream",
|
|
||||||
"keywords": [
|
|
||||||
"async",
|
|
||||||
"json",
|
|
||||||
"parser",
|
|
||||||
"parsing",
|
|
||||||
"stream",
|
|
||||||
"streaming"
|
|
||||||
],
|
|
||||||
"maintainers": [
|
|
||||||
{
|
|
||||||
"name": "dominictarr",
|
|
||||||
"email": "dominic.tarr@gmail.com"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"name": "JSONStream",
|
|
||||||
"optionalDependencies": {},
|
|
||||||
"readme": "ERROR: No README data found!",
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git://github.com/dominictarr/JSONStream.git"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"test": "set -e; for t in test/*.js; do echo '***' $t '***'; node $t; done"
|
|
||||||
},
|
|
||||||
"version": "0.8.4"
|
|
||||||
}
|
|
178
node_modules/JSONStream/readme.markdown
generated
vendored
178
node_modules/JSONStream/readme.markdown
generated
vendored
@@ -1,178 +0,0 @@
|
|||||||
# JSONStream
|
|
||||||
|
|
||||||
streaming JSON.parse and stringify
|
|
||||||
|
|
||||||
<img src=https://secure.travis-ci.org/dominictarr/JSONStream.png?branch=master>
|
|
||||||
|
|
||||||
## example
|
|
||||||
|
|
||||||
``` js
|
|
||||||
|
|
||||||
var request = require('request')
|
|
||||||
, JSONStream = require('JSONStream')
|
|
||||||
, es = require('event-stream')
|
|
||||||
|
|
||||||
request({url: 'http://isaacs.couchone.com/registry/_all_docs'})
|
|
||||||
.pipe(JSONStream.parse('rows.*'))
|
|
||||||
.pipe(es.mapSync(function (data) {
|
|
||||||
console.error(data)
|
|
||||||
return data
|
|
||||||
}))
|
|
||||||
```
|
|
||||||
|
|
||||||
## JSONStream.parse(path)
|
|
||||||
|
|
||||||
parse stream of values that match a path
|
|
||||||
|
|
||||||
``` js
|
|
||||||
JSONStream.parse('rows.*.doc')
|
|
||||||
```
|
|
||||||
|
|
||||||
The `..` operator is the recursive descent operator from [JSONPath](http://goessner.net/articles/JsonPath/), which will match a child at any depth (see examples below).
|
|
||||||
|
|
||||||
If your keys have keys that include `.` or `*` etc, use an array instead.
|
|
||||||
`['row', true, /^doc/]`.
|
|
||||||
|
|
||||||
If you use an array, `RegExp`s, booleans, and/or functions. The `..` operator is also available in array representation, using `{recurse: true}`.
|
|
||||||
any object that matches the path will be emitted as 'data' (and `pipe`d down stream)
|
|
||||||
|
|
||||||
If `path` is empty or null, no 'data' events are emitted.
|
|
||||||
|
|
||||||
### Examples
|
|
||||||
|
|
||||||
query a couchdb view:
|
|
||||||
|
|
||||||
``` bash
|
|
||||||
curl -sS localhost:5984/tests/_all_docs&include_docs=true
|
|
||||||
```
|
|
||||||
you will get something like this:
|
|
||||||
|
|
||||||
``` js
|
|
||||||
{"total_rows":129,"offset":0,"rows":[
|
|
||||||
{ "id":"change1_0.6995461115147918"
|
|
||||||
, "key":"change1_0.6995461115147918"
|
|
||||||
, "value":{"rev":"1-e240bae28c7bb3667f02760f6398d508"}
|
|
||||||
, "doc":{
|
|
||||||
"_id": "change1_0.6995461115147918"
|
|
||||||
, "_rev": "1-e240bae28c7bb3667f02760f6398d508","hello":1}
|
|
||||||
},
|
|
||||||
{ "id":"change2_0.6995461115147918"
|
|
||||||
, "key":"change2_0.6995461115147918"
|
|
||||||
, "value":{"rev":"1-13677d36b98c0c075145bb8975105153"}
|
|
||||||
, "doc":{
|
|
||||||
"_id":"change2_0.6995461115147918"
|
|
||||||
, "_rev":"1-13677d36b98c0c075145bb8975105153"
|
|
||||||
, "hello":2
|
|
||||||
}
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
we are probably most interested in the `rows.*.docs`
|
|
||||||
|
|
||||||
create a `Stream` that parses the documents from the feed like this:
|
|
||||||
|
|
||||||
``` js
|
|
||||||
var stream = JSONStream.parse(['rows', true, 'doc']) //rows, ANYTHING, doc
|
|
||||||
|
|
||||||
stream.on('data', function(data) {
|
|
||||||
console.log('received:', data);
|
|
||||||
});
|
|
||||||
|
|
||||||
stream.on('root', function(root, count) {
|
|
||||||
if (!count) {
|
|
||||||
console.log('no matches found:', root);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
```
|
|
||||||
awesome!
|
|
||||||
|
|
||||||
### recursive patterns (..)
|
|
||||||
|
|
||||||
`JSONStream.parser('docs..value')`
|
|
||||||
(or `JSONStream.parser(['docs', {recurse: true}, 'value'])` using an array)
|
|
||||||
will emit every `value` object that is a child, grand-child, etc. of the
|
|
||||||
`docs` object. In this example, it will match exactly 5 times at various depth
|
|
||||||
levels, emitting 0, 1, 2, 3 and 4 as results.
|
|
||||||
|
|
||||||
```js
|
|
||||||
{
|
|
||||||
"total": 5,
|
|
||||||
"docs": [
|
|
||||||
{
|
|
||||||
"key": {
|
|
||||||
"value": 0,
|
|
||||||
"some": "property"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{"value": 1},
|
|
||||||
{"value": 2},
|
|
||||||
{"blbl": [{}, {"a":0, "b":1, "value":3}, 10]},
|
|
||||||
{"value": 4}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## JSONStream.parse(pattern, map)
|
|
||||||
|
|
||||||
provide a function that can be used to map or filter
|
|
||||||
the json output. `map` is passed the value at that node of the pattern,
|
|
||||||
if `map` return non-nullish (anything but `null` or `undefined`)
|
|
||||||
that value will be emitted in the stream. If it returns a nullish value,
|
|
||||||
nothing will be emitted.
|
|
||||||
|
|
||||||
## JSONStream.stringify(open, sep, close)
|
|
||||||
|
|
||||||
Create a writable stream.
|
|
||||||
|
|
||||||
you may pass in custom `open`, `close`, and `seperator` strings.
|
|
||||||
But, by default, `JSONStream.stringify()` will create an array,
|
|
||||||
(with default options `open='[\n', sep='\n,\n', close='\n]\n'`)
|
|
||||||
|
|
||||||
If you call `JSONStream.stringify(false)`
|
|
||||||
the elements will only be seperated by a newline.
|
|
||||||
|
|
||||||
If you only write one item this will be valid JSON.
|
|
||||||
|
|
||||||
If you write many items,
|
|
||||||
you can use a `RegExp` to split it into valid chunks.
|
|
||||||
|
|
||||||
## JSONStream.stringifyObject(open, sep, close)
|
|
||||||
|
|
||||||
Very much like `JSONStream.stringify`,
|
|
||||||
but creates a writable stream for objects instead of arrays.
|
|
||||||
|
|
||||||
Accordingly, `open='{\n', sep='\n,\n', close='\n}\n'`.
|
|
||||||
|
|
||||||
When you `.write()` to the stream you must supply an array with `[ key, data ]`
|
|
||||||
as the first argument.
|
|
||||||
|
|
||||||
## unix tool
|
|
||||||
|
|
||||||
query npm to see all the modules that browserify has ever depended on.
|
|
||||||
|
|
||||||
``` bash
|
|
||||||
curl https://registry.npmjs.org/browserify | JSONStream 'versions.*.dependencies'
|
|
||||||
```
|
|
||||||
|
|
||||||
## numbers
|
|
||||||
|
|
||||||
There are occasional problems parsing and unparsing very precise numbers.
|
|
||||||
|
|
||||||
I have opened an issue here:
|
|
||||||
|
|
||||||
https://github.com/creationix/jsonparse/issues/2
|
|
||||||
|
|
||||||
+1
|
|
||||||
|
|
||||||
## Acknowlegements
|
|
||||||
|
|
||||||
this module depends on https://github.com/creationix/jsonparse
|
|
||||||
by Tim Caswell
|
|
||||||
and also thanks to Florent Jaby for teaching me about parsing with:
|
|
||||||
https://github.com/Floby/node-json-streams
|
|
||||||
|
|
||||||
## license
|
|
||||||
|
|
||||||
MIT / APACHE2
|
|
41
node_modules/JSONStream/test/bool.js
generated
vendored
41
node_modules/JSONStream/test/bool.js
generated
vendored
@@ -1,41 +0,0 @@
|
|||||||
|
|
||||||
var fs = require ('fs')
|
|
||||||
, join = require('path').join
|
|
||||||
, file = join(__dirname, 'fixtures','all_npm.json')
|
|
||||||
, JSONStream = require('../')
|
|
||||||
, it = require('it-is').style('colour')
|
|
||||||
|
|
||||||
function randomObj () {
|
|
||||||
return (
|
|
||||||
Math.random () < 0.4
|
|
||||||
? {hello: 'eonuhckmqjk',
|
|
||||||
whatever: 236515,
|
|
||||||
lies: true,
|
|
||||||
nothing: [null],
|
|
||||||
// stuff: [Math.random(),Math.random(),Math.random()]
|
|
||||||
}
|
|
||||||
: ['AOREC', 'reoubaor', {ouec: 62642}, [[[], {}, 53]]]
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
var expected = []
|
|
||||||
, stringify = JSONStream.stringify()
|
|
||||||
, es = require('event-stream')
|
|
||||||
, stringified = ''
|
|
||||||
, called = 0
|
|
||||||
, count = 10
|
|
||||||
, ended = false
|
|
||||||
|
|
||||||
while (count --)
|
|
||||||
expected.push(randomObj())
|
|
||||||
|
|
||||||
es.connect(
|
|
||||||
es.readArray(expected),
|
|
||||||
stringify,
|
|
||||||
JSONStream.parse([true]),
|
|
||||||
es.writeArray(function (err, lines) {
|
|
||||||
|
|
||||||
it(lines).has(expected)
|
|
||||||
console.error('PASSED')
|
|
||||||
})
|
|
||||||
)
|
|
18
node_modules/JSONStream/test/browser.js
generated
vendored
18
node_modules/JSONStream/test/browser.js
generated
vendored
@@ -1,18 +0,0 @@
|
|||||||
var test = require('tape')
|
|
||||||
var JSONStream = require('../')
|
|
||||||
var testData = '{"rows":[{"hello":"world"}, {"foo": "bar"}]}'
|
|
||||||
|
|
||||||
test('basic parsing', function (t) {
|
|
||||||
t.plan(2)
|
|
||||||
var parsed = JSONStream.parse("rows.*")
|
|
||||||
var parsedKeys = {}
|
|
||||||
parsed.on('data', function(match) {
|
|
||||||
parsedKeys[Object.keys(match)[0]] = true
|
|
||||||
})
|
|
||||||
parsed.on('end', function() {
|
|
||||||
t.equal(!!parsedKeys['hello'], true)
|
|
||||||
t.equal(!!parsedKeys['foo'], true)
|
|
||||||
})
|
|
||||||
parsed.write(testData)
|
|
||||||
parsed.end()
|
|
||||||
})
|
|
27
node_modules/JSONStream/test/destroy_missing.js
generated
vendored
27
node_modules/JSONStream/test/destroy_missing.js
generated
vendored
@@ -1,27 +0,0 @@
|
|||||||
var fs = require ('fs');
|
|
||||||
var net = require('net');
|
|
||||||
var join = require('path').join;
|
|
||||||
var file = join(__dirname, 'fixtures','all_npm.json');
|
|
||||||
var JSONStream = require('../');
|
|
||||||
|
|
||||||
|
|
||||||
var server = net.createServer(function(client) {
|
|
||||||
var parser = JSONStream.parse([]);
|
|
||||||
parser.on('end', function() {
|
|
||||||
console.log('close')
|
|
||||||
console.error('PASSED');
|
|
||||||
server.close();
|
|
||||||
});
|
|
||||||
client.pipe(parser);
|
|
||||||
var n = 4
|
|
||||||
client.on('data', function () {
|
|
||||||
if(--n) return
|
|
||||||
client.end();
|
|
||||||
})
|
|
||||||
});
|
|
||||||
server.listen(9999);
|
|
||||||
|
|
||||||
|
|
||||||
var client = net.connect({ port : 9999 }, function() {
|
|
||||||
fs.createReadStream(file).pipe(client).on('data', console.log) //.resume();
|
|
||||||
});
|
|
29
node_modules/JSONStream/test/doubledot1.js
generated
vendored
29
node_modules/JSONStream/test/doubledot1.js
generated
vendored
@@ -1,29 +0,0 @@
|
|||||||
var fs = require ('fs')
|
|
||||||
, join = require('path').join
|
|
||||||
, file = join(__dirname, 'fixtures','all_npm.json')
|
|
||||||
, JSONStream = require('../')
|
|
||||||
, it = require('it-is')
|
|
||||||
|
|
||||||
var expected = JSON.parse(fs.readFileSync(file))
|
|
||||||
, parser = JSONStream.parse('rows..rev')
|
|
||||||
, called = 0
|
|
||||||
, ended = false
|
|
||||||
, parsed = []
|
|
||||||
|
|
||||||
fs.createReadStream(file).pipe(parser)
|
|
||||||
|
|
||||||
parser.on('data', function (data) {
|
|
||||||
called ++
|
|
||||||
parsed.push(data)
|
|
||||||
})
|
|
||||||
|
|
||||||
parser.on('end', function () {
|
|
||||||
ended = true
|
|
||||||
})
|
|
||||||
|
|
||||||
process.on('exit', function () {
|
|
||||||
it(called).equal(expected.rows.length)
|
|
||||||
for (var i = 0 ; i < expected.rows.length ; i++)
|
|
||||||
it(parsed[i]).deepEqual(expected.rows[i].value.rev)
|
|
||||||
console.error('PASSED')
|
|
||||||
})
|
|
29
node_modules/JSONStream/test/doubledot2.js
generated
vendored
29
node_modules/JSONStream/test/doubledot2.js
generated
vendored
@@ -1,29 +0,0 @@
|
|||||||
var fs = require ('fs')
|
|
||||||
, join = require('path').join
|
|
||||||
, file = join(__dirname, 'fixtures','depth.json')
|
|
||||||
, JSONStream = require('../')
|
|
||||||
, it = require('it-is')
|
|
||||||
|
|
||||||
var expected = JSON.parse(fs.readFileSync(file))
|
|
||||||
, parser = JSONStream.parse(['docs', {recurse: true}, 'value'])
|
|
||||||
, called = 0
|
|
||||||
, ended = false
|
|
||||||
, parsed = []
|
|
||||||
|
|
||||||
fs.createReadStream(file).pipe(parser)
|
|
||||||
|
|
||||||
parser.on('data', function (data) {
|
|
||||||
called ++
|
|
||||||
parsed.push(data)
|
|
||||||
})
|
|
||||||
|
|
||||||
parser.on('end', function () {
|
|
||||||
ended = true
|
|
||||||
})
|
|
||||||
|
|
||||||
process.on('exit', function () {
|
|
||||||
it(called).equal(5)
|
|
||||||
for (var i = 0 ; i < 5 ; i++)
|
|
||||||
it(parsed[i]).deepEqual(i)
|
|
||||||
console.error('PASSED')
|
|
||||||
})
|
|
44
node_modules/JSONStream/test/empty.js
generated
vendored
44
node_modules/JSONStream/test/empty.js
generated
vendored
@@ -1,44 +0,0 @@
|
|||||||
var JSONStream = require('../')
|
|
||||||
, stream = require('stream')
|
|
||||||
, it = require('it-is')
|
|
||||||
|
|
||||||
var output = [ [], [] ]
|
|
||||||
|
|
||||||
var parser1 = JSONStream.parse(['docs', /./])
|
|
||||||
parser1.on('data', function(data) {
|
|
||||||
output[0].push(data)
|
|
||||||
})
|
|
||||||
|
|
||||||
var parser2 = JSONStream.parse(['docs', /./])
|
|
||||||
parser2.on('data', function(data) {
|
|
||||||
output[1].push(data)
|
|
||||||
})
|
|
||||||
|
|
||||||
var pending = 2
|
|
||||||
function onend () {
|
|
||||||
if (--pending > 0) return
|
|
||||||
it(output).deepEqual([
|
|
||||||
[], [{hello: 'world'}]
|
|
||||||
])
|
|
||||||
console.error('PASSED')
|
|
||||||
}
|
|
||||||
parser1.on('end', onend)
|
|
||||||
parser2.on('end', onend)
|
|
||||||
|
|
||||||
function makeReadableStream() {
|
|
||||||
var readStream = new stream.Stream()
|
|
||||||
readStream.readable = true
|
|
||||||
readStream.write = function (data) { this.emit('data', data) }
|
|
||||||
readStream.end = function (data) { this.emit('end') }
|
|
||||||
return readStream
|
|
||||||
}
|
|
||||||
|
|
||||||
var emptyArray = makeReadableStream()
|
|
||||||
emptyArray.pipe(parser1)
|
|
||||||
emptyArray.write('{"docs":[]}')
|
|
||||||
emptyArray.end()
|
|
||||||
|
|
||||||
var objectArray = makeReadableStream()
|
|
||||||
objectArray.pipe(parser2)
|
|
||||||
objectArray.write('{"docs":[{"hello":"world"}]}')
|
|
||||||
objectArray.end()
|
|
4030
node_modules/JSONStream/test/fixtures/all_npm.json
generated
vendored
4030
node_modules/JSONStream/test/fixtures/all_npm.json
generated
vendored
File diff suppressed because it is too large
Load Diff
15
node_modules/JSONStream/test/fixtures/depth.json
generated
vendored
15
node_modules/JSONStream/test/fixtures/depth.json
generated
vendored
@@ -1,15 +0,0 @@
|
|||||||
{
|
|
||||||
"total": 5,
|
|
||||||
"docs": [
|
|
||||||
{
|
|
||||||
"key": {
|
|
||||||
"value": 0,
|
|
||||||
"some": "property"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{"value": 1},
|
|
||||||
{"value": 2},
|
|
||||||
{"blbl": [{}, {"a":0, "b":1, "value":3}, 10]},
|
|
||||||
{"value": 4}
|
|
||||||
]
|
|
||||||
}
|
|
39
node_modules/JSONStream/test/fn.js
generated
vendored
39
node_modules/JSONStream/test/fn.js
generated
vendored
@@ -1,39 +0,0 @@
|
|||||||
|
|
||||||
|
|
||||||
var fs = require ('fs')
|
|
||||||
, join = require('path').join
|
|
||||||
, file = join(__dirname, 'fixtures','all_npm.json')
|
|
||||||
, JSONStream = require('../')
|
|
||||||
, it = require('it-is')
|
|
||||||
|
|
||||||
function fn (s) {
|
|
||||||
return !isNaN(parseInt(s, 10))
|
|
||||||
}
|
|
||||||
|
|
||||||
var expected = JSON.parse(fs.readFileSync(file))
|
|
||||||
, parser = JSONStream.parse(['rows', fn])
|
|
||||||
, called = 0
|
|
||||||
, ended = false
|
|
||||||
, parsed = []
|
|
||||||
|
|
||||||
fs.createReadStream(file).pipe(parser)
|
|
||||||
|
|
||||||
parser.on('data', function (data) {
|
|
||||||
called ++
|
|
||||||
it.has({
|
|
||||||
id: it.typeof('string'),
|
|
||||||
value: {rev: it.typeof('string')},
|
|
||||||
key:it.typeof('string')
|
|
||||||
})
|
|
||||||
parsed.push(data)
|
|
||||||
})
|
|
||||||
|
|
||||||
parser.on('end', function () {
|
|
||||||
ended = true
|
|
||||||
})
|
|
||||||
|
|
||||||
process.on('exit', function () {
|
|
||||||
it(called).equal(expected.rows.length)
|
|
||||||
it(parsed).deepEqual(expected.rows)
|
|
||||||
console.error('PASSED')
|
|
||||||
})
|
|
135
node_modules/JSONStream/test/gen.js
generated
vendored
135
node_modules/JSONStream/test/gen.js
generated
vendored
@@ -1,135 +0,0 @@
|
|||||||
return // dont run this test for now since tape is weird and broken on 0.10
|
|
||||||
|
|
||||||
var fs = require('fs')
|
|
||||||
var JSONStream = require('../')
|
|
||||||
var file = process.argv[2] || '/tmp/JSONStream-test-large.json'
|
|
||||||
var size = Number(process.argv[3] || 100000)
|
|
||||||
var tape = require('tape')
|
|
||||||
// if (process.title !== 'browser') {
|
|
||||||
tape('out of mem', function (t) {
|
|
||||||
t.plan(1)
|
|
||||||
//////////////////////////////////////////////////////
|
|
||||||
// Produces a random number between arg1 and arg2
|
|
||||||
//////////////////////////////////////////////////////
|
|
||||||
var randomNumber = function (min, max) {
|
|
||||||
var number = Math.floor(Math.random() * (max - min + 1) + min);
|
|
||||||
return number;
|
|
||||||
};
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////
|
|
||||||
// Produces a random string of a length between arg1 and arg2
|
|
||||||
//////////////////////////////////////////////////////
|
|
||||||
var randomString = function (min, max) {
|
|
||||||
|
|
||||||
// add several spaces to increase chanses of creating 'words'
|
|
||||||
var chars = ' 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
|
||||||
var result = '';
|
|
||||||
|
|
||||||
var randomLength = randomNumber(min, max);
|
|
||||||
|
|
||||||
for (var i = randomLength; i > 0; --i) {
|
|
||||||
result += chars[Math.round(Math.random() * (chars.length - 1))];
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
};
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////
|
|
||||||
// Produces a random JSON document, as a string
|
|
||||||
//////////////////////////////////////////////////////
|
|
||||||
var randomJsonDoc = function () {
|
|
||||||
|
|
||||||
var doc = {
|
|
||||||
"CrashOccurenceID": randomNumber(10000, 50000),
|
|
||||||
"CrashID": randomNumber(1000, 10000),
|
|
||||||
"SiteName": randomString(10, 25),
|
|
||||||
"MachineName": randomString(10, 25),
|
|
||||||
"Date": randomString(26, 26),
|
|
||||||
"ProcessDuration": randomString(18, 18),
|
|
||||||
"ThreadIdentityName": null,
|
|
||||||
"WindowsIdentityName": randomString(15, 40),
|
|
||||||
"OperatingSystemName": randomString(35, 65),
|
|
||||||
"DetailedExceptionInformation": randomString(100, 800)
|
|
||||||
};
|
|
||||||
|
|
||||||
doc = JSON.stringify(doc);
|
|
||||||
doc = doc.replace(/\,/g, ',\n'); // add new lines after each attribute
|
|
||||||
return doc;
|
|
||||||
};
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////
|
|
||||||
// generates test data
|
|
||||||
//////////////////////////////////////////////////////
|
|
||||||
var generateTestData = function (cb) {
|
|
||||||
|
|
||||||
console.log('generating large data file...');
|
|
||||||
|
|
||||||
var stream = fs.createWriteStream(file, {
|
|
||||||
encoding: 'utf8'
|
|
||||||
});
|
|
||||||
|
|
||||||
var i = 0;
|
|
||||||
var max = size;
|
|
||||||
var writing = false
|
|
||||||
var split = ',\n';
|
|
||||||
var doc = randomJsonDoc();
|
|
||||||
stream.write('[');
|
|
||||||
|
|
||||||
function write () {
|
|
||||||
if(writing) return
|
|
||||||
writing = true
|
|
||||||
while(++i < max) {
|
|
||||||
if(Math.random() < 0.001)
|
|
||||||
console.log('generate..', i + ' / ' + size)
|
|
||||||
if(!stream.write(doc + split)) {
|
|
||||||
writing = false
|
|
||||||
return stream.once('drain', write)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
stream.write(doc + ']')
|
|
||||||
stream.end();
|
|
||||||
console.log('END')
|
|
||||||
}
|
|
||||||
write()
|
|
||||||
stream.on('close', cb)
|
|
||||||
};
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////
|
|
||||||
// Shows that parsing 100000 instances using JSONStream fails
|
|
||||||
//
|
|
||||||
// After several seconds, you will get this crash
|
|
||||||
// FATAL ERROR: JS Allocation failed - process out of memory
|
|
||||||
//////////////////////////////////////////////////////
|
|
||||||
var testJSONStreamParse_causesOutOfMem = function (done) {
|
|
||||||
var items = 0
|
|
||||||
console.log('parsing data files using JSONStream...');
|
|
||||||
|
|
||||||
var parser = JSONStream.parse([true]);
|
|
||||||
var stream = fs.createReadStream(file);
|
|
||||||
stream.pipe(parser);
|
|
||||||
|
|
||||||
parser.on('data', function (data) {
|
|
||||||
items++
|
|
||||||
if(Math.random() < 0.01) console.log(items, '...')
|
|
||||||
});
|
|
||||||
|
|
||||||
parser.on('end', function () {
|
|
||||||
t.equal(items, size)
|
|
||||||
});
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////
|
|
||||||
// main
|
|
||||||
//////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
fs.stat(file, function (err, stat) {
|
|
||||||
console.log(stat)
|
|
||||||
if(err)
|
|
||||||
generateTestData(testJSONStreamParse_causesOutOfMem);
|
|
||||||
else
|
|
||||||
testJSONStreamParse_causesOutOfMem()
|
|
||||||
})
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
// }
|
|
40
node_modules/JSONStream/test/map.js
generated
vendored
40
node_modules/JSONStream/test/map.js
generated
vendored
@@ -1,40 +0,0 @@
|
|||||||
|
|
||||||
var test = require('tape')
|
|
||||||
|
|
||||||
var JSONStream = require('../')
|
|
||||||
|
|
||||||
test('map function', function (t) {
|
|
||||||
|
|
||||||
var actual = []
|
|
||||||
|
|
||||||
stream = JSONStream.parse([true], function (e) { return e*10 })
|
|
||||||
stream.on('data', function (v) { actual.push(v)})
|
|
||||||
stream.on('end', function () {
|
|
||||||
t.deepEqual(actual, [10,20,30,40,50,60])
|
|
||||||
t.end()
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
stream.write(JSON.stringify([1,2,3,4,5,6], null, 2))
|
|
||||||
stream.end()
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
test('filter function', function (t) {
|
|
||||||
|
|
||||||
var actual = []
|
|
||||||
|
|
||||||
stream = JSONStream
|
|
||||||
.parse([true], function (e) { return e%2 ? e : null})
|
|
||||||
.on('data', function (v) { actual.push(v)})
|
|
||||||
.on('end', function () {
|
|
||||||
t.deepEqual(actual, [1,3,5])
|
|
||||||
t.end()
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
stream.write(JSON.stringify([1,2,3,4,5,6], null, 2))
|
|
||||||
stream.end()
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
42
node_modules/JSONStream/test/multiple_objects.js
generated
vendored
42
node_modules/JSONStream/test/multiple_objects.js
generated
vendored
@@ -1,42 +0,0 @@
|
|||||||
var fs = require ('fs');
|
|
||||||
var net = require('net');
|
|
||||||
var join = require('path').join;
|
|
||||||
var file = join(__dirname, 'fixtures','all_npm.json');
|
|
||||||
var it = require('it-is');
|
|
||||||
var JSONStream = require('../');
|
|
||||||
|
|
||||||
var str = fs.readFileSync(file);
|
|
||||||
|
|
||||||
var datas = {}
|
|
||||||
|
|
||||||
var server = net.createServer(function(client) {
|
|
||||||
var root_calls = 0;
|
|
||||||
var data_calls = 0;
|
|
||||||
var parser = JSONStream.parse(['rows', true, 'key']);
|
|
||||||
parser.on('root', function(root, count) {
|
|
||||||
++ root_calls;
|
|
||||||
});
|
|
||||||
|
|
||||||
parser.on('data', function(data) {
|
|
||||||
++ data_calls;
|
|
||||||
datas[data] = (datas[data] || 0) + 1
|
|
||||||
it(data).typeof('string')
|
|
||||||
});
|
|
||||||
|
|
||||||
parser.on('end', function() {
|
|
||||||
console.log('END')
|
|
||||||
var min = Infinity
|
|
||||||
for (var d in datas)
|
|
||||||
min = min > datas[d] ? datas[d] : min
|
|
||||||
it(root_calls).equal(3);
|
|
||||||
it(min).equal(3);
|
|
||||||
server.close();
|
|
||||||
});
|
|
||||||
client.pipe(parser);
|
|
||||||
});
|
|
||||||
server.listen(9999);
|
|
||||||
|
|
||||||
var client = net.connect({ port : 9999 }, function() {
|
|
||||||
var msgs = str + ' ' + str + '\n\n' + str
|
|
||||||
client.end(msgs);
|
|
||||||
});
|
|
35
node_modules/JSONStream/test/multiple_objects_error.js
generated
vendored
35
node_modules/JSONStream/test/multiple_objects_error.js
generated
vendored
@@ -1,35 +0,0 @@
|
|||||||
var fs = require ('fs');
|
|
||||||
var net = require('net');
|
|
||||||
var join = require('path').join;
|
|
||||||
var file = join(__dirname, 'fixtures','all_npm.json');
|
|
||||||
var it = require('it-is');
|
|
||||||
var JSONStream = require('../');
|
|
||||||
|
|
||||||
var str = fs.readFileSync(file);
|
|
||||||
|
|
||||||
var server = net.createServer(function(client) {
|
|
||||||
var root_calls = 0;
|
|
||||||
var data_calls = 0;
|
|
||||||
var parser = JSONStream.parse();
|
|
||||||
parser.on('root', function(root, count) {
|
|
||||||
++ root_calls;
|
|
||||||
it(root_calls).notEqual(2);
|
|
||||||
});
|
|
||||||
|
|
||||||
parser.on('error', function(err) {
|
|
||||||
console.log(err);
|
|
||||||
server.close();
|
|
||||||
});
|
|
||||||
|
|
||||||
parser.on('end', function() {
|
|
||||||
console.log('END');
|
|
||||||
server.close();
|
|
||||||
});
|
|
||||||
client.pipe(parser);
|
|
||||||
});
|
|
||||||
server.listen(9999);
|
|
||||||
|
|
||||||
var client = net.connect({ port : 9999 }, function() {
|
|
||||||
var msgs = str + '}';
|
|
||||||
client.end(msgs);
|
|
||||||
});
|
|
28
node_modules/JSONStream/test/null.js
generated
vendored
28
node_modules/JSONStream/test/null.js
generated
vendored
@@ -1,28 +0,0 @@
|
|||||||
var JSONStream = require('../')
|
|
||||||
|
|
||||||
var data = [
|
|
||||||
{ID: 1, optional: null},
|
|
||||||
{ID: 2, optional: null},
|
|
||||||
{ID: 3, optional: 20},
|
|
||||||
{ID: 4, optional: null},
|
|
||||||
{ID: 5, optional: 'hello'},
|
|
||||||
{ID: 6, optional: null}
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
var test = require('tape')
|
|
||||||
|
|
||||||
test ('null properties', function (t) {
|
|
||||||
var actual = []
|
|
||||||
var stream =
|
|
||||||
|
|
||||||
JSONStream.parse('*.optional')
|
|
||||||
.on('data', function (v) { actual.push(v) })
|
|
||||||
.on('end', function () {
|
|
||||||
t.deepEqual(actual, [20, 'hello'])
|
|
||||||
t.end()
|
|
||||||
})
|
|
||||||
|
|
||||||
stream.write(JSON.stringify(data, null, 2))
|
|
||||||
stream.end()
|
|
||||||
})
|
|
28
node_modules/JSONStream/test/parsejson.js
generated
vendored
28
node_modules/JSONStream/test/parsejson.js
generated
vendored
@@ -1,28 +0,0 @@
|
|||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
sometimes jsonparse changes numbers slightly.
|
|
||||||
*/
|
|
||||||
|
|
||||||
var r = Math.random()
|
|
||||||
, Parser = require('jsonparse')
|
|
||||||
, p = new Parser()
|
|
||||||
, assert = require('assert')
|
|
||||||
, times = 20
|
|
||||||
while (times --) {
|
|
||||||
|
|
||||||
assert.equal(JSON.parse(JSON.stringify(r)), r, 'core JSON')
|
|
||||||
|
|
||||||
p.onValue = function (v) {
|
|
||||||
console.error('parsed', v)
|
|
||||||
assert.equal(
|
|
||||||
String(v).slice(0,12),
|
|
||||||
String(r).slice(0,12)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
console.error('correct', r)
|
|
||||||
p.write (new Buffer(JSON.stringify([r])))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
41
node_modules/JSONStream/test/stringify.js
generated
vendored
41
node_modules/JSONStream/test/stringify.js
generated
vendored
@@ -1,41 +0,0 @@
|
|||||||
|
|
||||||
var fs = require ('fs')
|
|
||||||
, join = require('path').join
|
|
||||||
, file = join(__dirname, 'fixtures','all_npm.json')
|
|
||||||
, JSONStream = require('../')
|
|
||||||
, it = require('it-is').style('colour')
|
|
||||||
|
|
||||||
function randomObj () {
|
|
||||||
return (
|
|
||||||
Math.random () < 0.4
|
|
||||||
? {hello: 'eonuhckmqjk',
|
|
||||||
whatever: 236515,
|
|
||||||
lies: true,
|
|
||||||
nothing: [null],
|
|
||||||
stuff: [Math.random(),Math.random(),Math.random()]
|
|
||||||
}
|
|
||||||
: ['AOREC', 'reoubaor', {ouec: 62642}, [[[], {}, 53]]]
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
var expected = []
|
|
||||||
, stringify = JSONStream.stringify()
|
|
||||||
, es = require('event-stream')
|
|
||||||
, stringified = ''
|
|
||||||
, called = 0
|
|
||||||
, count = 10
|
|
||||||
, ended = false
|
|
||||||
|
|
||||||
while (count --)
|
|
||||||
expected.push(randomObj())
|
|
||||||
|
|
||||||
es.connect(
|
|
||||||
es.readArray(expected),
|
|
||||||
stringify,
|
|
||||||
//JSONStream.parse([/./]),
|
|
||||||
es.writeArray(function (err, lines) {
|
|
||||||
|
|
||||||
it(JSON.parse(lines.join(''))).deepEqual(expected)
|
|
||||||
console.error('PASSED')
|
|
||||||
})
|
|
||||||
)
|
|
47
node_modules/JSONStream/test/stringify_object.js
generated
vendored
47
node_modules/JSONStream/test/stringify_object.js
generated
vendored
@@ -1,47 +0,0 @@
|
|||||||
|
|
||||||
var fs = require ('fs')
|
|
||||||
, join = require('path').join
|
|
||||||
, file = join(__dirname, 'fixtures','all_npm.json')
|
|
||||||
, JSONStream = require('../')
|
|
||||||
, it = require('it-is').style('colour')
|
|
||||||
, es = require('event-stream')
|
|
||||||
, pending = 10
|
|
||||||
, passed = true
|
|
||||||
|
|
||||||
function randomObj () {
|
|
||||||
return (
|
|
||||||
Math.random () < 0.4
|
|
||||||
? {hello: 'eonuhckmqjk',
|
|
||||||
whatever: 236515,
|
|
||||||
lies: true,
|
|
||||||
nothing: [null],
|
|
||||||
stuff: [Math.random(),Math.random(),Math.random()]
|
|
||||||
}
|
|
||||||
: ['AOREC', 'reoubaor', {ouec: 62642}, [[[], {}, 53]]]
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
for (var ix = 0; ix < pending; ix++) (function (count) {
|
|
||||||
var expected = {}
|
|
||||||
, stringify = JSONStream.stringifyObject()
|
|
||||||
|
|
||||||
es.connect(
|
|
||||||
stringify,
|
|
||||||
es.writeArray(function (err, lines) {
|
|
||||||
it(JSON.parse(lines.join(''))).deepEqual(expected)
|
|
||||||
if (--pending === 0) {
|
|
||||||
console.error('PASSED')
|
|
||||||
}
|
|
||||||
})
|
|
||||||
)
|
|
||||||
|
|
||||||
while (count --) {
|
|
||||||
var key = Math.random().toString(16).slice(2)
|
|
||||||
expected[key] = randomObj()
|
|
||||||
stringify.write([ key, expected[key] ])
|
|
||||||
}
|
|
||||||
|
|
||||||
process.nextTick(function () {
|
|
||||||
stringify.end()
|
|
||||||
})
|
|
||||||
})(ix)
|
|
35
node_modules/JSONStream/test/test.js
generated
vendored
35
node_modules/JSONStream/test/test.js
generated
vendored
@@ -1,35 +0,0 @@
|
|||||||
|
|
||||||
|
|
||||||
var fs = require ('fs')
|
|
||||||
, join = require('path').join
|
|
||||||
, file = join(__dirname, 'fixtures','all_npm.json')
|
|
||||||
, JSONStream = require('../')
|
|
||||||
, it = require('it-is')
|
|
||||||
|
|
||||||
var expected = JSON.parse(fs.readFileSync(file))
|
|
||||||
, parser = JSONStream.parse(['rows', /\d+/ /*, 'value'*/])
|
|
||||||
, called = 0
|
|
||||||
, ended = false
|
|
||||||
, parsed = []
|
|
||||||
|
|
||||||
fs.createReadStream(file).pipe(parser)
|
|
||||||
|
|
||||||
parser.on('data', function (data) {
|
|
||||||
called ++
|
|
||||||
it.has({
|
|
||||||
id: it.typeof('string'),
|
|
||||||
value: {rev: it.typeof('string')},
|
|
||||||
key:it.typeof('string')
|
|
||||||
})
|
|
||||||
parsed.push(data)
|
|
||||||
})
|
|
||||||
|
|
||||||
parser.on('end', function () {
|
|
||||||
ended = true
|
|
||||||
})
|
|
||||||
|
|
||||||
process.on('exit', function () {
|
|
||||||
it(called).equal(expected.rows.length)
|
|
||||||
it(parsed).deepEqual(expected.rows)
|
|
||||||
console.error('PASSED')
|
|
||||||
})
|
|
29
node_modules/JSONStream/test/test2.js
generated
vendored
29
node_modules/JSONStream/test/test2.js
generated
vendored
@@ -1,29 +0,0 @@
|
|||||||
|
|
||||||
|
|
||||||
var fs = require ('fs')
|
|
||||||
, join = require('path').join
|
|
||||||
, file = join(__dirname, '..','package.json')
|
|
||||||
, JSONStream = require('../')
|
|
||||||
, it = require('it-is')
|
|
||||||
|
|
||||||
var expected = JSON.parse(fs.readFileSync(file))
|
|
||||||
, parser = JSONStream.parse([])
|
|
||||||
, called = 0
|
|
||||||
, ended = false
|
|
||||||
, parsed = []
|
|
||||||
|
|
||||||
fs.createReadStream(file).pipe(parser)
|
|
||||||
|
|
||||||
parser.on('data', function (data) {
|
|
||||||
called ++
|
|
||||||
it(data).deepEqual(expected)
|
|
||||||
})
|
|
||||||
|
|
||||||
parser.on('end', function () {
|
|
||||||
ended = true
|
|
||||||
})
|
|
||||||
|
|
||||||
process.on('exit', function () {
|
|
||||||
it(called).equal(1)
|
|
||||||
console.error('PASSED')
|
|
||||||
})
|
|
41
node_modules/JSONStream/test/two-ways.js
generated
vendored
41
node_modules/JSONStream/test/two-ways.js
generated
vendored
@@ -1,41 +0,0 @@
|
|||||||
|
|
||||||
var fs = require ('fs')
|
|
||||||
, join = require('path').join
|
|
||||||
, file = join(__dirname, 'fixtures','all_npm.json')
|
|
||||||
, JSONStream = require('../')
|
|
||||||
, it = require('it-is').style('colour')
|
|
||||||
|
|
||||||
function randomObj () {
|
|
||||||
return (
|
|
||||||
Math.random () < 0.4
|
|
||||||
? {hello: 'eonuhckmqjk',
|
|
||||||
whatever: 236515,
|
|
||||||
lies: true,
|
|
||||||
nothing: [null],
|
|
||||||
// stuff: [Math.random(),Math.random(),Math.random()]
|
|
||||||
}
|
|
||||||
: ['AOREC', 'reoubaor', {ouec: 62642}, [[[], {}, 53]]]
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
var expected = []
|
|
||||||
, stringify = JSONStream.stringify()
|
|
||||||
, es = require('event-stream')
|
|
||||||
, stringified = ''
|
|
||||||
, called = 0
|
|
||||||
, count = 10
|
|
||||||
, ended = false
|
|
||||||
|
|
||||||
while (count --)
|
|
||||||
expected.push(randomObj())
|
|
||||||
|
|
||||||
es.connect(
|
|
||||||
es.readArray(expected),
|
|
||||||
stringify,
|
|
||||||
JSONStream.parse([/./]),
|
|
||||||
es.writeArray(function (err, lines) {
|
|
||||||
|
|
||||||
it(lines).has(expected)
|
|
||||||
console.error('PASSED')
|
|
||||||
})
|
|
||||||
)
|
|
21
node_modules/ajv-keywords/LICENSE
generated
vendored
21
node_modules/ajv-keywords/LICENSE
generated
vendored
@@ -1,21 +0,0 @@
|
|||||||
The MIT License (MIT)
|
|
||||||
|
|
||||||
Copyright (c) 2016 Evgeny Poberezkin
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
443
node_modules/ajv-keywords/README.md
generated
vendored
443
node_modules/ajv-keywords/README.md
generated
vendored
@@ -1,443 +0,0 @@
|
|||||||
# ajv-keywords
|
|
||||||
|
|
||||||
Custom JSON-Schema keywords for [ajv](https://github.com/epoberezkin/ajv) validator
|
|
||||||
|
|
||||||
[](https://travis-ci.org/epoberezkin/ajv-keywords)
|
|
||||||
[](https://www.npmjs.com/package/ajv-keywords)
|
|
||||||
[](https://www.npmjs.com/package/ajv-keywords)
|
|
||||||
[](https://coveralls.io/github/epoberezkin/ajv-keywords?branch=master)
|
|
||||||
|
|
||||||
|
|
||||||
## Contents
|
|
||||||
|
|
||||||
- [Install](#install)
|
|
||||||
- [Usage](#usage)
|
|
||||||
- [Keywords](#keywords)
|
|
||||||
- [typeof](#typeof)
|
|
||||||
- [instanceof](#instanceof)
|
|
||||||
- [range and exclusiveRange](#range-and-exclusiverange)
|
|
||||||
- [propertyNames](#propertynames)
|
|
||||||
- [if/then/else](#ifthenelse)
|
|
||||||
- [prohibited](#prohibited)
|
|
||||||
- [deepProperties](#deepproperties)
|
|
||||||
- [deepRequired](#deeprequired)
|
|
||||||
- [regexp](#regexp)
|
|
||||||
- [dynamicDefaults](#dynamicdefaults)
|
|
||||||
- [License](#license)
|
|
||||||
|
|
||||||
|
|
||||||
## Install
|
|
||||||
|
|
||||||
```
|
|
||||||
npm install ajv-keywords
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
To add all available keywords:
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
var Ajv = require('ajv');
|
|
||||||
var ajv = new Ajv;
|
|
||||||
require('ajv-keywords')(ajv);
|
|
||||||
|
|
||||||
ajv.validate({ instanceof: 'RegExp' }, /.*/); // true
|
|
||||||
ajv.validate({ instanceof: 'RegExp' }, '.*'); // false
|
|
||||||
```
|
|
||||||
|
|
||||||
To add a single keyword:
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
require('ajv-keywords')(ajv, 'instanceof');
|
|
||||||
```
|
|
||||||
|
|
||||||
To add multiple keywords:
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
require('ajv-keywords')(ajv, ['typeof', 'instanceof']);
|
|
||||||
```
|
|
||||||
|
|
||||||
To add a single keyword in browser (to avoid adding unused code):
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
require('ajv-keywords/keywords/instanceof')(ajv);
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
## Keywords
|
|
||||||
|
|
||||||
### `typeof`
|
|
||||||
|
|
||||||
Based on JavaScript `typeof` operation.
|
|
||||||
|
|
||||||
The value of the keyword should be a string (`"undefined"`, `"string"`, `"number"`, `"object"`, `"function"`, `"boolean"` or `"symbol"`) or array of strings.
|
|
||||||
|
|
||||||
To pass validation the result of `typeof` operation on the value should be equal to the string (or one of the strings in the array).
|
|
||||||
|
|
||||||
```
|
|
||||||
ajv.validate({ typeof: 'undefined' }, undefined); // true
|
|
||||||
ajv.validate({ typeof: 'undefined' }, null); // false
|
|
||||||
ajv.validate({ typeof: ['undefined', 'object'] }, null); // true
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
### `instanceof`
|
|
||||||
|
|
||||||
Based on JavaScript `instanceof` operation.
|
|
||||||
|
|
||||||
The value of the keyword should be a string (`"Object"`, `"Array"`, `"Function"`, `"Number"`, `"String"`, `"Date"`, `"RegExp"` or `"Buffer"`) or array of strings.
|
|
||||||
|
|
||||||
To pass validation the result of `data instanceof ...` operation on the value should be true:
|
|
||||||
|
|
||||||
```
|
|
||||||
ajv.validate({ instanceof: 'Array' }, []); // true
|
|
||||||
ajv.validate({ instanceof: 'Array' }, {}); // false
|
|
||||||
ajv.validate({ instanceof: ['Array', 'Function'] }, funciton(){}); // true
|
|
||||||
```
|
|
||||||
|
|
||||||
You can add your own constructor function to be recognised by this keyword:
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
function MyClass() {}
|
|
||||||
var instanceofDefinition = require('ajv-keywords').get('instanceof').definition;
|
|
||||||
// or require('ajv-keywords/keywords/instanceof').definition;
|
|
||||||
instanceofDefinition.CONSTRUCTORS.MyClass = MyClass;
|
|
||||||
|
|
||||||
ajv.validate({ instanceof: 'MyClass' }, new MyClass); // true
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
### `range` and `exclusiveRange`
|
|
||||||
|
|
||||||
Syntax sugar for the combination of minimum and maximum keywords, also fails schema compilation if there are no numbers in the range.
|
|
||||||
|
|
||||||
The value of this keyword must be the array consisting of two numbers, the second must be greater or equal than the first one.
|
|
||||||
|
|
||||||
If the validated value is not a number the validation passes, otherwise to pass validation the value should be greater (or equal) than the first number and smaller (or equal) than the second number in the array. If `exclusiveRange` keyword is present in the same schema and its value is true, the validated value must not be equal to the range boundaries.
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
var schema = { range: [1, 3] };
|
|
||||||
ajv.validate(schema, 1); // true
|
|
||||||
ajv.validate(schema, 2); // true
|
|
||||||
ajv.validate(schema, 3); // true
|
|
||||||
ajv.validate(schema, 0.99); // false
|
|
||||||
ajv.validate(schema, 3.01); // false
|
|
||||||
|
|
||||||
var schema = { range: [1, 3], exclusiveRange: true };
|
|
||||||
ajv.validate(schema, 1.01); // true
|
|
||||||
ajv.validate(schema, 2); // true
|
|
||||||
ajv.validate(schema, 2.99); // true
|
|
||||||
ajv.validate(schema, 1); // false
|
|
||||||
ajv.validate(schema, 3); // false
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
### `propertyNames`
|
|
||||||
|
|
||||||
This keyword allows to define the schema for the property names of the object. The value of this keyword should be a valid JSON schema (v5 schemas are supported with Ajv option `{v5: true}`).
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
var schema = {
|
|
||||||
type: 'object'
|
|
||||||
propertyNames: {
|
|
||||||
anyOf: [
|
|
||||||
{ format: ipv4 },
|
|
||||||
{ format: hostname }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
var validData = {
|
|
||||||
'192.128.0.1': {},
|
|
||||||
'test.example.com': {}
|
|
||||||
};
|
|
||||||
|
|
||||||
var invalidData = {
|
|
||||||
'1.2.3': {}
|
|
||||||
};
|
|
||||||
|
|
||||||
ajv.validate(schema, validData); // true
|
|
||||||
ajv.validate(schema, invalidData); // false
|
|
||||||
```
|
|
||||||
|
|
||||||
__Please note__: This keyword will be added to the next version of the JSON-Schema standard (draft-6), after it is published the keyword will be included in Ajv as standard validation keyword.
|
|
||||||
|
|
||||||
|
|
||||||
### `if`/`then`/`else`
|
|
||||||
|
|
||||||
These keywords allow to implement conditional validation. Their values should be valid JSON-schemas. At the moment it requires using Ajv with v5 option.
|
|
||||||
|
|
||||||
If the data is valid according to the sub-schema in `if` keyword, then the result is equal to the result of data validation against the sub-schema in `then` keyword, otherwise - in `else` keyword (if `else` is absent, the validation succeeds).
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
require('ajv-keywords')(ajv, 'if');
|
|
||||||
|
|
||||||
var schema = {
|
|
||||||
type: 'array',
|
|
||||||
items: {
|
|
||||||
type: 'integer',
|
|
||||||
minimum: 1,
|
|
||||||
if: { maximum: 10 },
|
|
||||||
then: { multipleOf: 2 },
|
|
||||||
else: { multipleOf: 5 }
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
var validItems = [ 2, 4, 6, 8, 10, 15, 20, 25 ]; // etc.
|
|
||||||
|
|
||||||
var invalidItems = [ 1, 3, 5, 11, 12 ]; // etc.
|
|
||||||
|
|
||||||
ajv.validate(schema, validItems); // true
|
|
||||||
ajv.validate(schema, invalidItems); // false
|
|
||||||
```
|
|
||||||
|
|
||||||
This keyword is [proposed](https://github.com/json-schema-org/json-schema-spec/issues/180) for the future version of JSON-Schema standard.
|
|
||||||
|
|
||||||
|
|
||||||
### `prohibited`
|
|
||||||
|
|
||||||
This keyword allows to prohibit that any of the properties in the list is present in the object.
|
|
||||||
|
|
||||||
This keyword applies only to objects. If the data is not an object, the validation succeeds.
|
|
||||||
|
|
||||||
The value of this keyword should be an array of strings, each string being a property name. For data object to be valid none of the properties in this array should be present in the object.
|
|
||||||
|
|
||||||
```
|
|
||||||
var schema = { prohibited: ['foo', 'bar']};
|
|
||||||
|
|
||||||
var validData = { baz: 1 };
|
|
||||||
var alsoValidData = {};
|
|
||||||
|
|
||||||
var invalidDataList = [
|
|
||||||
{ foo: 1 },
|
|
||||||
{ bar: 2 },
|
|
||||||
{ foo: 1, bar: 2}
|
|
||||||
];
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
### `deepRequired`
|
|
||||||
|
|
||||||
This keyword allows to check that some deep properties (identified by JSON pointers) are available. The value should be an array of JSON pointers to the data, starting from the current position in data.
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
var schema = {
|
|
||||||
type: 'object',
|
|
||||||
deepRequired: ["/users/1/role"]
|
|
||||||
};
|
|
||||||
|
|
||||||
var validData = {
|
|
||||||
users: [
|
|
||||||
{},
|
|
||||||
{
|
|
||||||
id: 123,
|
|
||||||
role: 'admin'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
};
|
|
||||||
|
|
||||||
var invalidData = {
|
|
||||||
users: [
|
|
||||||
{},
|
|
||||||
{
|
|
||||||
id: 123
|
|
||||||
}
|
|
||||||
]
|
|
||||||
};
|
|
||||||
```
|
|
||||||
|
|
||||||
See [json-schema-org/json-schema-spec#203](https://github.com/json-schema-org/json-schema-spec/issues/203#issue-197211916) for an example of the equivalent schema without `deepRequired` keyword.
|
|
||||||
|
|
||||||
|
|
||||||
## `deepProperties`
|
|
||||||
|
|
||||||
This keyword allows to validate deep properties (identified by JSON pointers). The value should be an object, where keys are JSON pointers to the data, starting from the current position in data, and the values are corresponding schemas.
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
var schema = {
|
|
||||||
type: 'object',
|
|
||||||
deepProperties: {
|
|
||||||
"/users/1/role": { "enum": ["admin"] }
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
var validData = {
|
|
||||||
users: [
|
|
||||||
{},
|
|
||||||
{
|
|
||||||
id: 123,
|
|
||||||
role: 'admin'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
};
|
|
||||||
|
|
||||||
var alsoValidData = {
|
|
||||||
users: {
|
|
||||||
"1": {
|
|
||||||
id: 123,
|
|
||||||
role: 'admin'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
var invalidData = {
|
|
||||||
users: [
|
|
||||||
{},
|
|
||||||
{
|
|
||||||
id: 123,
|
|
||||||
role: 'user'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
};
|
|
||||||
|
|
||||||
var alsoInvalidData = {
|
|
||||||
users: {
|
|
||||||
"1": {
|
|
||||||
id: 123,
|
|
||||||
role: 'user'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
### `regexp`
|
|
||||||
|
|
||||||
This keyword allows to use regular expressions with flags in schemas (the standard `pattern` keyword does not support flags). The value of this keyword can be either a string (the result of `regexp.toString()`) or an object with the properties `pattern` and `flags` (the same strings that should be passed to RegExp constructor).
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
var schema = {
|
|
||||||
type: 'object',
|
|
||||||
properties: {
|
|
||||||
foo: { regexp: '/foo/i' },
|
|
||||||
bar: { regexp: { pattern: 'bar', flags: 'i' } }
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
var validData = {
|
|
||||||
foo: 'Food',
|
|
||||||
bar: 'Barmen'
|
|
||||||
};
|
|
||||||
|
|
||||||
var invalidData = {
|
|
||||||
foo: 'fog',
|
|
||||||
bar: 'bad'
|
|
||||||
};
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
### `dynamicDefaults`
|
|
||||||
|
|
||||||
This keyword allows to assign dynamic defaults to properties, such as timestamps, unique IDs etc.
|
|
||||||
|
|
||||||
This keyword only works if `useDefaults` options is used and not inside `anyOf` keywrods etc., in the same way as [default keyword treated by Ajv](https://github.com/epoberezkin/ajv#assigning-defaults).
|
|
||||||
|
|
||||||
The keyword should be added on the object level. Its value should be an object with each property corresponding to a property name, in the same way as in standard `properties` keyword. The value of each property can be:
|
|
||||||
|
|
||||||
- an identifier of default function (a string)
|
|
||||||
- an object with properties `func` (an identifier) and `args` (an object with parameters that will be passed to this function during schema compilation - see examples).
|
|
||||||
|
|
||||||
The properties used in `dynamicDefaults` should not be added to `required` keyword (or validation will fail), because unlike `default` this keyword is processed after validation.
|
|
||||||
|
|
||||||
There are several predefined dynamic default functions:
|
|
||||||
|
|
||||||
- `"timestamp"` - current timestamp in milliseconds
|
|
||||||
- `"datetime"` - current date and time as string (ISO, valid according to `date-time` format)
|
|
||||||
- `"date"` - current date as string (ISO, valid according to `date` format)
|
|
||||||
- `"time"` - current time as string (ISO, valid according to `time` format)
|
|
||||||
- `"random"` - pseudo-random number in [0, 1) interval
|
|
||||||
- `"randomint"` - pseudo-random integer number. If string is used as a property value, the function will randomly return 0 or 1. If object `{func: 'randomint', max: N}` is used then the default will be an integer number in [0, N) interval.
|
|
||||||
- `"seq"` - sequential integer number starting from 0. If string is used as a property value, the default sequence will be used. If object `{func: 'seq', name: 'foo'}` is used then the sequence with name `"foo"` will be used. Sequences are global, even if different ajv instances are used.
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
var schema = {
|
|
||||||
type: 'object',
|
|
||||||
dynamicDefaults: {
|
|
||||||
ts: 'datetime',
|
|
||||||
r: { func: 'randomint', max: 100 },
|
|
||||||
id: { func: 'seq', name: 'id' }
|
|
||||||
},
|
|
||||||
properties: {
|
|
||||||
ts: {
|
|
||||||
type: 'string',
|
|
||||||
format: 'datetime'
|
|
||||||
},
|
|
||||||
r: {
|
|
||||||
type: 'integer',
|
|
||||||
minimum: 0,
|
|
||||||
maximum: 100,
|
|
||||||
exclusiveMaximum: true
|
|
||||||
},
|
|
||||||
id: {
|
|
||||||
type: 'integer',
|
|
||||||
minimum: 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
var data = {};
|
|
||||||
ajv.validate(data); // true
|
|
||||||
data; // { ts: '2016-12-01T22:07:28.829Z', r: 25, id: 0 }
|
|
||||||
|
|
||||||
var data1 = {};
|
|
||||||
ajv.validate(data1); // true
|
|
||||||
data1; // { ts: '2016-12-01T22:07:29.832Z', r: 68, id: 1 }
|
|
||||||
|
|
||||||
ajv.validate(data1); // true
|
|
||||||
data1; // didn't change, as all properties were defined
|
|
||||||
```
|
|
||||||
|
|
||||||
You can add your own dynamic default function to be recognised by this keyword:
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
var uuid = require('uuid');
|
|
||||||
|
|
||||||
function uuidV4() { return uuid.v4(); }
|
|
||||||
|
|
||||||
var definition = require('ajv-keywords').get('dynamicDefaults').definition;
|
|
||||||
// or require('ajv-keywords/keywords/dynamicDefaults').definition;
|
|
||||||
definition.DEFAULTS.uuid = uuidV4;
|
|
||||||
|
|
||||||
var schema = {
|
|
||||||
dynamicDefaults: { id: 'uuid' },
|
|
||||||
properties: { id: { type: 'string', format: 'uuid' } }
|
|
||||||
};
|
|
||||||
|
|
||||||
var data = {};
|
|
||||||
ajv.validate(schema, data); // true
|
|
||||||
data; // { id: 'a1183fbe-697b-4030-9bcc-cfeb282a9150' };
|
|
||||||
|
|
||||||
var data1 = {};
|
|
||||||
ajv.validate(schema, data1); // true
|
|
||||||
data1; // { id: '5b008de7-1669-467a-a5c6-70fa244d7209' }
|
|
||||||
```
|
|
||||||
|
|
||||||
You also can define dynamic default that accepts parameters, e.g. version of uuid:
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
var uuid = require('uuid');
|
|
||||||
|
|
||||||
function getUuid(args) {
|
|
||||||
var version = 'v' + (arvs && args.v || 4);
|
|
||||||
return function() {
|
|
||||||
return uuid[version]();
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
var definition = require('ajv-keywords').get('dynamicDefaults').definition;
|
|
||||||
definition.DEFAULTS.uuid = getUuid;
|
|
||||||
|
|
||||||
var schema = {
|
|
||||||
dynamicDefaults: {
|
|
||||||
id1: 'uuid', // v4
|
|
||||||
id2: { func: 'uuid', v: 4 }, // v4
|
|
||||||
id3: { func: 'uuid', v: 1 } // v1
|
|
||||||
}
|
|
||||||
};
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
## License
|
|
||||||
|
|
||||||
[MIT](https://github.com/JSONScript/ajv-keywords/blob/master/LICENSE)
|
|
35
node_modules/ajv-keywords/index.js
generated
vendored
35
node_modules/ajv-keywords/index.js
generated
vendored
@@ -1,35 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
var KEYWORDS = require('./keywords');
|
|
||||||
|
|
||||||
module.exports = defineKeywords;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Defines one or several keywords in ajv instance
|
|
||||||
* @param {Ajv} ajv validator instance
|
|
||||||
* @param {String|Array<String>|undefined} keyword keyword(s) to define
|
|
||||||
* @return {Ajv} ajv instance (for chaining)
|
|
||||||
*/
|
|
||||||
function defineKeywords(ajv, keyword) {
|
|
||||||
if (Array.isArray(keyword)) {
|
|
||||||
for (var i=0; i<keyword.length; i++)
|
|
||||||
get(keyword[i])(ajv);
|
|
||||||
return ajv;
|
|
||||||
}
|
|
||||||
if (keyword) {
|
|
||||||
get(keyword)(ajv);
|
|
||||||
return ajv;
|
|
||||||
}
|
|
||||||
for (keyword in KEYWORDS) get(keyword)(ajv);
|
|
||||||
return ajv;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
defineKeywords.get = get;
|
|
||||||
|
|
||||||
function get(keyword) {
|
|
||||||
var defFunc = KEYWORDS[keyword];
|
|
||||||
if (!defFunc) throw new Error('Unknown keyword ' + keyword);
|
|
||||||
return defFunc;
|
|
||||||
}
|
|
92
node_modules/ajv-keywords/keywords/_formatLimit.js
generated
vendored
92
node_modules/ajv-keywords/keywords/_formatLimit.js
generated
vendored
@@ -1,92 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
var TIME = /^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d:\d\d)?$/i;
|
|
||||||
var DATE_TIME_SEPARATOR = /t|\s/i;
|
|
||||||
|
|
||||||
var COMPARE_FORMATS = {
|
|
||||||
date: compareDate,
|
|
||||||
time: compareTime,
|
|
||||||
'date-time': compareDateTime
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports = function (minMax) {
|
|
||||||
var keyword = 'format' + minMax;
|
|
||||||
return function defFunc(ajv) {
|
|
||||||
if (ajv.RULES.keywords[keyword])
|
|
||||||
return console.warn('Keyword', keyword, 'is already defined');
|
|
||||||
|
|
||||||
defFunc.definition = {
|
|
||||||
type: 'string',
|
|
||||||
inline: require('./dotjs/_formatLimit'),
|
|
||||||
statements: true,
|
|
||||||
errors: 'full',
|
|
||||||
metaSchema: {
|
|
||||||
anyOf: [
|
|
||||||
{ type: 'string' },
|
|
||||||
{
|
|
||||||
type: 'object',
|
|
||||||
required: [ '$data' ],
|
|
||||||
properties: {
|
|
||||||
$data: {
|
|
||||||
type: 'string',
|
|
||||||
anyOf: [
|
|
||||||
{ format: 'relative-json-pointer' },
|
|
||||||
{ format: 'json-pointer' }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
additionalProperties: false
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
ajv.addKeyword(keyword, defFunc.definition);
|
|
||||||
ajv.addKeyword('formatExclusive' + minMax);
|
|
||||||
extendFormats(ajv);
|
|
||||||
return ajv;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
function extendFormats(ajv) {
|
|
||||||
var formats = ajv._formats;
|
|
||||||
for (var name in COMPARE_FORMATS) {
|
|
||||||
var format = formats[name];
|
|
||||||
if (typeof format != 'object')
|
|
||||||
format = formats[name] = { validate: format };
|
|
||||||
if (!format.compare)
|
|
||||||
format.compare = COMPARE_FORMATS[name];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function compareDate(d1, d2) {
|
|
||||||
if (!(d1 && d2)) return;
|
|
||||||
if (d1 > d2) return 1;
|
|
||||||
if (d1 < d2) return -1;
|
|
||||||
if (d1 === d2) return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function compareTime(t1, t2) {
|
|
||||||
if (!(t1 && t2)) return;
|
|
||||||
t1 = t1.match(TIME);
|
|
||||||
t2 = t2.match(TIME);
|
|
||||||
if (!(t1 && t2)) return;
|
|
||||||
t1 = t1[1] + t1[2] + t1[3] + (t1[4]||'');
|
|
||||||
t2 = t2[1] + t2[2] + t2[3] + (t2[4]||'');
|
|
||||||
if (t1 > t2) return 1;
|
|
||||||
if (t1 < t2) return -1;
|
|
||||||
if (t1 === t2) return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function compareDateTime(dt1, dt2) {
|
|
||||||
if (!(dt1 && dt2)) return;
|
|
||||||
dt1 = dt1.split(DATE_TIME_SEPARATOR);
|
|
||||||
dt2 = dt2.split(DATE_TIME_SEPARATOR);
|
|
||||||
var res = compareDate(dt1[0], dt2[0]);
|
|
||||||
if (res === undefined) return;
|
|
||||||
return res || compareTime(dt1[1], dt2[1]);
|
|
||||||
}
|
|
55
node_modules/ajv-keywords/keywords/deepProperties.js
generated
vendored
55
node_modules/ajv-keywords/keywords/deepProperties.js
generated
vendored
@@ -1,55 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
module.exports = function defFunc(ajv) {
|
|
||||||
defFunc.definition = {
|
|
||||||
type: 'object',
|
|
||||||
macro: function (schema) {
|
|
||||||
var schemas = [];
|
|
||||||
for (var pointer in schema)
|
|
||||||
schemas.push(getSchema(pointer, schema[pointer]));
|
|
||||||
return { 'allOf': schemas };
|
|
||||||
},
|
|
||||||
metaSchema: {
|
|
||||||
type: 'object',
|
|
||||||
patternProperties: {
|
|
||||||
'^(\\/([^~\\/]|~0|~1)*)*(\\/)?$': {
|
|
||||||
$ref: ajv._opts.v5
|
|
||||||
? 'https://raw.githubusercontent.com/epoberezkin/ajv/master/lib/refs/json-schema-v5.json#'
|
|
||||||
: 'http://json-schema.org/draft-04/schema#'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
additionalProperties: false
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
ajv.addKeyword('deepProperties', defFunc.definition);
|
|
||||||
return ajv;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
function getSchema(jsonPointer, schema) {
|
|
||||||
var segments = jsonPointer.split('/');
|
|
||||||
var rootSchema = {};
|
|
||||||
var pointerSchema = rootSchema;
|
|
||||||
for (var i=1; i<segments.length; i++) {
|
|
||||||
var segment = segments[i];
|
|
||||||
var isLast = i == segments.length - 1;
|
|
||||||
segment = unescapeJsonPointer(segment);
|
|
||||||
var properties = pointerSchema.properties = {};
|
|
||||||
var items = undefined;
|
|
||||||
if (/[0-9]+/.test(segment)) {
|
|
||||||
var count = +segment;
|
|
||||||
items = pointerSchema.items = [];
|
|
||||||
while (count--) items.push({});
|
|
||||||
}
|
|
||||||
pointerSchema = isLast ? schema : {};
|
|
||||||
properties[segment] = pointerSchema;
|
|
||||||
if (items) items.push(pointerSchema);
|
|
||||||
}
|
|
||||||
return rootSchema;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function unescapeJsonPointer(str) {
|
|
||||||
return str.replace(/~1/g, '/').replace(/~0/g, '~');
|
|
||||||
}
|
|
57
node_modules/ajv-keywords/keywords/deepRequired.js
generated
vendored
57
node_modules/ajv-keywords/keywords/deepRequired.js
generated
vendored
@@ -1,57 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
module.exports = function defFunc(ajv) {
|
|
||||||
defFunc.definition = {
|
|
||||||
type: 'object',
|
|
||||||
inline: function (it, keyword, schema) {
|
|
||||||
var expr = '';
|
|
||||||
for (var i=0; i<schema.length; i++) {
|
|
||||||
if (i) expr += ' && ';
|
|
||||||
expr += '(' + getData(schema[i], it.dataLevel) + ' !== undefined)';
|
|
||||||
}
|
|
||||||
return expr;
|
|
||||||
},
|
|
||||||
metaSchema: {
|
|
||||||
type: 'array',
|
|
||||||
items: {
|
|
||||||
type: 'string',
|
|
||||||
format: 'json-pointer'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
ajv.addKeyword('deepRequired', defFunc.definition);
|
|
||||||
return ajv;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
function getData(jsonPointer, lvl) {
|
|
||||||
var data = 'data' + (lvl || '');
|
|
||||||
if (!jsonPointer) return data;
|
|
||||||
|
|
||||||
var expr = data;
|
|
||||||
var segments = jsonPointer.split('/');
|
|
||||||
for (var i=1; i<segments.length; i++) {
|
|
||||||
var segment = segments[i];
|
|
||||||
data += getProperty(unescapeJsonPointer(segment));
|
|
||||||
expr += ' && ' + data;
|
|
||||||
}
|
|
||||||
return expr;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
var IDENTIFIER = /^[a-z$_][a-z$_0-9]*$/i;
|
|
||||||
var INTEGER = /^[0-9]+$/;
|
|
||||||
var SINGLE_QUOTE = /'|\\/g;
|
|
||||||
function getProperty(key) {
|
|
||||||
return INTEGER.test(key)
|
|
||||||
? '[' + key + ']'
|
|
||||||
: IDENTIFIER.test(key)
|
|
||||||
? '.' + key
|
|
||||||
: "['" + key.replace(SINGLE_QUOTE, '\\$&') + "']";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function unescapeJsonPointer(str) {
|
|
||||||
return str.replace(/~1/g, '/').replace(/~0/g, '~');
|
|
||||||
}
|
|
116
node_modules/ajv-keywords/keywords/dot/_formatLimit.jst
generated
vendored
116
node_modules/ajv-keywords/keywords/dot/_formatLimit.jst
generated
vendored
@@ -1,116 +0,0 @@
|
|||||||
{{# def.definitions }}
|
|
||||||
{{# def.errors }}
|
|
||||||
{{# def.setupKeyword }}
|
|
||||||
|
|
||||||
var {{=$valid}} = undefined;
|
|
||||||
|
|
||||||
{{## def.skipFormatLimit:
|
|
||||||
{{=$valid}} = true;
|
|
||||||
{{ return out; }}
|
|
||||||
#}}
|
|
||||||
|
|
||||||
{{## def.compareFormat:
|
|
||||||
{{? $isData }}
|
|
||||||
if ({{=$schemaValue}} === undefined) {{=$valid}} = true;
|
|
||||||
else if (typeof {{=$schemaValue}} != 'string') {{=$valid}} = false;
|
|
||||||
else {
|
|
||||||
{{ $closingBraces += '}'; }}
|
|
||||||
{{?}}
|
|
||||||
|
|
||||||
{{? $isDataFormat }}
|
|
||||||
if (!{{=$compare}}) {{=$valid}} = true;
|
|
||||||
else {
|
|
||||||
{{ $closingBraces += '}'; }}
|
|
||||||
{{?}}
|
|
||||||
|
|
||||||
var {{=$result}} = {{=$compare}}({{=$data}}, {{# def.schemaValueQS }});
|
|
||||||
|
|
||||||
if ({{=$result}} === undefined) {{=$valid}} = false;
|
|
||||||
#}}
|
|
||||||
|
|
||||||
|
|
||||||
{{? it.opts.format === false }}{{# def.skipFormatLimit }}{{?}}
|
|
||||||
|
|
||||||
{{
|
|
||||||
var $schemaFormat = it.schema.format
|
|
||||||
, $isDataFormat = it.opts.v5 && $schemaFormat.$data
|
|
||||||
, $closingBraces = '';
|
|
||||||
}}
|
|
||||||
|
|
||||||
{{? $isDataFormat }}
|
|
||||||
{{
|
|
||||||
var $schemaValueFormat = it.util.getData($schemaFormat.$data, $dataLvl, it.dataPathArr)
|
|
||||||
, $format = 'format' + $lvl
|
|
||||||
, $compare = 'compare' + $lvl;
|
|
||||||
}}
|
|
||||||
|
|
||||||
var {{=$format}} = formats[{{=$schemaValueFormat}}]
|
|
||||||
, {{=$compare}} = {{=$format}} && {{=$format}}.compare;
|
|
||||||
{{??}}
|
|
||||||
{{ var $format = it.formats[$schemaFormat]; }}
|
|
||||||
{{? !($format && $format.compare) }}
|
|
||||||
{{# def.skipFormatLimit }}
|
|
||||||
{{?}}
|
|
||||||
{{ var $compare = 'formats' + it.util.getProperty($schemaFormat) + '.compare'; }}
|
|
||||||
{{?}}
|
|
||||||
|
|
||||||
{{
|
|
||||||
var $isMax = $keyword == 'formatMaximum'
|
|
||||||
, $exclusiveKeyword = 'formatExclusive' + ($isMax ? 'Maximum' : 'Minimum')
|
|
||||||
, $schemaExcl = it.schema[$exclusiveKeyword]
|
|
||||||
, $isDataExcl = it.opts.v5 && $schemaExcl && $schemaExcl.$data
|
|
||||||
, $op = $isMax ? '<' : '>'
|
|
||||||
, $result = 'result' + $lvl;
|
|
||||||
}}
|
|
||||||
|
|
||||||
{{# def.$data }}
|
|
||||||
|
|
||||||
|
|
||||||
{{? $isDataExcl }}
|
|
||||||
{{
|
|
||||||
var $schemaValueExcl = it.util.getData($schemaExcl.$data, $dataLvl, it.dataPathArr)
|
|
||||||
, $exclusive = 'exclusive' + $lvl
|
|
||||||
, $opExpr = 'op' + $lvl
|
|
||||||
, $opStr = '\' + ' + $opExpr + ' + \'';
|
|
||||||
}}
|
|
||||||
var schemaExcl{{=$lvl}} = {{=$schemaValueExcl}};
|
|
||||||
{{ $schemaValueExcl = 'schemaExcl' + $lvl; }}
|
|
||||||
|
|
||||||
if (typeof {{=$schemaValueExcl}} != 'boolean' && {{=$schemaValueExcl}} !== undefined) {
|
|
||||||
{{=$valid}} = false;
|
|
||||||
{{ var $errorKeyword = $exclusiveKeyword; }}
|
|
||||||
{{# def.error:'_formatExclusiveLimit' }}
|
|
||||||
}
|
|
||||||
|
|
||||||
{{# def.elseIfValid }}
|
|
||||||
|
|
||||||
{{# def.compareFormat }}
|
|
||||||
var {{=$exclusive}} = {{=$schemaValueExcl}} === true;
|
|
||||||
|
|
||||||
if ({{=$valid}} === undefined) {
|
|
||||||
{{=$valid}} = {{=$exclusive}}
|
|
||||||
? {{=$result}} {{=$op}} 0
|
|
||||||
: {{=$result}} {{=$op}}= 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!{{=$valid}}) var op{{=$lvl}} = {{=$exclusive}} ? '{{=$op}}' : '{{=$op}}=';
|
|
||||||
{{??}}
|
|
||||||
{{
|
|
||||||
var $exclusive = $schemaExcl === true
|
|
||||||
, $opStr = $op; /*used in error*/
|
|
||||||
if (!$exclusive) $opStr += '=';
|
|
||||||
var $opExpr = '\'' + $opStr + '\''; /*used in error*/
|
|
||||||
}}
|
|
||||||
|
|
||||||
{{# def.compareFormat }}
|
|
||||||
|
|
||||||
if ({{=$valid}} === undefined)
|
|
||||||
{{=$valid}} = {{=$result}} {{=$op}}{{?!$exclusive}}={{?}} 0;
|
|
||||||
{{?}}
|
|
||||||
|
|
||||||
{{= $closingBraces }}
|
|
||||||
|
|
||||||
if (!{{=$valid}}) {
|
|
||||||
{{ var $errorKeyword = $keyword; }}
|
|
||||||
{{# def.error:'_formatLimit' }}
|
|
||||||
}
|
|
28
node_modules/ajv-keywords/keywords/dot/patternRequired.jst
generated
vendored
28
node_modules/ajv-keywords/keywords/dot/patternRequired.jst
generated
vendored
@@ -1,28 +0,0 @@
|
|||||||
{{# def.definitions }}
|
|
||||||
{{# def.errors }}
|
|
||||||
{{# def.setupKeyword }}
|
|
||||||
|
|
||||||
{{
|
|
||||||
var $key = 'key' + $lvl
|
|
||||||
, $matched = 'patternMatched' + $lvl
|
|
||||||
, $closingBraces = ''
|
|
||||||
, $ownProperties = it.opts.ownProperties;
|
|
||||||
}}
|
|
||||||
|
|
||||||
var {{=$valid}} = true;
|
|
||||||
{{~ $schema:$pProperty }}
|
|
||||||
var {{=$matched}} = false;
|
|
||||||
for (var {{=$key}} in {{=$data}}) {
|
|
||||||
{{# def.checkOwnProperty }}
|
|
||||||
{{=$matched}} = {{= it.usePattern($pProperty) }}.test({{=$key}});
|
|
||||||
if ({{=$matched}}) break;
|
|
||||||
}
|
|
||||||
|
|
||||||
{{ var $missingPattern = it.util.escapeQuotes($pProperty); }}
|
|
||||||
if (!{{=$matched}}) {
|
|
||||||
{{=$valid}} = false;
|
|
||||||
{{# def.addError:'patternRequired' }}
|
|
||||||
} {{# def.elseIfValid }}
|
|
||||||
{{~}}
|
|
||||||
|
|
||||||
{{= $closingBraces }}
|
|
73
node_modules/ajv-keywords/keywords/dot/switch.jst
generated
vendored
73
node_modules/ajv-keywords/keywords/dot/switch.jst
generated
vendored
@@ -1,73 +0,0 @@
|
|||||||
{{# def.definitions }}
|
|
||||||
{{# def.errors }}
|
|
||||||
{{# def.setupKeyword }}
|
|
||||||
{{# def.setupNextLevel }}
|
|
||||||
|
|
||||||
|
|
||||||
{{## def.validateIf:
|
|
||||||
{{# def.setCompositeRule }}
|
|
||||||
{{ $it.createErrors = false; }}
|
|
||||||
{{# def._validateSwitchRule:if }}
|
|
||||||
{{ $it.createErrors = true; }}
|
|
||||||
{{# def.resetCompositeRule }}
|
|
||||||
{{=$ifPassed}} = valid{{=$it.level}};
|
|
||||||
#}}
|
|
||||||
|
|
||||||
{{## def.validateThen:
|
|
||||||
{{? typeof $sch.then == 'boolean' }}
|
|
||||||
{{? $sch.then === false }}
|
|
||||||
{{# def.error:'switch' }}
|
|
||||||
{{?}}
|
|
||||||
var valid{{=$it.level}} = {{= $sch.then }};
|
|
||||||
{{??}}
|
|
||||||
{{# def._validateSwitchRule:then }}
|
|
||||||
{{?}}
|
|
||||||
#}}
|
|
||||||
|
|
||||||
{{## def._validateSwitchRule:_clause:
|
|
||||||
{{
|
|
||||||
$it.schema = $sch._clause;
|
|
||||||
$it.schemaPath = $schemaPath + '[' + $caseIndex + ']._clause';
|
|
||||||
$it.errSchemaPath = $errSchemaPath + '/' + $caseIndex + '/_clause';
|
|
||||||
}}
|
|
||||||
{{# def.insertSubschemaCode }}
|
|
||||||
#}}
|
|
||||||
|
|
||||||
{{## def.switchCase:
|
|
||||||
{{? $sch.if && {{# def.nonEmptySchema:$sch.if }} }}
|
|
||||||
var {{=$errs}} = errors;
|
|
||||||
{{# def.validateIf }}
|
|
||||||
if ({{=$ifPassed}}) {
|
|
||||||
{{# def.validateThen }}
|
|
||||||
} else {
|
|
||||||
{{# def.resetErrors }}
|
|
||||||
}
|
|
||||||
{{??}}
|
|
||||||
{{=$ifPassed}} = true;
|
|
||||||
{{# def.validateThen }}
|
|
||||||
{{?}}
|
|
||||||
#}}
|
|
||||||
|
|
||||||
|
|
||||||
{{
|
|
||||||
var $ifPassed = 'ifPassed' + it.level
|
|
||||||
, $currentBaseId = $it.baseId
|
|
||||||
, $shouldContinue;
|
|
||||||
}}
|
|
||||||
var {{=$ifPassed}};
|
|
||||||
|
|
||||||
{{~ $schema:$sch:$caseIndex }}
|
|
||||||
{{? $caseIndex && !$shouldContinue }}
|
|
||||||
if (!{{=$ifPassed}}) {
|
|
||||||
{{ $closingBraces+= '}'; }}
|
|
||||||
{{?}}
|
|
||||||
|
|
||||||
{{# def.switchCase }}
|
|
||||||
{{ $shouldContinue = $sch.continue }}
|
|
||||||
{{~}}
|
|
||||||
|
|
||||||
{{= $closingBraces }}
|
|
||||||
|
|
||||||
var {{=$valid}} = valid{{=$it.level}};
|
|
||||||
|
|
||||||
{{# def.cleanUp }}
|
|
3
node_modules/ajv-keywords/keywords/dotjs/README.md
generated
vendored
3
node_modules/ajv-keywords/keywords/dotjs/README.md
generated
vendored
@@ -1,3 +0,0 @@
|
|||||||
These files are compiled dot templates from dot folder.
|
|
||||||
|
|
||||||
Do NOT edit them directly, edit the templates and run `npm run build` from main ajv-keywords folder.
|
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user