94 lines
2.5 KiB
JavaScript
94 lines
2.5 KiB
JavaScript
function Docs()
|
|
{
|
|
this.export = function()
|
|
{
|
|
var html = "";
|
|
|
|
html += this.print_intro();
|
|
html += "## Cursor\n";
|
|
html += "- `$` replace with **Pos**.\n";
|
|
html += "- `$+shift` replace with **Rect**.\n\n";
|
|
|
|
html += "## Modules\n";
|
|
html += this.print_modules(ronin.modules);
|
|
html += this.print_license();
|
|
|
|
// dialog.showSaveDialog((fileName) => {
|
|
// if (fileName === undefined){ return; }
|
|
// console.log(fileName)
|
|
// fs.writeFile(fileName, html, (err) => {
|
|
// if(err){ alert("An error ocurred creating the file "+ err.message); return; }
|
|
// });
|
|
// });
|
|
|
|
fs.writeFile("/Users/VillaMoirai/Github/HundredRabbits/Ronin/README.md", html, (err) => {
|
|
if(err){ alert("An error ocurred creating the file "+ err.message); return; }
|
|
});
|
|
|
|
return html;
|
|
}
|
|
|
|
this.print_intro = function()
|
|
{
|
|
html = "# Ronin\n";
|
|
html += "Ronin is a simple open-source graphic design tool.\n\n";
|
|
html += "<img src='https://raw.githubusercontent.com/hundredrabbits/Ronin/master/PREVIEW.jpg' width='600'/>\n\n";
|
|
return html;
|
|
}
|
|
|
|
this.print_modules = function(modules)
|
|
{
|
|
var html = "";
|
|
|
|
for(module_name in modules){
|
|
var module = modules[module_name];
|
|
html += "## "+module_name+"\n\n";
|
|
html += module.docs+"\n\n";
|
|
html += this.print_methods(module.methods)+"\n";
|
|
html += this.print_settings(module.settings)+"\n";
|
|
html += this.print_ports(module.ports)+"\n";
|
|
}
|
|
return html+"\n";
|
|
}
|
|
|
|
this.print_methods = function(methods)
|
|
{
|
|
var html = "### Methods\n";
|
|
|
|
for(method_name in methods){
|
|
var method = methods[method_name];
|
|
html += "- `"+method_name+":"+method.params+"` "+method.info+"\n";
|
|
}
|
|
return html;
|
|
}
|
|
|
|
this.print_settings = function(settings)
|
|
{
|
|
var html = "### Settings\n";
|
|
|
|
for(setting_name in settings){
|
|
var setting_val = settings[setting_name];
|
|
html += "- `"+setting_name+"`, default "+setting_val+"\n";
|
|
}
|
|
return html;
|
|
}
|
|
|
|
|
|
this.print_ports = function(ports)
|
|
{
|
|
var html = "### Ports\n";
|
|
|
|
for(port_name in ports){
|
|
var port = ports[port_name];
|
|
html += "- `"+(port.input ? '->' : '')+""+port.name+""+(port.output ? '->' : '')+"` **("+port.value+"/"+port.max+")** "+port.docs+".\n";
|
|
}
|
|
return html;
|
|
}
|
|
|
|
this.print_license = function()
|
|
{
|
|
html = "## License\n";
|
|
html += "See the [LICENSE](LICENSE.md) file for license rights and limitations (CC).\n";
|
|
return html;
|
|
}
|
|
} |