Skip to content

Commit

Permalink
Updated the HTML template to receive as parameter the blockly's location
Browse files Browse the repository at this point in the history
  • Loading branch information
maveme committed Sep 14, 2020
1 parent 81de6d7 commit 0e8ac49
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
11 changes: 6 additions & 5 deletions src/kogi/html/WebPage.rsc
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@ import String;

private loc HTML_TEMPLATE = |project://kogi/src/kogi/html/blocklyTemplate.html|;

void createHTML(str toolbox, str title, str div, loc dstPath)
= writeFile(dstPath + "index.html", HTMLcontent(toolbox, title, div));
void createHTML(str toolbox, str title, str div, loc dstPath, str lib)
= writeFile(dstPath + "index.html", HTMLcontent(toolbox, title, div, lib));


str HTMLcontent(str toolbox, str title, str div)
= replaceAll(
str HTMLcontent(str toolbox, str title, str div, str lib)
= replaceAll(replaceAll(
replaceAll(
replaceAll(tmpl,
"{__TOOLBOX__}", toolbox),
"{__TITLE__}", title),
"{__DIV__}", div)
"{__DIV__}", div),
"{__BLOCKLY__}", lib)
when tmpl := readFile(HTML_TEMPLATE);
8 changes: 4 additions & 4 deletions src/kogi/html/blocklyTemplate.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
<head>
<meta charset="UTF-8">
<meta name="google" value="notranslate">
<script src="../../../../resources/blockly/blockly_compressed.js"></script>
<script src="../../../../resources/blockly/blocks_compressed.js"></script>
<script src="{__BLOCKLY__}/blockly_compressed.js"></script>
<script src="{__BLOCKLY__}/blocks_compressed.js"></script>
<!-- Messages for the user's language -->
<script src="../../../../resources/blockly/msg/js/en.js"></script>
<script src="../../../../resources/blockly/appengine/storage.js"></script>
<script src="{__BLOCKLY__}/msg/js/en.js"></script>
<script src="{__BLOCKLY__}/appengine/storage.js"></script>
<title>{__TITLE__}</title>
</head>
<body>
Expand Down

0 comments on commit 0e8ac49

Please sign in to comment.