-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 129b312
Showing
16 changed files
with
383 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 4 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.{json,remarkrc,eslintrc,sh}] | ||
indent_size = 2 | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
coverage/ | ||
example.js | ||
web-namespaces.js | ||
web-namespaces.min.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"extends": "eslint:recommended", | ||
"rules": { | ||
"quotes": [2, "single"] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.DS_Store | ||
*.log | ||
coverage/ | ||
node_modules/ | ||
web-namespaces.js | ||
web-namespaces.min.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"excludeFiles": [ | ||
"coverage/", | ||
"node_modules/", | ||
"web-namespaces.js", | ||
"web-namespaces.min.js" | ||
], | ||
"preset": "yandex", | ||
"requireQuotedKeysInObjects": true, | ||
"disallowQuotedKeysInObjects": false, | ||
"maximumLineLength": { | ||
"value": 79, | ||
"allExcept": [ | ||
"regex", | ||
"urlComments" | ||
] | ||
}, | ||
"jsDoc": { | ||
"checkAnnotations": "jsdoc3", | ||
"checkParamExistence": true, | ||
"checkParamNames": true, | ||
"checkRedundantAccess": true, | ||
"checkRedundantParams": true, | ||
"checkRedundantReturns": true, | ||
"checkReturnTypes": true, | ||
"checkTypes": "strictNativeCase", | ||
"enforceExistence": true, | ||
"requireHyphenBeforeDescription": true, | ||
"requireNewlineAfterDescription": true, | ||
"requireParamDescription": true, | ||
"requireParamTypes": true, | ||
"requireReturnDescription": true, | ||
"requireReturnTypes": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"output": true, | ||
"plugins": [ | ||
"lint", | ||
"github", | ||
"comment-config", | ||
"usage", | ||
"validate-links" | ||
], | ||
"settings": { | ||
"bullet": "*" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
language: node_js | ||
node_js: | ||
- '0.10' | ||
- '0.11' | ||
- '0.12' | ||
- '4.0' | ||
- '5.0' | ||
after_script: npm install codecov.io && cat ./coverage/lcov.info | codecov | ||
deploy: | ||
- provider: npm | ||
email: tituswormer@gmail.com | ||
api_key: | ||
secure: SCkzrnjupm6idVxRmbQCJv7FZ7i8HMotYG1+9wniymEUF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1YyZIQbcXIsrxj7Z5Mx7JehOe7nYFjTktDL/WPtCuLuuXrKrQpChEXRqUqa8vn1ffcZ8B6G0sgNNKNpqiDbzR/hYre675M97cJJkGmX1CuuLXR0N5cLNB1M+ENCz2GR+iLmDG8M5gn/cYs0p8UpQyZ2Bli5oyg4VgUD6BaVIH76UQhB7KmTHqQh8urBr2tweuj+Cwy/FTbR+dRSEq54YCuHgDT4bv4a8NWkXw2FVS/S3uyqoVeVLs2T0r7HfMIidFFqOVQR4Dg/VDHHsthHNE3A4mtUzDw8ZUAEa/n+ecwenQ= | ||
file: | ||
- "web-namespaces.js" | ||
- "web-namespaces.min.js" | ||
on: | ||
tags: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// Dependencies: | ||
var webNamespaces = require('./index.js'); | ||
|
||
// Yields: | ||
console.log('js', require('util').inspect(webNamespaces)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<!--remark setext--> | ||
|
||
<!--lint disable no-multiple-toplevel-headings--> | ||
|
||
0.0.0 / 2016-03-19 | ||
================== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/** | ||
* @author Titus Wormer | ||
* @copyright 2016 Titus Wormer | ||
* @license MIT | ||
* @module web-namespaces | ||
* @fileoverview Map of web namespaces. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
/* eslint-env commonjs */ | ||
|
||
/* | ||
* Expose. | ||
*/ | ||
|
||
module.exports = require('./index.json'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"html": "http://www.w3.org/1999/xhtml", | ||
"mathml": "http://www.w3.org/1998/Math/MathML", | ||
"svg": "http://www.w3.org/2000/svg", | ||
"xlink": "http://www.w3.org/1999/xlink", | ||
"xml": "http://www.w3.org/XML/1998/namespace", | ||
"xmlns": "http://www.w3.org/2000/xmlns/" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
{ | ||
"name": "web-namespaces", | ||
"version": "0.0.0", | ||
"description": "Map of web namespaces", | ||
"license": "MIT", | ||
"keywords": [ | ||
"web", | ||
"platform", | ||
"namespace", | ||
"namespaces", | ||
"whatwg", | ||
"w3c" | ||
], | ||
"dependencies": {}, | ||
"files": [ | ||
"index.js", | ||
"index.json" | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/wooorm/web-namespaces.git" | ||
}, | ||
"bugs": "https://github.com/wooorm/web-namespaces/issues", | ||
"author": "Titus Wormer <tituswormer@gmail.com> (http://wooorm.com)", | ||
"contributors": [ | ||
"Titus Wormer <tituswormer@gmail.com> (http://wooorm.com)" | ||
], | ||
"devDependencies": { | ||
"bail": "^1.0.0", | ||
"browserify": "^13.0.0", | ||
"cheerio": "^0.20.0", | ||
"eslint": "^2.0.0", | ||
"esmangle": "^1.0.1", | ||
"istanbul": "^0.4.0", | ||
"jscs": "^2.0.0", | ||
"jscs-jsdoc": "^1.0.0", | ||
"remark": "^4.0.0", | ||
"remark-comment-config": "^3.0.0", | ||
"remark-github": "^4.0.1", | ||
"remark-lint": "^3.0.0", | ||
"remark-usage": "^3.0.0", | ||
"remark-validate-links": "^3.0.0", | ||
"tape": "^4.4.0" | ||
}, | ||
"scripts": { | ||
"build-md": "remark . --quiet --frail", | ||
"build-crawl": "node script/build.js", | ||
"build-bundle": "browserify index.js --bare -s webNamespaces > web-namespaces.js", | ||
"build-mangle": "esmangle web-namespaces.js > web-namespaces.min.js", | ||
"build": "npm run build-md && npm run build-bundle && npm run build-mangle", | ||
"lint-api": "eslint .", | ||
"lint-style": "jscs --reporter inline .", | ||
"lint": "npm run lint-api && npm run lint-style", | ||
"test-api": "node test.js", | ||
"test-coverage": "istanbul cover test.js", | ||
"test": "npm run build && npm run lint && npm run test-coverage" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# web-namespaces [![Build Status][build-badge]][build-page] [![Coverage Status][coverage-badge]][coverage-page] | ||
|
||
Map of web namespaces. | ||
|
||
## Installation | ||
|
||
[npm][]: | ||
|
||
```bash | ||
npm install web-namespaces | ||
``` | ||
|
||
**web-namespaces** is also available as an AMD, CommonJS, and globals | ||
module, [uncompressed and compressed][releases]. | ||
|
||
## Usage | ||
|
||
Dependencies: | ||
|
||
```javascript | ||
var webNamespaces = require('web-namespaces'); | ||
``` | ||
|
||
Yields: | ||
|
||
```js | ||
{ html: 'http://www.w3.org/1999/xhtml', | ||
mathml: 'http://www.w3.org/1998/Math/MathML', | ||
svg: 'http://www.w3.org/2000/svg', | ||
xlink: 'http://www.w3.org/1999/xlink', | ||
xml: 'http://www.w3.org/XML/1998/namespace', | ||
xmlns: 'http://www.w3.org/2000/xmlns/' } | ||
``` | ||
|
||
## API | ||
|
||
### `webNamespaces` | ||
|
||
`Object.<string, string>` — Map of short-name to namespaces. | ||
|
||
## License | ||
|
||
[MIT][license] © [Titus Wormer][author] | ||
|
||
<!-- Definition --> | ||
|
||
[build-badge]: https://img.shields.io/travis/wooorm/web-namespaces.svg | ||
|
||
[build-page]: https://travis-ci.org/wooorm/web-namespaces | ||
|
||
[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/web-namespaces.svg | ||
|
||
[coverage-page]: https://codecov.io/github/wooorm/web-namespaces?branch=master | ||
|
||
[npm]: https://docs.npmjs.com/cli/install | ||
|
||
[releases]: https://github.com/wooorm/web-namespaces/releases | ||
|
||
[license]: LICENSE | ||
|
||
[author]: http://wooorm.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/** | ||
* @author Titus Wormer | ||
* @copyright 2016 Titus Wormer | ||
* @license MIT | ||
* @module web-namespaces:script:build | ||
* @fileoverview Crawl the tables. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
/* eslint-env node */ | ||
|
||
/* | ||
* Dependencies. | ||
*/ | ||
|
||
var fs = require('fs'); | ||
var path = require('path'); | ||
var https = require('https'); | ||
var cheerio = require('cheerio'); | ||
var bail = require('bail'); | ||
var map = require('..'); | ||
|
||
/* | ||
* Input / output locations. | ||
*/ | ||
|
||
var input = 'https://html.spec.whatwg.org/multipage/infrastructure.html'; | ||
var output = path.join(__dirname, '..', 'index.json'); | ||
|
||
/* | ||
* Crawl WhatWG. | ||
*/ | ||
|
||
https.get(input, function (res, err) { | ||
var value = ''; | ||
|
||
if (err) { | ||
bail(err); | ||
} | ||
|
||
res | ||
.setEncoding('utf8') | ||
.on('data', function (buf) { | ||
value += buf; | ||
}).on('end', function () { | ||
var node = cheerio.load(value)('#namespaces').next(); | ||
var name; | ||
var data; | ||
|
||
while (node.get(0).name === 'p') { | ||
name = node.find('dfn').get(0).attribs.id; | ||
data = node.find('code').get(0).children[0].data; | ||
|
||
map[name.slice(0, name.indexOf('-'))] = data; | ||
|
||
node = node.next(); | ||
} | ||
|
||
fs.writeFile(output, JSON.stringify(map, 0, 2) + '\n', bail); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/** | ||
* @author Titus Wormer | ||
* @copyright 2016 Titus Wormer | ||
* @license MIT | ||
* @module web-namespaces | ||
* @fileoverview Test suite for `web-namespaces`. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
/* eslint-env node */ | ||
|
||
/* | ||
* Module dependencies. | ||
*/ | ||
|
||
var test = require('tape'); | ||
var webNamespaces = require('./index.js'); | ||
|
||
/* | ||
* Tests. | ||
*/ | ||
|
||
test('webNamespaces', function (t) { | ||
var key; | ||
|
||
t.ok( | ||
typeof webNamespaces === 'object', | ||
'should be an `object`' | ||
); | ||
|
||
for (key in webNamespaces) { | ||
t.equal( | ||
typeof webNamespaces[key], | ||
'string', | ||
'`' + key + '` should refer to a `string`' | ||
); | ||
} | ||
|
||
t.end(); | ||
}); |