Changed scripts to machineScripts (for clarity)

This commit is contained in:
Jeff Parsons 2017-07-25 13:44:48 -07:00 committed by Jeff Parsons
commit 9c0a4f4fe1
6 changed files with 34 additions and 46 deletions

View file

@ -8,9 +8,9 @@ using a Liquid-style include that looks like this:
and which should generate something like this:
<button type="button" onclick="commandMachine(this, false, 'vt100','Keyboard','sendString','Hello World')">Try It!</button>
<button type="button" onclick="commandMachine(this, false, 'vt100','Keyboard','sendString','Hello World')">Try It!</button>
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:
<button type="button" onclick="commandMachine(this, false, 'vt100','Keyboard','script','...')">Try It!</button>
{% endcomment %}
{% if page.commands[include.command] != nil %}{% assign machine_command = "script" %}{% capture command_value %}{{ page.commands[include.command] | replace:'"','&quot;' | strip }}{% endcapture %}{% else %}{% capture machine_command %}{{ include.command }}{% endcapture %}{% capture command_value %}{{ include.value | replace:'"','&quot;' }}{% 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" %}<button type="button" onclick="commandMachine(this,{{ control_single }},'{{ include.machine }}','{{ include.component }}','{{ machine_command }}','{{ command_value }}')">{{ include.label }}</button>{% else %}<!-- Unrecognized machine control type: {{ include.type }} -->{% endif %}
{% if page.machineScripts[include.command] != nil %}{% assign machine_command = "script" %}{% capture command_value %}{{ page.machineScripts[include.command] | replace:'"','&quot;' | strip }}{% endcapture %}{% else %}{% capture machine_command %}{{ include.command }}{% endcapture %}{% capture command_value %}{{ include.value | replace:'"','&quot;' }}{% 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" %}<button type="button" onclick="commandMachine(this,{{ control_single }},'{{ include.machine }}','{{ include.component }}','{{ machine_command }}','{{ command_value }}')">{{ include.label }}</button>{% else %}<!-- Unrecognized machine control type: {{ include.type }} -->{% endif %}