Uh oh!
There was an error while loading. Please reload this page.
forked from mauriciopoppe/function-plot
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsite.js
More file actions
Latest commit
50 lines (45 loc) · 1.3 KB
/
Copy pathsite.js
File metadata and controls
50 lines (45 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/**
* Created by mauricio on 4/9/15.
*/
'use strict'
varfs=require('fs')
vardox=require('dox')
var_=require('lodash')
varjade=require('jade')
varversion=require('./package.json').version
varfile=fs.readFileSync('./site/js/site.js',{encoding: 'utf-8'})
varcomments=dox.parseComments(file)
varparsed=comments.map(function(c){
varids=c.code.match(/target:\s*'(.*)'/g)
if(ids){
ids=ids
.map(function(str){
return/#[0-9a-zA-Z\-]*/.exec(str)[0].substr(1)
})
}
varcomment=c.description.full
varexperimental
if(_.find(c.tags,{type: 'experimental'})){
experimental=true
}
varadditionalDOM=_.find(c.tags,{type: 'additionalDOM'})
if(additionalDOM){
additionalDOM=additionalDOM.string
}
comment=comment.replace(/<br\s*\/>/g,' ')
return{
comment: comment,
experimental: experimental,
code: c.code,
additionalDOM: additionalDOM,
ids: ids
}
}).filter(function(entry){
returnentry.ids
})
varoutput=fs.createWriteStream('./site/partials/examples.html')
output.write(jade.compileFile('./site/jade/examples.jade')({comments: parsed}))
output.end()
varwzrd=fs.createWriteStream('./site/partials/wzrd.html')
wzrd.write(jade.compileFile('./site/jade/wzrd.jade')({version: version}))
wzrd.end()