Intentional indentation and newlines

This commit is contained in:
Tim Schaub
2015-11-14 12:20:50 -07:00
parent 58d22350d8
commit 74f2b4cb74
2 changed files with 22 additions and 17 deletions
+5 -10
View File
@@ -56,19 +56,14 @@
<head> <head>
<title>{{ title }}</title> <title>{{ title }}</title>
<link rel="stylesheet" href="http://openlayers.org/en/v{{ olVersion }}/css/ol.css" type="text/css"> <link rel="stylesheet" href="http://openlayers.org/en/v{{ olVersion }}/css/ol.css" type="text/css">
<script src="http://openlayers.org/en/v{{ olVersion }}/build/ol.js"></script> <script src="http://openlayers.org/en/v{{ olVersion }}/build/ol.js"></script>{{#if extraHead.remote}}
{{ extraHead.remote }} {{ indent extraHead.remote spaces=4 }}{{/if}}{{#if css.source}}
{{#if css.source}}
<style> <style>
{{ css.source }} {{ indent css.source spaces=6 }} </style>{{/if}}
</style>
{{/if}}
</head> </head>
<body> <body>
{{ contents }} {{ indent contents spaces=4 }} <script>
<script> {{ indent js.source spaces=6 }} </script>
{{ js.source }}
</script>
</body> </body>
&lt;/html&gt;</code></pre> &lt;/html&gt;</code></pre>
</div> </div>
+10
View File
@@ -233,6 +233,16 @@ function main(callback) {
helpers: { helpers: {
md: function(str) { md: function(str) {
return new handlebars.SafeString(marked(str)); return new handlebars.SafeString(marked(str));
},
indent: function(text, options) {
if (!text) {
return text;
}
var count = options.hash.spaces || 2;
var spaces = new Array(count + 1).join(' ');
return text.split('\n').map(function(line) {
return line ? spaces + line : '';
}).join('\n');
} }
} }
})) }))