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>
<title>{{ title }}</title>
<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>
{{ extraHead.remote }}
{{#if css.source}}
<script src="http://openlayers.org/en/v{{ olVersion }}/build/ol.js"></script>{{#if extraHead.remote}}
{{ indent extraHead.remote spaces=4 }}{{/if}}{{#if css.source}}
<style>
{{ css.source }}
</style>
{{/if}}
{{ indent css.source spaces=6 }} </style>{{/if}}
</head>
<body>
{{ contents }}
<script>
{{ js.source }}
</script>
{{ indent contents spaces=4 }} <script>
{{ indent js.source spaces=6 }} </script>
</body>
&lt;/html&gt;</code></pre>
</div>
+10
View File
@@ -233,6 +233,16 @@ function main(callback) {
helpers: {
md: function(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');
}
}
}))