Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(172)

Side by Side Diff: utils/apidoc/mdn/search.js

Issue 1361163002: remove docgen remnants from repo, update CHANGELOG (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: remove unused code Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « utils/apidoc/mdn/prettyPrint.dart ('k') | utils/apidoc/mdn/util.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /**
2 * Uses a Google Custom Search Engine to find pages on
3 * developer.mozilla.org that appear to match types from the Webkit IDL
4 */
5 var https = require('https');
6 var fs = require('fs');
7
8 var domTypes = JSON.parse(fs.readFileSync('data/domTypes.json', 'utf8'));
9
10 try {
11 fs.mkdirSync('output');
12 fs.mkdirSync('output/search');
13 } catch (e) {
14 // It doesn't matter if the directories already exist.
15 }
16
17 function searchForType(type) {
18 // Strip off WebKit specific prefixes from type names to increase the chances
19 // of getting matches on developer.mozilla.org.
20 var shortType = type.replace(/^WebKit/, "");
21
22 // We use a Google Custom Search Engine provisioned for 10,000 API based
23 // queries per day that limits search results to developer.mozilla.org.
24 // You shouldn't need to, but if you want to create your own Google Custom
25 // Search Engine, visit http://www.google.com/cse/
26 var options = {
27 host: 'www.googleapis.com',
28 path: '/customsearch/v1?key=AIzaSyDN1RhE5FafLzLfErGpoYhHlLHeyEkxTkM&' +
29 'cx=017193972565947830266:wpqsk6dy6ee&num=5&q=' + shortType,
30 port: 443,
31 method: 'GET'
32 };
33
34 var req = https.request(options, function(res) {
35 res.setEncoding('utf8');
36 var data = '';
37 res.on('data', function(d) {
38 data += d;
39 });
40 var onClose = function(e) {
41 fs.writeFile("output/search/" + type + ".json", data, function(err) {
42 if (err) throw err;
43 console.log('Done searching for ' + type);
44 });
45 }
46 res.on('close', onClose);
47 res.on('end', onClose);
48 });
49 req.end();
50
51 req.on('error', function(e) {
52 console.error(e);
53 });
54 }
55
56 for (var i = 0; i < domTypes.length; i++) {
57 searchForType(domTypes[i]);
58 }
OLDNEW
« no previous file with comments | « utils/apidoc/mdn/prettyPrint.dart ('k') | utils/apidoc/mdn/util.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698