WIP - add extractor, generate snippet_data
This commit is contained in:
27
node_modules/unist-builder/index.js
generated
vendored
Normal file
27
node_modules/unist-builder/index.js
generated
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
'use strict'
|
||||
|
||||
var assign = require('object-assign')
|
||||
|
||||
module.exports = u
|
||||
|
||||
function u(type, props, value) {
|
||||
var node
|
||||
|
||||
if (
|
||||
(value === null || value === undefined) &&
|
||||
(typeof props !== 'object' || Array.isArray(props))
|
||||
) {
|
||||
value = props
|
||||
props = {}
|
||||
}
|
||||
|
||||
node = assign({type: String(type)}, props)
|
||||
|
||||
if (Array.isArray(value)) {
|
||||
node.children = value
|
||||
} else if (value !== null && value !== undefined) {
|
||||
node.value = String(value)
|
||||
}
|
||||
|
||||
return node
|
||||
}
|
||||
21
node_modules/unist-builder/license
generated
vendored
Normal file
21
node_modules/unist-builder/license
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Eugene Sharygin
|
||||
|
||||
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.
|
||||
109
node_modules/unist-builder/package.json
generated
vendored
Normal file
109
node_modules/unist-builder/package.json
generated
vendored
Normal file
@ -0,0 +1,109 @@
|
||||
{
|
||||
"_from": "unist-builder@^1.0.1",
|
||||
"_id": "unist-builder@1.0.4",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-v6xbUPP7ILrT15fHGrNyHc1Xda8H3xVhP7/HAIotHOhVPjH5dCXA097C3Rry1Q2O+HbOLCao4hfPB+EYEjHgVg==",
|
||||
"_location": "/unist-builder",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "unist-builder@^1.0.1",
|
||||
"name": "unist-builder",
|
||||
"escapedName": "unist-builder",
|
||||
"rawSpec": "^1.0.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.0.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/mdast-util-to-hast"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/unist-builder/-/unist-builder-1.0.4.tgz",
|
||||
"_shasum": "e1808aed30bd72adc3607f25afecebef4dd59e17",
|
||||
"_spec": "unist-builder@^1.0.1",
|
||||
"_where": "/Users/stefanfejes/Projects/30-seconds-of-python-code/node_modules/mdast-util-to-hast",
|
||||
"author": {
|
||||
"name": "Eugene Sharygin",
|
||||
"email": "eush77@gmail.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/syntax-tree/unist-builder/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Eugene Sharygin",
|
||||
"email": "eush77@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Titus Wormer",
|
||||
"email": "tituswormer@gmail.com",
|
||||
"url": "https://wooorm.com"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"object-assign": "^4.1.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Helper for creating unist trees",
|
||||
"devDependencies": {
|
||||
"nyc": "^14.0.0",
|
||||
"prettier": "^1.14.2",
|
||||
"remark-cli": "^6.0.0",
|
||||
"remark-preset-wooorm": "^5.0.0",
|
||||
"tape": "^4.0.0",
|
||||
"xo": "^0.24.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/syntax-tree/unist-builder#readme",
|
||||
"keywords": [
|
||||
"ast",
|
||||
"build",
|
||||
"builder",
|
||||
"create",
|
||||
"dsl",
|
||||
"hyperscript",
|
||||
"sugar",
|
||||
"syntax",
|
||||
"tree",
|
||||
"unist"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "unist-builder",
|
||||
"nyc": {
|
||||
"check-coverage": true,
|
||||
"lines": 100,
|
||||
"functions": 100,
|
||||
"branches": 100
|
||||
},
|
||||
"prettier": {
|
||||
"tabWidth": 2,
|
||||
"useTabs": false,
|
||||
"singleQuote": true,
|
||||
"bracketSpacing": false,
|
||||
"semi": false,
|
||||
"trailingComma": "none"
|
||||
},
|
||||
"remarkConfig": {
|
||||
"plugins": [
|
||||
"preset-wooorm"
|
||||
]
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/syntax-tree/unist-builder.git"
|
||||
},
|
||||
"scripts": {
|
||||
"format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix",
|
||||
"test": "npm run format && npm run test-coverage",
|
||||
"test-api": "node test",
|
||||
"test-coverage": "nyc --reporter lcov tape test.js"
|
||||
},
|
||||
"version": "1.0.4",
|
||||
"xo": {
|
||||
"prettier": true,
|
||||
"esnext": false
|
||||
}
|
||||
}
|
||||
148
node_modules/unist-builder/readme.md
generated
vendored
Normal file
148
node_modules/unist-builder/readme.md
generated
vendored
Normal file
@ -0,0 +1,148 @@
|
||||
# unist-builder
|
||||
|
||||
[![Build][build-badge]][build]
|
||||
[![Coverage][coverage-badge]][coverage]
|
||||
[![Downloads][downloads-badge]][downloads]
|
||||
[![Size][size-badge]][size]
|
||||
|
||||
[**unist**][unist] utility to create a new [tree][]s with [hyperscript][]-like
|
||||
syntax.
|
||||
|
||||
## Install
|
||||
|
||||
[npm][]:
|
||||
|
||||
```bash
|
||||
npm install unist-builder
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var u = require('unist-builder')
|
||||
|
||||
var tree = u('root', [
|
||||
u('subtree', {id: 1}),
|
||||
u('subtree', {id: 2}, [
|
||||
u('node', [u('leaf', 'leaf 1'), u('leaf', 'leaf 2')]),
|
||||
u('leaf', {id: 3}, 'leaf 3'),
|
||||
u('void', {id: 4})
|
||||
])
|
||||
])
|
||||
|
||||
console.dir(tree, {depth: null})
|
||||
```
|
||||
|
||||
results in the following tree:
|
||||
|
||||
```js
|
||||
{
|
||||
type: 'root',
|
||||
children: [
|
||||
{type: 'subtree', id: 1},
|
||||
{
|
||||
type: 'subtree',
|
||||
id: 2,
|
||||
children: [
|
||||
{
|
||||
type: 'node',
|
||||
children: [
|
||||
{type: 'leaf', value: 'leaf 1'},
|
||||
{type: 'leaf', value: 'leaf 2'}
|
||||
]
|
||||
},
|
||||
{type: 'leaf', id: 3, value: 'leaf 3'},
|
||||
{type: 'void', id: 4}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### `u(type[, props][, children|value])`
|
||||
|
||||
Creates a node from `props`, `children`, and optionally `value`.
|
||||
|
||||
###### Signatures
|
||||
|
||||
* `u(type[, props], children)` — create a [parent][]
|
||||
* `u(type[, props], value)` — create a [literal][]
|
||||
* `u(type[, props])` — create a void node
|
||||
|
||||
###### Parameters
|
||||
|
||||
* `type` (`string`) — node [type][]
|
||||
* `props` (`Object`) — other values assigned to `node`
|
||||
* `children` ([`Array.<Node>`][node]) — children of `node`
|
||||
* `value` (`*`) — value of `node` (cast to string)
|
||||
|
||||
###### Returns
|
||||
|
||||
[`Node`][node].
|
||||
|
||||
## Related
|
||||
|
||||
* [`unist-builder-blueprint`](https://github.com/syntax-tree/unist-builder-blueprint)
|
||||
— Convert unist trees to `unist-builder` notation
|
||||
* [`hastscript`](https://github.com/syntax-tree/hastscript)
|
||||
— Create [hast][] elements
|
||||
|
||||
## Contribute
|
||||
|
||||
See [`contributing.md` in `syntax-tree/.github`][contributing] for ways to get
|
||||
started.
|
||||
See [`support.md`][support] for ways to get help.
|
||||
|
||||
This project has a [Code of Conduct][coc].
|
||||
By interacting with this repository, organisation, or community you agree to
|
||||
abide by its terms.
|
||||
|
||||
## License
|
||||
|
||||
[MIT][license] © Eugene Sharygin
|
||||
|
||||
<!-- Definitions -->
|
||||
|
||||
[build-badge]: https://img.shields.io/travis/syntax-tree/unist-builder.svg
|
||||
|
||||
[build]: https://travis-ci.org/syntax-tree/unist-builder
|
||||
|
||||
[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-builder.svg
|
||||
|
||||
[coverage]: https://codecov.io/github/syntax-tree/unist-builder
|
||||
|
||||
[downloads-badge]: https://img.shields.io/npm/dm/unist-builder.svg
|
||||
|
||||
[downloads]: https://www.npmjs.com/package/unist-builder
|
||||
|
||||
[size-badge]: https://img.shields.io/bundlephobia/minzip/unist-builder.svg
|
||||
|
||||
[size]: https://bundlephobia.com/result?p=unist-builder
|
||||
|
||||
[npm]: https://docs.npmjs.com/cli/install
|
||||
|
||||
[license]: license
|
||||
|
||||
[contributing]: https://github.com/syntax-tree/.github/blob/master/contributing.md
|
||||
|
||||
[support]: https://github.com/syntax-tree/.github/blob/master/support.md
|
||||
|
||||
[coc]: https://github.com/syntax-tree/.github/blob/master/code-of-conduct.md
|
||||
|
||||
[unist]: https://github.com/syntax-tree/unist
|
||||
|
||||
[hast]: https://github.com/syntax-tree/hast
|
||||
|
||||
[hyperscript]: https://github.com/dominictarr/hyperscript
|
||||
|
||||
[node]: https://github.com/syntax-tree/unist#node
|
||||
|
||||
[tree]: https://github.com/syntax-tree/unist#tree
|
||||
|
||||
[parent]: https://github.com/syntax-tree/unist#parent
|
||||
|
||||
[literal]: https://github.com/syntax-tree/unist#literal
|
||||
|
||||
[type]: https://github.com/syntax-tree/unist#type
|
||||
Reference in New Issue
Block a user