+
+
+## 測試 / Try the demo / Probieren Sie die Demo aus
+
+來自Blockly資源庫的 `blockly_compressed.js`, `blocks_compressed.js`, `javascript_compressed.js`, `msg/js/zh-hant.js`, `msg/js/de.js` 和 `msg/js/en.js ` 應該要放在 `blockly` 資料夾中
+
+The files `blockly_compressed.js`, `blocks_compressed.js`, `javascript_compressed.js`, `msg/js/zh-hant.js`, `msg/js/de.js` and `msg/js/en.js` of the Blockly repository need to be present in the directory `blockly`.
+
+Die Dateien `blockly_compressed.js`, `blocks_compressed.js`, `javascript_compressed.js`, `msg/js/zh-hant.js`, `msg/js/de.js` und `msg/js/en.js ` des Blockly-Repositorys müssen im Verzeichnis `blockly` vorhanden sein.
-A German demo is available as well: http://htmlbausteine.zgtm.de/
-
+你可以到https://github.com/google/blockly 或者將https://github.com/google/blockly/archive/master.zip 解壓縮成為`blockly`資料夾。你也可以手動複製上述的這些檔案來創造你的開發環境。
-## Try the demo
+You can simply checkout the repository https://github.com/google/blockly or unzip https://github.com/google/blockly/archive/master.zip into the directory `blockly`. Or you can pick the files above manually to create an environment you can distribute without moving the whole Blockly source code around.
-The files `blockly_compressed.js`, `blocks_compressed.js`, `javascript_compressed.js` and `msg/js/en.js`
-of the Blockly repository need to be present in the directory `blockly`.
+Sie können einfach das Repository https://github.com/google/blockly auschecken oder https://github.com/google/blockly/archive/master.zip in das Verzeichnis `blockly` entpacken.
+Oder Sie können die obigen Dateien manuell auswählen, um eine Umgebung zu erstellen, die Sie verteilen können, ohne den gesamten Blockly-Quellcode zu verschieben.
-You can simply checkout the repository https://github.com/google/blockly or unzip https://github.com/google/blockly/archive/master.zip into the directory `blockly`.
-Or you can pick the files above manually to create an environment you can distribute without moving the whole Blockly source code around.
+
+範例網頁會將工作區存在瀏覽器的近端儲存區。另外,它也支援匯入和匯出磚磈和匯出HTML檔。
The demo saves the workspace in the local browser storage.
Additionally, it supports importing and exporting blocks (Blockly XML) and exporting the HTML document.
-A German localisation of the demo can be enabled by loading `de.js` instead of `en.js` in the header of the HTML file. (This also needs `msg/js/de.js` from Blockly.)
+Die Demo speichert den Arbeitsbereich im lokalen Browserspeicher.
+Darüber hinaus unterstützt es den Import und Export von Blöcken (Blockly XML) und den Export des HTML-Dokuments.
+
+
+將HTML檔頭部的`zh-hants.js`改為`en.js`,即可製作英文的測試版。(也需要Blockly中的`msg/js/en.js`)
+
+A English localisation of the demo can be enabled by loading `en.js` instead of `zh-hants.js` in the header of the HTML file. (This also needs `msg/js/en.js` from Blockly.)
+
+Eine englische Lokalisierung der Demo kann aktiviert werden, indem `en.js` anstelle von `zh-hants.js` in den Header der HTML-Datei geladen wird. (Dies benötigt auch `msg/js/en.js` von Blockly.)
+
+
+將HTML檔頭部的`zh-hants.js`改為`de.js`,即可製作德文的測試版。(也需要Blockly中的`msg/js/de.js`)
+
+A German localisation of the demo can be enabled by loading `de.js` instead of `zh-hants.js` in the header of the HTML file. (This also needs `msg/js/de.js` from Blockly.)
+
+Eine deutsche Lokalisierung der Demo kann aktiviert werden, indem `de.js` statt `zh-hants.js` in den Header der HTML-Datei geladen wird. (Dies benötigt auch `msg/js/de.js` von Blockly.)
+
+
+## 資源檔 / Library file / Bibliotheksdatei
+
+這個`library_html.xml`檔案是你可以用來在Blockly開發者工具頁 https://blockly-demo.appspot.com/static/demos/blockfactory/index.html 修改或新增磚塊的資源庫。
-## Library files
+The file `library_html.xml` is block library that can be used to modify or add the blocks using the Blockly developer tools: https://blockly-demo.appspot.com/static/demos/blockfactory/index.html
-The files `library_html.xml` and `library_html_german.xml` are block libraries that can be used to modify the blocks using the Blockly developer tools: https://blockly-demo.appspot.com/static/demos/blockfactory/index.html
+Die Datei `library_html.xml` ist eine Blockbibliothek, die verwendet werden kann, um die Blöcke mit den Blockly-Entwicklertools zu ändern oder hinzuzufügen: https://blockly-demo.appspot.com/static/demos/blockfactory/index.html
-## TODO
- * Support more HTML tags and attributes
- * Enforce HTML tag-nesting rules via types
- * Many more …
-## Further ideas
- * Maybe support generating other markup languages (Markdown, LaTeX)
- * Add script-tag and allow for standard Blockly blocks in there
+## 錯誤回報與功能請求 / BUG Report & Feature requset / Fehlerbericht & Funktionsanforderung
+Please send to https://github.com/bwinf/blockly-html/issues
diff --git a/blockly/blockly_compressed.js b/blockly/blockly_compressed.js
new file mode 100644
index 0000000..df8abc6
--- /dev/null
+++ b/blockly/blockly_compressed.js
@@ -0,0 +1,1540 @@
+// Do not edit this file; automatically generated.
+
+/* eslint-disable */
+;(function(root, factory) {
+ if (typeof define === 'function' && define.amd) { // AMD
+ define([], factory);
+ } else if (typeof exports === 'object') { // Node.js
+ module.exports = factory();
+ } else { // Browser
+ var factoryExports = factory();
+ root.Blockly = factoryExports;
+ }
+}(this, function() {
+var $={};
+var longStart$$module$build$src$core$touch=function(a,b){longStop$$module$build$src$core$touch();a.changedTouches&&1!==a.changedTouches.length||(longPid_$$module$build$src$core$touch=setTimeout(function(){a.changedTouches&&(a.button=2,a.clientX=a.changedTouches[0].clientX,a.clientY=a.changedTouches[0].clientY);b&&b.handleRightClick(a)},LONGPRESS$$module$build$src$core$touch))},longStop$$module$build$src$core$touch=function(){longPid_$$module$build$src$core$touch&&(clearTimeout(longPid_$$module$build$src$core$touch),
+longPid_$$module$build$src$core$touch=0)},clearTouchIdentifier$$module$build$src$core$touch=function(){touchIdentifier_$$module$build$src$core$touch=null},shouldHandleEvent$$module$build$src$core$touch=function(a){return!isMouseOrTouchEvent$$module$build$src$core$touch(a)||checkTouchIdentifier$$module$build$src$core$touch(a)},getTouchIdentifierFromEvent$$module$build$src$core$touch=function(a){return a instanceof PointerEvent?String(a.pointerId):a instanceof MouseEvent?"mouse":a.changedTouches&&a.changedTouches[0]&&
+void 0!==a.changedTouches[0].identifier&&null!==a.changedTouches[0].identifier?String(a.changedTouches[0].identifier):"mouse"},checkTouchIdentifier$$module$build$src$core$touch=function(a){const b=getTouchIdentifierFromEvent$$module$build$src$core$touch(a);return void 0!==touchIdentifier_$$module$build$src$core$touch&&null!==touchIdentifier_$$module$build$src$core$touch?touchIdentifier_$$module$build$src$core$touch===b:"mousedown"===a.type||"touchstart"===a.type||"pointerdown"===a.type?(touchIdentifier_$$module$build$src$core$touch=
+b,!0):!1},setClientFromTouch$$module$build$src$core$touch=function(a){if(a.type.startsWith("touch")&&a.changedTouches){const b=a.changedTouches[0];a.clientX=b.clientX;a.clientY=b.clientY}},isMouseOrTouchEvent$$module$build$src$core$touch=function(a){return a.type.startsWith("touch")||a.type.startsWith("mouse")||a.type.startsWith("pointer")},isTouchEvent$$module$build$src$core$touch=function(a){return a.type.startsWith("touch")||a.type.startsWith("pointer")},splitEventByTouches$$module$build$src$core$touch=
+function(a){const b=[];if(a.changedTouches)for(let c=0;csum contnent+
sum contnent
sum contnent+
\n' + statements_content + '
\n'; @@ -76,6 +88,18 @@ HtmlGenerator['plaintext'] = function(block) { return code; }; +HtmlGenerator['text_print'] = function(block) { + var text_content = block.getFieldValue('TEXT'); + var code = text_content + '\n'; + return code; +}; + +HtmlGenerator['text'] = function(block) { + var text_content = block.getFieldValue('TEXT'); + var code = text_content + '\n'; + return code; +}; + HtmlGenerator['division'] = function(block) { var value_name = HtmlGenerator.valueToCode(block, 'NAME', HtmlGenerator.ORDER_ATOMIC); var statements_content = HtmlGenerator.statementToCode(block, 'content'); @@ -101,6 +125,18 @@ HtmlGenerator['bgcolour'] = function(block) { return code; }; +HtmlGenerator['margin'] = function(block) { + var margin = block.getFieldValue('NAME'); + var code = 'margin: ' + margin + ';'; + return code; +}; + +HtmlGenerator['padding'] = function(block) { + var padding = block.getFieldValue('NAME'); + var code = 'padding: ' + padding + ';'; + return code; +}; + HtmlGenerator['genericstyle'] = function(block) { var text_property = block.getFieldValue('property'); var text_value = block.getFieldValue('value'); @@ -108,6 +144,18 @@ HtmlGenerator['genericstyle'] = function(block) { return code; }; +HtmlGenerator['tag_selector'] = function(block) { + var tag = block.getFieldValue('NAME'); + var code = tag; + return code; +}; + +HtmlGenerator['class_selector'] = function(block) { + var c = block.getFieldValue('NAME'); + var code = '.' + c; + return code; +}; + HtmlGenerator['generictag'] = function(block) { var text_name = block.getFieldValue('NAME'); var value_name = HtmlGenerator.valueToCode(block, 'NAME', HtmlGenerator.ORDER_ATOMIC); diff --git a/index.html b/index.html new file mode 100644 index 0000000..1c75e02 --- /dev/null +++ b/index.html @@ -0,0 +1,33 @@ + + +