@@ -19,43 +19,35 @@ import qualified Elm.Name as N
20sandwich :: N.Name -> B.Builder -> B.Builder
20sandwich :: N.Name -> B.Builder -> B.Builder
21sandwich moduleName javascript =
21sandwich moduleName javascript =
22− header <> javascript <> footer (N.toBuilder moduleName)
22+ let name = N.toBuilder moduleName in
27−<!DOCTYPE HTML>
23+ [r|<!DOCTYPE HTML>
30 <meta charset="UTF-8">
26 <meta charset="UTF-8">
27+ <title>|] <> name <> [r|</title>
34<div id="embed"></div>
31<div id="embed"></div>
36−|]
33+|] <> javascript <> [r|
39−footer :: B.Builder -> B.Builder
43− \// It is too complicated to figure out which kind of Program you created\n\
35+// It is too complicated to figure out which kind of Program you created
44− \// based on only the code. So here we check for different possibilities.\n\
36+// based on only the code. So here we check for different possibilities.
46− \// When you embed compiled Elm into HTML yourself, you should not copy/paste\n\
38+// When you embed compiled Elm into HTML yourself, you should not copy/paste
47− \// from here. Do just the part that makes sense for your application!\n\
39+// from here. Do just the part that makes sense for your application!
49− \var app =\n\
41+var app =
50− \ Elm." <> name <> ".fullscreen\n\
42+ Elm.|] <> name <> [r|.fullscreen
51− \ ? Elm." <> name <> ".fullscreen()\n\
43+ ? Elm.|] <> name <> [r|.fullscreen()
53− \ Elm." <> name <> ".embed\n\
45+ Elm.|] <> name <> [r|.embed
54− \ ? Elm." <> name <> ".embed(document.getElementById('embed'))\n\
46+ ? Elm.|] <> name <> [r|.embed(document.getElementById('embed'))
56− \ Elm." <> name <> ".worker\n\
48+ Elm.|] <> name <> [r|.worker
57− \ ? (document.getElementById('embed').innerText = 'This is a headless program, meaning there is nothing to show here. I started the program anyway though, and you can access it as `app` in the developer console.', Elm." <> name <> ".worker())\n\
49+ ? (document.getElementById('embed').innerText = 'This is a headless program, meaning there is nothing to show here. I started the program anyway though, and you can access it as `app` in the developer console.', Elm.|] <> name <> [r|.worker())
58− \ : (document.getElementById('embed').innerText = 'I cannot figure out what kind of program this is supposed to be. Perhaps someone on Slack can help?', undefined);\n\
50+ : (document.getElementById('embed').innerText = 'I cannot figure out what kind of program this is supposed to be. Perhaps someone on Slack can help?', undefined);
59− \</script>\n\
51+</script>
60− \</body>\n\
52+</body>
61− \</html>"
53+</html>|]