From 74f2b4cb742888e773f83996b192816434f86b3e Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Sat, 14 Nov 2015 12:20:50 -0700 Subject: [PATCH] Intentional indentation and newlines --- config/examples/strapless.html | 29 ++++++++++++----------------- tasks/build-examples.js | 10 ++++++++++ 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/config/examples/strapless.html b/config/examples/strapless.html index 7f326efbe1..3417c38d8f 100644 --- a/config/examples/strapless.html +++ b/config/examples/strapless.html @@ -53,23 +53,18 @@
<!DOCTYPE html>
 <html>
-<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}}
-<style>
-{{ css.source }}
-</style>
-{{/if}}
-</head>
-<body>
-{{ contents }}
-<script>
-{{ js.source }}
-</script>
-</body>
+  <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>{{#if extraHead.remote}}
+{{ indent extraHead.remote spaces=4 }}{{/if}}{{#if css.source}}
+    <style>
+{{ indent css.source spaces=6 }}    </style>{{/if}}
+  </head>
+  <body>
+{{ indent contents spaces=4 }}    <script>
+{{ indent js.source spaces=6 }}    </script>
+  </body>
 </html>
diff --git a/tasks/build-examples.js b/tasks/build-examples.js index 46e81e57f5..0563906e45 100644 --- a/tasks/build-examples.js +++ b/tasks/build-examples.js @@ -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'); } } }))