From 9c0a4f4fe161c1bdf64b0a517e0f97c35fe1a8fe Mon Sep 17 00:00:00 2001 From: Jeff Parsons Date: Tue, 25 Jul 2017 13:44:48 -0700 Subject: [PATCH] Changed scripts to machineScripts (for clarity) --- _includes/machine-command.html | 6 +- _includes/machine-engines.html | 66 ++++++++----------- .../1170/panel/debugger/xxdp/README.md | 2 +- disks/dec/rl02k/xxdp/ekbad0/README.md | 2 +- disks/pcx86/apps/ibm/topview/1.01/README.md | 2 +- modules/markout/lib/markout.js | 2 +- 6 files changed, 34 insertions(+), 46 deletions(-) diff --git a/_includes/machine-command.html b/_includes/machine-command.html index c56154015..d82ce4892 100644 --- a/_includes/machine-command.html +++ b/_includes/machine-command.html @@ -8,9 +8,9 @@ using a Liquid-style include that looks like this: and which should generate something like this: - + -Alternatively, if the command parameter is the name of a command string in the page's Front Matter, then this: +Alternatively, if the command parameter is the name of a machine script in the page's Front Matter, then this: {% include machine-command.html type='button' label='Try It!' machine='vt100' component='Keyboard' command='scriptName' %} @@ -19,4 +19,4 @@ should generate something like this: {% endcomment %} -{% if page.commands[include.command] != nil %}{% assign machine_command = "script" %}{% capture command_value %}{{ page.commands[include.command] | replace:'"','"' | strip }}{% endcapture %}{% else %}{% capture machine_command %}{{ include.command }}{% endcapture %}{% capture command_value %}{{ include.value | replace:'"','"' }}{% endcapture %}{% endif %}{% if include.type == "clickOnce" %}{% assign control_type = "button" %}{% assign control_single = "true" %}{% elsif include.type == "button" %}{% assign control_type = "button" %}{% assign control_single = "false" %}{% else %}{% assign control_type = "unknown" %}{% assign control_single = "false" %}{% endif %}{% if control_type == "button" %}{% else %}{% endif %} +{% if page.machineScripts[include.command] != nil %}{% assign machine_command = "script" %}{% capture command_value %}{{ page.machineScripts[include.command] | replace:'"','"' | strip }}{% endcapture %}{% else %}{% capture machine_command %}{{ include.command }}{% endcapture %}{% capture command_value %}{{ include.value | replace:'"','"' }}{% endcapture %}{% endif %}{% if include.type == "clickOnce" %}{% assign control_type = "button" %}{% assign control_single = "true" %}{% elsif include.type == "button" %}{% assign control_type = "button" %}{% assign control_single = "false" %}{% else %}{% assign control_type = "unknown" %}{% assign control_single = "false" %}{% endif %}{% if control_type == "button" %}{% else %}{% endif %} diff --git a/_includes/machine-engines.html b/_includes/machine-engines.html index 1e06cc8ea..d7481a156 100644 --- a/_includes/machine-engines.html +++ b/_includes/machine-engines.html @@ -22,6 +22,7 @@ The following optional machine properties will be added to the 'parms' property: 'autoMount' (eg: {"A":{"name":"OS/2 FOOTBALL (v7.68.17)","path":"/disks/pc/os2/misc/football/FOOTBALL-76817.json"}}) 'autoPower' (eg: true) + 'autoScript' (eg, type Keyboard "$date\r$time\r") 'autoStart' (eg: true) 'autoType' (eg: $date\r$time\r) 'drives' (eg: '[{name:"68Mb Hard Disk",type:4,path:"http://archive.pcjs.org/disks/pc/fixed/68mb/win95.json"}]') @@ -31,10 +32,6 @@ The following optional machine properties will be added to the 'parms' property: 'messages' (eg: fault) 'connection' (eg: serialPort->vt100a.serialPort) -Finally, all our JavaScript components expect multi-word property names to use camelCase, so we automatically convert -any lower-case forms to camelCase, both here and in markout.js and components.xsl, in case we've gotten sloppy in any -of our Markdown or XML documents. Examples: 'automount' becomes 'autoMount', 'autopower' becomes 'autoPower', etc. - {% endcomment %} {% for machine in page.machines %} {% capture machine_type %}{{ machine.type | remove:"-dbg" }}{% endcapture %} @@ -62,36 +59,27 @@ of our Markdown or XML documents. Examples: 'automount' becomes 'autoMount', 'a {% endif %} {% endif %} {% capture machine_embed %}embed{{ machine_type | upcase | replace:"X86","x86" }}{% endcapture %} - {% if machine.automount != nil %} - {% if machine.automount == "" %} - {% assign machine_autoMount = "{}" %} - {% else %} - {% capture machine_autoMount %}{{ machine.automount|jsonify }}{% endcapture %} - {% endif %} + {% if machine.autoMount == "" %} + {% assign machine_autoMount = "{}" %} {% else %} - {% if machine.autoMount == "" %} - {% assign machine_autoMount = "{}" %} - {% else %} - {% capture machine_autoMount %}{{ machine.autoMount|jsonify }}{% endcapture %} - {% endif %} + {% capture machine_autoMount %}{{ machine.autoMount|jsonify }}{% endcapture %} {% endif %} - {% if machine.autopower != nil %} - {% capture machine_autoPower %},autoPower:{{ machine.autopower }}{% endcapture %} - {% elsif machine.autoPower != nil %} + {% if machine.autoPower != nil %} {% capture machine_autoPower %},autoPower:{{ machine.autoPower }}{% endcapture %} {% else %} {% assign machine_autoPower = "" %} {% endif %} - {% if machine.autostart != nil %} - {% capture machine_autoStart %},autoStart:{{ machine.autostart }}{% endcapture %} - {% elsif machine.autoStart != nil %} + {% if machine.autoScript != nil %} + {% capture machine_autoScript %},autoScript:"{{ page.machineScripts[machine.autoScript] | strip_newlines | replace:'"':"\\\\"" | replace:"\r":"\\\\r" | replace:"\n":"\\\\n" | replace:"\t":"\\\\t" | replace:"\x":"\\\\x" }}"{% endcapture %} + {% else %} + {% assign machine_autoScript = "" %} + {% endif %} + {% if machine.autoStart != nil %} {% capture machine_autoStart %},autoStart:{{ machine.autoStart }}{% endcapture %} {% else %} {% assign machine_autoStart = "" %} {% endif %} - {% if machine.autotype != nil %} - {% capture machine_autoType %},autoType:"{{ machine.autotype | replace:"\r":"\\\\r" | replace:"\n":"\\\\n" | replace:"\t":"\\\\t" | replace:"\x":"\\\\x" }}"{% endcapture %} - {% elsif machine.autoType != nil %} + {% if machine.autoType != nil %} {% capture machine_autoType %},autoType:"{{ machine.autoType | replace:"\r":"\\\\r" | replace:"\n":"\\\\n" | replace:"\t":"\\\\t" | replace:"\x":"\\\\x" }}"{% endcapture %} {% else %} {% assign machine_autoType = "" %} @@ -110,25 +98,25 @@ of our Markdown or XML documents. Examples: 'automount' becomes 'autoMount', 'a {% else %} {% assign machine_template = machine.template %} {% endunless %} - {% capture machine_parms %}{{ site.left_brace }}autoMount:{{ machine_autoMount }}{{ machine_autoPower }}{{ machine_autoStart }}{{ machine_autoType }}{{ machine_drives }},resume:"{{ machine.resume }}",state:"{{ machine.state }}",commands:"{{ machine.commands }}",messages:"{{ machine.messages }}",connection:"{{ machine.connection }}"{{ site.right_brace }}{% endcapture %} + {% capture machine_parms %}{{ site.left_brace }}autoMount:{{ machine_autoMount }}{{ machine_autoPower }}{{ machine_autoScript }}{{ machine_autoStart }}{{ machine_autoType }}{{ machine_drives }},resume:"{{ machine.resume }}",state:"{{ machine.state }}",commands:"{{ machine.commands }}",messages:"{{ machine.messages }}",connection:"{{ machine.connection }}"{{ site.right_brace }}{% endcapture %} {% if site.pcjs.compiled == true and machine.uncompiled != true %} - {% capture machine_script %} + {% capture page_script %} {% endcapture %} - {% unless machine_scripts contains machine_script %} - {{ machine_script }} + {% unless page_scripts contains page_script %} + {{ page_script }} {% endunless %} - {% capture machine_scripts %}{{ machine_scripts }}{{ machine_script }}{% endcapture %} + {% capture page_scripts %}{{ page_scripts }}{{ page_script }}{% endcapture %} {% if machine_template == "" %} {% capture machine_template %}{{ site.baseurl }}/versions/{{ machine_app }}/{{ site.pcjs.version }}/components.xsl{% endcapture %} {% endif %} {% else %} {% capture machine_file_uncompiled %}{{ machine_file | remove:"-dbg" | append:"-uncompiled" }}{% endcapture %} - {% capture machine_script %} + {% capture page_script %} {% endcapture %} - {% unless machine_scripts contains machine_script %} - {{ machine_script }} + {% unless page_scripts contains page_script %} + {{ page_script }} {% endunless %} - {% capture machine_scripts %}{{ machine_scripts }}{{ machine_script }}{% endcapture %} + {% capture page_scripts %}{{ page_scripts }}{{ page_script }}{% endcapture %} {% if machine_template == "" %} {% capture machine_template %}{{ site.baseurl }}/versions/{{ machine_app }}/{{ site.pcjs.version }}/components.xsl{% endcapture %} {% endif %} @@ -152,21 +140,21 @@ of our Markdown or XML documents. Examples: 'automount' becomes 'autoMount', 'a {% if machine_type == "pdp11" %}{% assign array_scripts = site.pcjs.pdp11_scripts %}{% endif %} {% for script in array_scripts %} {% if script != "/modules/shared/lib/nodebug.js" or machine.debug != true and site.pcjs.debug != true %} - {% capture machine_script %}{% endcapture %} - {% unless machine_scripts contains machine_script %} - {{ machine_script }} + {% capture page_script %}{% endcapture %} + {% unless page_scripts contains page_script %} + {{ page_script }} {% if script contains "shared/lib/defines.js" %} {% if site.pcjs.private %} - {{ machine_script | replace:"defines.js","private.js" }} + {{ page_script | replace:"defines.js","private.js" }} {% endif %} {% endif %} {% if script contains "js/lib/defines.js" %} {% if machine_debugger != true %} - {{ machine_script | replace:"defines.js","nodebugger.js" }} + {{ page_script | replace:"defines.js","nodebugger.js" }} {% endif %} {% endif %} {% endunless %} - {% capture machine_scripts %}{{ machine_scripts }}{{ machine_script }}{% endcapture %} + {% capture page_scripts %}{{ page_scripts }}{{ page_script }}{% endcapture %} {% endif %} {% endfor %} {% if machine_template == "" %} diff --git a/devices/pdp11/machine/1170/panel/debugger/xxdp/README.md b/devices/pdp11/machine/1170/panel/debugger/xxdp/README.md index 52f81bbea..a69e470a5 100644 --- a/devices/pdp11/machine/1170/panel/debugger/xxdp/README.md +++ b/devices/pdp11/machine/1170/panel/debugger/xxdp/README.md @@ -12,7 +12,7 @@ machines: RL0: path: http://archive.pcjs.org/disks/dec/rl02k/RL02K-XXDP.json sticky: top -scripts: +machineScripts: runEKBAD0: | selectDrive RL11 RL0; select RL11 listDisks "XXDP+ Diagnostics"; diff --git a/disks/dec/rl02k/xxdp/ekbad0/README.md b/disks/dec/rl02k/xxdp/ekbad0/README.md index 660562f2a..57d065f77 100644 --- a/disks/dec/rl02k/xxdp/ekbad0/README.md +++ b/disks/dec/rl02k/xxdp/ekbad0/README.md @@ -9,7 +9,7 @@ machines: debugger: true autoStart: true sticky: top -scripts: +machineScripts: runEKBAD0: | selectDrive RL11 RL0; select RL11 listDisks "XXDP+ Diagnostics"; diff --git a/disks/pcx86/apps/ibm/topview/1.01/README.md b/disks/pcx86/apps/ibm/topview/1.01/README.md index 36677b7a7..f69ce9b39 100644 --- a/disks/pcx86/apps/ibm/topview/1.01/README.md +++ b/disks/pcx86/apps/ibm/topview/1.01/README.md @@ -12,7 +12,7 @@ machines: B: path: /disks/pcx86/apps/ibm/topview/1.01/TOPVIEW101-PROGRAM.json autoScript: startTV -scripts: +machineScripts: startTV: | wait Keyboard DOS; type Keyboard "$date\r$time\r"; diff --git a/modules/markout/lib/markout.js b/modules/markout/lib/markout.js index d8f55b2e1..cb1ab890f 100644 --- a/modules/markout/lib/markout.js +++ b/modules/markout/lib/markout.js @@ -442,7 +442,7 @@ MarkOut.prototype.convertMD = function(sIndent) /* * Extract script definitions first, if any, from the Front Matter. */ - var aScriptDefs = aMatch[1].match(/\nscripts:([\s\S]*?)\n([^\s]|$)/); + var aScriptDefs = aMatch[1].match(/\nmachineScripts:([\s\S]*?)\n([^\s]|$)/); if (aScriptDefs) { var reScript = /[ \t]+([a-z0-9$@_-]+):\s*\|/gi; var aScripts = aScriptDefs[1].split(reScript);