Last change
on this file since 571e0df was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
891 bytes
|
Line | |
---|
1 | var cheerio = require('cheerio')
|
---|
2 | , http = require('http');
|
---|
3 |
|
---|
4 | http.get('http://www.w3.org/html/wg/drafts/html/master/syntax.html', function (res) {
|
---|
5 | var str = '';
|
---|
6 | res.setEncoding('utf8');
|
---|
7 | res.on('data', function (buf) {
|
---|
8 | str += buf;
|
---|
9 | }).on('end', function () {
|
---|
10 | var $ = cheerio.load(str);
|
---|
11 | var codes = $('dfn#void-elements')
|
---|
12 | .parent()
|
---|
13 | .next()
|
---|
14 | .text()
|
---|
15 | .replace(/\s/gm,'')
|
---|
16 | .split(",")
|
---|
17 | .reduce(function (obj, code) {
|
---|
18 | obj[code] = true;
|
---|
19 | return obj;
|
---|
20 | }, {});
|
---|
21 |
|
---|
22 | console.log('/**');
|
---|
23 | console.log(' * This file automatically generated from `pre-publish.js`.');
|
---|
24 | console.log(' * Do not manually edit.');
|
---|
25 | console.log(' */');
|
---|
26 | console.log();
|
---|
27 | console.log('module.exports = %s;', JSON.stringify(codes, null, 2));
|
---|
28 | });
|
---|
29 | });
|
---|
Note:
See
TracBrowser
for help on using the repository browser.