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

46
node_modules/detab/index.js generated vendored Normal file
View File

@ -0,0 +1,46 @@
'use strict'
module.exports = detab
var repeat = require('repeat-string')
var tab = 0x09
var lineFeed = 0x0a
var carriageReturn = 0x0d
// Replace tabs with spaces, being smart about which column the tab is at and
// which size should be used.
function detab(value, size) {
var string = typeof value === 'string'
var length = string && value.length
var start = 0
var index = -1
var column = -1
var tabSize = size || 4
var results = []
var code
var add
if (!string) {
throw new Error('detab expected string')
}
while (++index < length) {
code = value.charCodeAt(index)
if (code === tab) {
add = tabSize - ((column + 1) % tabSize)
column += add
results.push(value.slice(start, index) + repeat(' ', add))
start = index + 1
} else if (code === lineFeed || code === carriageReturn) {
column = -1
} else {
column++
}
}
results.push(value.slice(start))
return results.join('')
}

22
node_modules/detab/license generated vendored Normal file
View File

@ -0,0 +1,22 @@
(The MIT License)
Copyright (c) 2015 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.

103
node_modules/detab/package.json generated vendored Normal file
View File

@ -0,0 +1,103 @@
{
"_from": "detab@^2.0.0",
"_id": "detab@2.0.2",
"_inBundle": false,
"_integrity": "sha512-Q57yPrxScy816TTE1P/uLRXLDKjXhvYTbfxS/e6lPD+YrqghbsMlGB9nQzj/zVtSPaF0DFPSdO916EWO4sQUyQ==",
"_location": "/detab",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "detab@^2.0.0",
"name": "detab",
"escapedName": "detab",
"rawSpec": "^2.0.0",
"saveSpec": null,
"fetchSpec": "^2.0.0"
},
"_requiredBy": [
"/mdast-util-to-hast"
],
"_resolved": "https://registry.npmjs.org/detab/-/detab-2.0.2.tgz",
"_shasum": "074970d1a807b045d0258a4235df5928dd683561",
"_spec": "detab@^2.0.0",
"_where": "/Users/stefanfejes/Projects/30-seconds-of-python-code/node_modules/mdast-util-to-hast",
"author": {
"name": "Titus Wormer",
"email": "tituswormer@gmail.com",
"url": "https://wooorm.com"
},
"bugs": {
"url": "https://github.com/wooorm/detab/issues"
},
"bundleDependencies": false,
"contributors": [
{
"name": "Titus Wormer",
"email": "tituswormer@gmail.com",
"url": "https://wooorm.com"
}
],
"dependencies": {
"repeat-string": "^1.5.4"
},
"deprecated": false,
"description": "Detab: tabs -> spaces",
"devDependencies": {
"browserify": "^16.0.0",
"nyc": "^14.0.0",
"prettier": "^1.12.1",
"remark-cli": "^6.0.0",
"remark-preset-wooorm": "^4.0.0",
"tape": "^4.0.0",
"tinyify": "^2.5.0",
"xo": "^0.24.0"
},
"files": [
"index.js"
],
"homepage": "https://github.com/wooorm/detab#readme",
"keywords": [
"detab",
"tab",
"space",
"tab-size",
"size"
],
"license": "MIT",
"name": "detab",
"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/wooorm/detab.git"
},
"scripts": {
"build": "npm run build-bundle && npm run build-mangle",
"build-bundle": "browserify . -s detab -o detab.js",
"build-mangle": "browserify . -s detab -p tinyify -o detab.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": "2.0.2",
"xo": {
"prettier": true,
"esnext": false,
"ignores": [
"detab.js"
]
}
}

78
node_modules/detab/readme.md generated vendored Normal file
View File

@ -0,0 +1,78 @@
# detab
[![Build][build-badge]][build]
[![Coverage][coverage-badge]][coverage]
[![Downloads][downloads-badge]][downloads]
[![Size][size-badge]][size]
Detab: tabs → spaces.
## Installation
[npm][]:
```bash
npm install detab
```
## Usage
```javascript
var detab = require('detab')
console.log(detab('\tfoo\nbar\tbaz'))
console.log(detab('\tfoo\nbar\tbaz', 2))
console.log(detab('\tfoo\nbar\tbaz', 8))
```
Yields:
```text
foo
bar baz
```
```text
foo
bar baz
```
```text
foo
bar baz
```
## API
### `detab(value[, size=4])`
Replace tabs with spaces in `value` (`string`), being smart about which
column the tab is at and which `size` (`number`, default: `4`) should be used.
## License
[MIT][license] © [Titus Wormer][author]
<!-- Definitions -->
[build-badge]: https://img.shields.io/travis/wooorm/detab.svg
[build]: https://travis-ci.org/wooorm/detab
[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/detab.svg
[coverage]: https://codecov.io/github/wooorm/detab
[downloads-badge]: https://img.shields.io/npm/dm/detab.svg
[downloads]: https://www.npmjs.com/package/detab
[size-badge]: https://img.shields.io/bundlephobia/minzip/detab.svg
[size]: https://bundlephobia.com/result?p=detab
[npm]: https://docs.npmjs.com/cli/install
[license]: license
[author]: https://wooorm.com