1
0
mirror of https://github.com/namibia/tips.git synced 2024-11-15 17:47:12 +00:00
git-tips/.doxie.render.js

25 lines
487 B
JavaScript
Raw Normal View History

2015-07-15 11:01:27 +00:00
function escapeStr(str) {
return str
.replace(/\"/g, '\\"')
.replace(/\n/g, '\\n');
}
var render = function(data) {
var data = data.data;
2015-07-17 07:31:25 +00:00
var tips = [
2015-07-15 11:01:27 +00:00
'## ' + data.title,
'```sh',
data.tip,
'```',
'\n'
2015-07-17 07:31:25 +00:00
];
Array.isArray(data.alternatives) && tips.push(['__Alternatives:__']) &&
data.alternatives.map(function(alternative){
tips = tips.concat(['```sh',alternative,'```','\n'])
});
return tips.join('\n');
2015-07-15 11:01:27 +00:00
};
module.exports = render;