Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 37280a1

Browse files
committed
still can npm start
1 parent 03619d1 commit 37280a1

File tree

7 files changed

+52
-153
lines changed

7 files changed

+52
-153
lines changed

‎dist/article.html‎

Lines changed: 1 addition & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ <h3 class="footer-title">Share</h3>
201201
}catch(e){
202202
return itemCBs.error(e);
203203
}
204+
delete in_memory[cachename];
204205
if(data.length === 0){
205206
itemCBs.done(timestamp);
206207
}else{
@@ -217,38 +218,6 @@ <h3 class="footer-title">Share</h3>
217218
});
218219
});
219220

220-
function Template(template,contain,unique){
221-
this.template = Handlebars.compile(jQuery(template).html());
222-
this.contain = jQuery(contain);
223-
this.unique = {};
224-
if(Array.isArray(unique)){
225-
var l = unique.length;
226-
while(l--){
227-
this.unique[unique[l]] = false;
228-
}
229-
}
230-
this.contain.find(".remove").on("click",this.remove.bind(this));
231-
}
232-
233-
Template.prototype.add = function(item){
234-
if(item.class && typeof this.unique[item.class] != "undefined"){
235-
if(this.unique[item.class]) return;
236-
this.unique[item.class] = true;
237-
}
238-
console.log("appending");
239-
this.contain.append(this.template(item));
240-
};
241-
242-
Template.prototype.remove = function(e){
243-
e.preventDefault();
244-
var art = $(this).closest("article");
245-
var u = art.attr("data-unique");
246-
if(u){
247-
this.unique[u] = false;
248-
}
249-
art.remove();
250-
};
251-
252221

253222
function compileYQL(query){
254223
if(Array.isArray(query)){
@@ -306,33 +275,6 @@ <h3 class="footer-title">Share</h3>
306275
});
307276
});
308277
}
309-
310-
311-
/*
312-
var markdown = require("markdown").markdown;
313-
function parseMarkdown(item,next){
314-
console.log("parsing");
315-
316-
try{
317-
var t = jQuery("<div>"+markdown.toHTML(item.body)+"</div>");
318-
t.find("code").wrap("<pre></pre>");
319-
320-
item.bodyHTML = t.html();
321-
console.log(item.bodyHTML);
322-
}catch(e){
323-
console.log(e);
324-
item.bodyHTML = "<pre>"+item.body+"</pre>";
325-
}
326-
setTimeout(next.bind(next,item),1);
327-
}
328-
/* */
329-
330-
331-
function ISOplus1(iso){
332-
var d = new Date(iso);
333-
d.setSeconds(d.getSeconds() + 1);
334-
return d.toISOString();
335-
}
336278
var errorHandler;
337279
jQuery(function($){
338280
errorHandler = new Template(

‎dist/index.html‎ renamed to ‎dist/blog.html‎

Lines changed: 1 addition & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ <h3 class="footer-title">Share</h3>
188188
}catch(e){
189189
return itemCBs.error(e);
190190
}
191+
delete in_memory[cachename];
191192
if(data.length === 0){
192193
itemCBs.done(timestamp);
193194
}else{
@@ -204,38 +205,6 @@ <h3 class="footer-title">Share</h3>
204205
});
205206
});
206207

207-
function Template(template,contain,unique){
208-
this.template = Handlebars.compile(jQuery(template).html());
209-
this.contain = jQuery(contain);
210-
this.unique = {};
211-
if(Array.isArray(unique)){
212-
var l = unique.length;
213-
while(l--){
214-
this.unique[unique[l]] = false;
215-
}
216-
}
217-
this.contain.find(".remove").on("click",this.remove.bind(this));
218-
}
219-
220-
Template.prototype.add = function(item){
221-
if(item.class && typeof this.unique[item.class] != "undefined"){
222-
if(this.unique[item.class]) return;
223-
this.unique[item.class] = true;
224-
}
225-
console.log("appending");
226-
this.contain.append(this.template(item));
227-
};
228-
229-
Template.prototype.remove = function(e){
230-
e.preventDefault();
231-
var art = $(this).closest("article");
232-
var u = art.attr("data-unique");
233-
if(u){
234-
this.unique[u] = false;
235-
}
236-
art.remove();
237-
};
238-
239208

240209
function compileYQL(query){
241210
if(Array.isArray(query)){
@@ -293,33 +262,6 @@ <h3 class="footer-title">Share</h3>
293262
});
294263
});
295264
}
296-
297-
298-
/*
299-
var markdown = require("markdown").markdown;
300-
function parseMarkdown(item,next){
301-
console.log("parsing");
302-
303-
try{
304-
var t = jQuery("<div>"+markdown.toHTML(item.body)+"</div>");
305-
t.find("code").wrap("<pre></pre>");
306-
307-
item.bodyHTML = t.html();
308-
console.log(item.bodyHTML);
309-
}catch(e){
310-
console.log(e);
311-
item.bodyHTML = "<pre>"+item.body+"</pre>";
312-
}
313-
setTimeout(next.bind(next,item),1);
314-
}
315-
/* */
316-
317-
318-
function ISOplus1(iso){
319-
var d = new Date(iso);
320-
d.setSeconds(d.getSeconds() + 1);
321-
return d.toISOString();
322-
}
323265
var errorHandler;
324266
jQuery(function($){
325267
errorHandler = new Template(

‎html/article.ejs‎

Lines changed: 0 additions & 13 deletions
This file was deleted.

‎html/blog.ejs‎

Lines changed: 0 additions & 11 deletions
This file was deleted.

‎html/input/article.ejs‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<%
2+
cur_page["head"] = include(htmlpath+"/parts/head.html");
3+
cur_page["body"] = include(htmlpath+"/parts/error.html")
4+
+ "\n"+include(htmlpath+"/parts/westoredata.html")
5+
+ "\n"+include(htmlpath+"/parts/blogsingle.html")
6+
+ "\n"+include(htmlpath+"/parts/commentlist.html");
7+
cur_page["foot"] = include(htmlpath+"/footerjs/cacheOrLoad.js")
8+
+ "\n"+include(htmlpath+"/footerjs/utility.js")
9+
+ "\n"+include(htmlpath+"/footerjs/error.js")
10+
+ "\n"+include(htmlpath+"/footerjs/user.js")
11+
+ "\n"+include(htmlpath+"/footerjs/blogsingle.js")
12+
+ "\n"+include(htmlpath+"/footerjs/commentlist.js");
13+
%><%-include(htmlpath+"/template")%>

‎html/input/blog.ejs‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<%
2+
cur_page["head"] = include(htmlpath+"/parts/head.html");
3+
cur_page["body"] = include(htmlpath+"/parts/error.html")
4+
+ "\n"+include(htmlpath+"/parts/westoredata.html")
5+
+ "\n"+include(htmlpath+"/parts/bloglist.html");
6+
cur_page["foot"] = include(htmlpath+"/footerjs/cacheOrLoad.js")
7+
+ "\n"+include(htmlpath+"/footerjs/utility.js")
8+
+ "\n"+include(htmlpath+"/footerjs/error.js")
9+
+ "\n"+include(htmlpath+"/footerjs/user.js")
10+
+ "\n"+include(htmlpath+"/footerjs/bloglist.js");
11+
%><%-include(htmlpath+"/template")%>

‎index.js‎

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
var browserify = require("browserify");
22
var UglifyJS = require("uglify-js");
33
var fs = require("fs");
4+
var path = require("path");
45
var async = require("async");
56
var ejs = require('ejs');
67

7-
module.exports.compileHTML = function compileHTML(inputdir, templatepath, outputdir, next){
8-
fs.readdir(pagepath,function(e,files){
8+
var ob = module.exports = {};
9+
// git@github.com:NodeOS/GitBlog.git
10+
11+
ob.compileHTML = function compileHTML(inputdir, templatepath, outputdir, next){
12+
fs.readdir(inputdir,function(e,files){
913
if(e) return next(e);
1014
async.each(files,function(file,next){
1115
var input = inputdir+"/"+file;
@@ -20,7 +24,8 @@ module.exports.compileHTML = function compileHTML(inputdir, templatepath, output
2024
input,
2125
{
2226
cur_page:{},
23-
templatepath:templatepath
27+
templatepath:templatepath,
28+
htmlpath:path.resolve(templatepath, "../")
2429
},
2530
function(e,file){
2631
if(e) return next(e);
@@ -37,12 +42,12 @@ module.exports.compileHTML = function compileHTML(inputdir, templatepath, output
3742
);
3843
}
3944
);
40-
})
45+
});
4146
},next);
4247
});
4348
};
4449

45-
module.exports.compileJS = function compileJS(inputrequire, outputdir,next){
50+
ob.compileJS = function compileJS(inputrequire, outputdir,next){
4651
var b = browserify();
4752
var l = inputrequire.length;
4853
while(l--){
@@ -64,7 +69,7 @@ module.exports.compileJS = function compileJS(inputrequire, outputdir,next){
6469
b.require("async");
6570
b.bundle(function(e,buff){
6671
if(e) return next(e);
67-
async.parrallel([
72+
async.parallel([
6873
function(){
6974
fs.writeFile(
7075
outputdir+"/api.js",
@@ -90,10 +95,10 @@ module.exports.compileJS = function compileJS(inputrequire, outputdir,next){
9095
});
9196
};
9297

93-
module.exports.compile = function(inputs, templatepath, outputdir, next){
94-
async.parrallel([
95-
compileHTML.bind(void(0),inputs.dir, templatepath, outputdir),
96-
compileJS.bind(void(0),inputs.require, outputdir)
98+
ob.compileAll = functioncompileAll(inputs, templatepath, outputdir, next){
99+
async.parallel([
100+
ob.compileHTML.bind(void(0),inputs.dir, templatepath, outputdir),
101+
ob.compileJS.bind(void(0),inputs.require, outputdir)
97102
],function(e,results){
98103
if(e) return next(e);
99104
var net = [];
@@ -114,6 +119,16 @@ if(!module.parent){
114119
"async",
115120
// "markdown"
116121
],
117-
dir:__dirname+"/html"
122+
dir:__dirname+"/html/input"
118123
};
124+
// git@github.com:NodeOS/GitBlog.git
125+
126+
ob.compileAll(
127+
inputs,
128+
__dirname+"/html/template.ejs",
129+
__dirname+ "/dist",
130+
function(e,results){
131+
if(e) throw e;
132+
console.log(results);
133+
});
119134
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /