mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-05-25 06:13:44 +00:00
gdocs.js should store files under docs/content/[collection]/
This commit is contained in:
parent
2094bc8f61
commit
91f9efed49
1 changed files with 5 additions and 6 deletions
11
gdocs.js
11
gdocs.js
|
|
@ -38,9 +38,8 @@ function help(){
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
function fetch(name, url){
|
function fetch(collection, url){
|
||||||
//https://docs.google.com/feeds/default/private/full/folder%3Afolder_id/contents
|
console.log('fetching a list of docs in collection ' + collection + '...');
|
||||||
console.log('fetching a list of docs in collection ' + name + '...');
|
|
||||||
request('GET', url, {
|
request('GET', url, {
|
||||||
headers: {
|
headers: {
|
||||||
'Gdata-Version': '3.0',
|
'Gdata-Version': '3.0',
|
||||||
|
|
@ -54,14 +53,14 @@ function fetch(name, url){
|
||||||
var title = entry.match(/<title>(.*?)<\/title>/)[1];
|
var title = entry.match(/<title>(.*?)<\/title>/)[1];
|
||||||
if (title.match(/\.ngdoc$/)) {
|
if (title.match(/\.ngdoc$/)) {
|
||||||
var exportUrl = entry.match(/<content type='text\/html' src='(.*?)'\/>/)[1];
|
var exportUrl = entry.match(/<content type='text\/html' src='(.*?)'\/>/)[1];
|
||||||
download(title, exportUrl);
|
download(collection, title, exportUrl);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function download(name, url) {
|
function download(collection, name, url) {
|
||||||
console.log('Downloading:', name, '...');
|
console.log('Downloading:', name, '...');
|
||||||
request('GET', url + '&exportFormat=txt',
|
request('GET', url + '&exportFormat=txt',
|
||||||
{
|
{
|
||||||
|
|
@ -87,7 +86,7 @@ function download(name, url) {
|
||||||
|
|
||||||
|
|
||||||
data = data + '\n';
|
data = data + '\n';
|
||||||
fs.writeFileSync('docs/' + name, reflow(data, 100));
|
fs.writeFileSync('docs/content/' + collection + '/' + name, reflow(data, 100));
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue