WIP - add extractor, generate snippet_data

This commit is contained in:
Stefan Fejes
2019-08-20 15:52:05 +02:00
parent 88084d3d30
commit cc8f1d8a7a
37396 changed files with 4588842 additions and 133 deletions

45
node_modules/hast-util-is-element/index.js generated vendored Normal file
View File

@ -0,0 +1,45 @@
'use strict'
module.exports = isElement
// Check if if `node` is an `element` and, if `tagNames` is given, `node`
// matches them `tagNames`.
function isElement(node, tagNames) {
var name
if (
!(
tagNames === null ||
tagNames === undefined ||
typeof tagNames === 'string' ||
(typeof tagNames === 'object' && tagNames.length !== 0)
)
) {
throw new Error(
'Expected `string` or `Array.<string>` for `tagNames`, not `' +
tagNames +
'`'
)
}
if (
!node ||
typeof node !== 'object' ||
node.type !== 'element' ||
typeof node.tagName !== 'string'
) {
return false
}
if (tagNames === null || tagNames === undefined) {
return true
}
name = node.tagName
if (typeof tagNames === 'string') {
return name === tagNames
}
return tagNames.indexOf(name) !== -1
}

22
node_modules/hast-util-is-element/license generated vendored Normal file
View File

@ -0,0 +1,22 @@
(The MIT License)
Copyright (c) 2016 Titus Wormer <tituswormer@gmail.com>
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.

108
node_modules/hast-util-is-element/package.json generated vendored Normal file
View File

@ -0,0 +1,108 @@
{
"_from": "hast-util-is-element@^1.0.0",
"_id": "hast-util-is-element@1.0.3",
"_inBundle": false,
"_integrity": "sha512-C62CVn7jbjp89yOhhy7vrkSaB7Vk906Gtcw/Ihd+Iufnq+2pwOZjdPmpzpKLWJXPJBMDX3wXg4FqmdOayPcewA==",
"_location": "/hast-util-is-element",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "hast-util-is-element@^1.0.0",
"name": "hast-util-is-element",
"escapedName": "hast-util-is-element",
"rawSpec": "^1.0.0",
"saveSpec": null,
"fetchSpec": "^1.0.0"
},
"_requiredBy": [
"/hast-util-to-html"
],
"_resolved": "https://registry.npmjs.org/hast-util-is-element/-/hast-util-is-element-1.0.3.tgz",
"_shasum": "423b4b26fe8bf1f25950fe052e9ce8f83fd5f6a4",
"_spec": "hast-util-is-element@^1.0.0",
"_where": "/Users/stefanfejes/Projects/30-seconds-of-python-code/node_modules/hast-util-to-html",
"author": {
"name": "Titus Wormer",
"email": "tituswormer@gmail.com",
"url": "https://wooorm.com"
},
"bugs": {
"url": "https://github.com/syntax-tree/hast-util-is-element/issues"
},
"bundleDependencies": false,
"contributors": [
{
"name": "Titus Wormer",
"email": "tituswormer@gmail.com",
"url": "https://wooorm.com"
}
],
"dependencies": {},
"deprecated": false,
"description": "Check if a node is a (certain) element",
"devDependencies": {
"browserify": "^16.0.0",
"nyc": "^14.0.0",
"prettier": "^1.0.0",
"remark-cli": "^6.0.0",
"remark-preset-wooorm": "^5.0.0",
"tape": "^4.0.0",
"tinyify": "^2.0.0",
"xo": "^0.24.0"
},
"files": [
"index.js"
],
"homepage": "https://github.com/syntax-tree/hast-util-is-element#readme",
"keywords": [
"hast",
"html",
"is",
"element",
"util",
"utility"
],
"license": "MIT",
"name": "hast-util-is-element",
"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/hast-util-is-element.git"
},
"scripts": {
"build": "npm run build-bundle && npm run build-mangle",
"build-bundle": "browserify . -s hastUtilIsElement > hast-util-is-element.js",
"build-mangle": "browserify . -s hastUtilIsElement -p tinyify > hast-util-is-element.min.js",
"format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix",
"test": "npm run format && npm run build && npm run test-coverage",
"test-api": "node test",
"test-coverage": "nyc --reporter lcov tape test.js"
},
"version": "1.0.3",
"xo": {
"prettier": true,
"esnext": false,
"ignores": [
"hast-util-is-element.js"
]
}
}

119
node_modules/hast-util-is-element/readme.md generated vendored Normal file
View File

@ -0,0 +1,119 @@
# hast-util-is-element
[![Build][build-badge]][build]
[![Coverage][coverage-badge]][coverage]
[![Downloads][downloads-badge]][downloads]
[![Size][size-badge]][size]
[![Sponsors][sponsors-badge]][collective]
[![Backers][backers-badge]][collective]
[![Chat][chat-badge]][chat]
[**hast**][hast] utility to check if a [*node*][node] is a (certain)
[*element*][element].
## Install
[npm][]:
```sh
npm install hast-util-is-element
```
## Usage
```js
var is = require('hast-util-is-element')
is({type: 'text', value: 'foo'}) // => false
is({type: 'element', tagName: 'a'}, 'a') // => true
is({type: 'element', tagName: 'a'}, ['a', 'area']) // => true
```
## API
### `isElement(node[, tagName|tagNames])`
Check if the given value is a (certain) [*element*][element].
* When given a `tagName` or `tagNames`, checks that `node` is an
[*element*][element] whose `tagName` field matches `tagName` or is included
in `tagNames`
* Otherwise checks that `node` is an [*element*][element]
###### Parameters
* `node` (`*`) — Value to check, probably [`Node`][node]
* `tagName` (`string`, optional) — Value that `node`s `tagName` field should
match
* `tagNames` (`Array.<string>`, optional) — Values that should include `node`s
`tagName` field should match
###### Returns
`boolean` — whether `node` passes the test.
###### Throws
`Error` — When the second parameter is given but invalid.
## 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] © [Titus Wormer][author]
<!-- Definition -->
[build-badge]: https://img.shields.io/travis/syntax-tree/hast-util-is-element.svg
[build]: https://travis-ci.org/syntax-tree/hast-util-is-element
[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/hast-util-is-element.svg
[coverage]: https://codecov.io/github/syntax-tree/hast-util-is-element
[downloads-badge]: https://img.shields.io/npm/dm/hast-util-is-element.svg
[downloads]: https://www.npmjs.com/package/hast-util-is-element
[size-badge]: https://img.shields.io/bundlephobia/minzip/hast-util-is-element.svg
[size]: https://bundlephobia.com/result?p=hast-util-is-element
[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg
[backers-badge]: https://opencollective.com/unified/backers/badge.svg
[collective]: https://opencollective.com/unified
[chat-badge]: https://img.shields.io/badge/join%20the%20community-on%20spectrum-7b16ff.svg
[chat]: https://spectrum.chat/unified/syntax-tree
[npm]: https://docs.npmjs.com/cli/install
[license]: license
[author]: https://wooorm.com
[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
[hast]: https://github.com/syntax-tree/hast
[node]: https://github.com/syntax-tree/unist#node
[element]: https://github.com/syntax-tree/hast#element