scripts: rename file

This commit is contained in:
jean-emmanuel 2018-08-31 11:17:56 +02:00
parent 6a1ff68f33
commit 65d67d399f

View file

@ -1,132 +0,0 @@
// Dirty browser window shim
document = {
createElementNS: x=>[],
addEventListener: ()=>{},
createRange: ()=>{
return {
createContextualFragment:()=>{return {
firstChild: {
querySelectorAll: x=>[]
}
}},
selectNode: ()=>{}
}
}
}
window = {
addEventListener: ()=>{},
location: {},
document: document,
navigator: {},
NodeList: Array,
WebSocket: Object
}
Object.assign(global, window)
// Required globals
DOM = require('../src/browser/js/app/dom')
DOM.init()
CANVAS_FRAMERATE = 1
LANG = 'en'
// Here we go
var widgets = require('../src/browser/js/app/widgets'),
base = require('../src/browser/js/app/widgets/common/widget').defaults(),
doc = []
doc.push(`
## Generic properties
| property | type |default | description |
| --- | --- | --- | --- |`
)
for (var propName in base) {
var prop = base[propName],
permalink = propName
if (propName[0] === '_' && propName !== '_props') {
doc.push(`
| <h4 class="thead2" id="${prop}">${prop}<a class="headerlink" href="#${prop}" title="Permanent link"></a></h4> ||||`
)
}
if (propName === '_props' || propName[0] === '_') continue
var help = Array.isArray(prop.help) ? prop.help.join('<br/><br/>').replace(/<br\/>-/g, '-') : prop.help || ''
doc.push(`
| <h4 id="${permalink}">${propName}<a class="headerlink" href="#${permalink}" title="Permanent link"></a></h4> | \`${prop.type.replace(/\|/g,'\`\\|<br/>\`')}\` | <code>${(JSON.stringify(prop.value, null, '&nbsp;') || '').replace(/\n/g,'<br/>')}</code> | ${help} |`
)
}
for (var k in widgets.categories) {
var category = widgets.categories[k]
doc.push(`
## ${k}`
)
for (var kk in category) {
var type = category[kk],
defaults = widgets.widgets[type].defaults(),
separator = false
doc.push(`
### ${type}
| property | type |default | description |
| --- | --- | --- | --- |`
)
for (var propName in defaults) {
var prop = defaults[propName],
permalink = type + '_' + propName
if (propName[0] === '_' && propName !== '_props') {
if (separator) doc.pop()
doc.push(`
| <h4 class="thead2" id="${type + '_' + prop}">${prop}<a class="headerlink" href="#${type + '_' + prop}" title="Permanent link"></a></h4> ||||`
)
separator = true
}
if (propName === '_props' || propName[0] === '_' || JSON.stringify(prop) == JSON.stringify(base[propName])) continue
var help = Array.isArray(prop.help) ? prop.help.join('<br/><br/>').replace(/<br\/>-/g, '-') : prop.help || ''
doc.push(`
| <h4 id="${permalink}">${propName}<a class="headerlink" href="#${permalink}" title="Permanent link"></a></h4> | \`${prop.type.replace(/\|/g,'\`\\|<br/>\`')}\` | <code>${(JSON.stringify(prop.value, null, '&nbsp;') || '').replace(/\n/g,'<br/>')}</code> | ${help} |`
)
separator = false
}
if (separator) doc.pop()
}
}
doc.push(`\n\n
<script>
document.querySelectorAll('.thead2').forEach(function(item){
item.classList.remove('thead2')
item.closest('tr').classList.add('thead2')
})
</script>
`)
console.log(doc.map(x=>x.replace(/^ +/gm,'')).join(''))