Add support for artistic value and reading components

This commit is contained in:
Peder Bergebakken Sundt 2019-10-20 01:48:37 +02:00
parent c1701f2a10
commit d780841039
4 changed files with 63 additions and 0 deletions

View File

@ -190,3 +190,12 @@
{% endif %} {% endif %}
</div> </div>
</div> </div>
{#
{% for item in xml.components %}
{{item["@x"]}},
{{item["@y"]}},
{{item["@db_entry"]}}<br>
{% endfor %}
#}

View File

@ -13,6 +13,16 @@ for (var i=0; i < xml_data_items.length; i++) {
context.xml[key] = val; context.xml[key] = val;
} }
var xml_component_items = document.getElementsByClassName("xml_component")
context.xml["components"] = [];
for (var i=0; i < xml_component_items.length/3; i++) {
context.xml["components"].push({
'@x' : document.getElementById("xml_component_" + (i+1) + "_x").innerHTML,
'@y' : document.getElementById("xml_component_" + (i+1) + "_y").innerHTML,
'@db_entry': document.getElementById("xml_component_" + (i+1) + "_db_entry").innerHTML,
});
}
var env = new nunjucks.Environment([], { var env = new nunjucks.Environment([], {
autoescape: true, autoescape: true,
trimBlocks: true, trimBlocks: true,

View File

@ -47,11 +47,42 @@
"symbol", "symbol",
"difficulty", "difficulty",
"duration", "duration",
"artistic_value",
"playcost"] %} "playcost"] %}
{{lt}}script type="text/html" class="xml_data" id="xml_data_{{ value }}"{{gt}}<xsl:value-of select="{{ value }}"/>{{lt}}/script{{gt}} {{lt}}script type="text/html" class="xml_data" id="xml_data_{{ value }}"{{gt}}<xsl:value-of select="{{ value }}"/>{{lt}}/script{{gt}}
{{ newline }} {{ newline }}
{% endfor %} {% endfor %}
{{ newline }}
<xsl:for-each select="component">
{{lt}}script type="text/html" class="xml_component" id="xml_component{#
#}_<xsl:value-of select="position()"/>_{#
#}x"{{gt}}
<xsl:value-of select="@x"/>
{{lt}}/script{{gt}}
{{ newline }}
{{lt}}script type="text/html" class="xml_component" id="xml_component{#
#}_<xsl:value-of select="position()"/>_{#
#}y"{{gt}}
<xsl:value-of select="@y"/>
{{lt}}/script{{gt}}
{{ newline }}
{{lt}}script type="text/html" class="xml_component" id="xml_component{#
#}_<xsl:value-of select="position()"/>_{#
#}db_entry"{{gt}}
<xsl:value-of select="@db_entry"/>
{{lt}}/script{{gt}}
{{ newline }}
</xsl:for-each>
{{ newline*2 }} {{ newline*2 }}
<script type="text/javascript"> <script type="text/javascript">

View File

@ -13,3 +13,16 @@ Roll MAG hit dice. Deal that amount of FIRE damage to the target.</description>
Not Silenced, Not Silenced,
3 MP, 3 MP,
Equipment has Catalyst property</playcost> Equipment has Catalyst property</playcost>
<artistic_value>-1</artistic_value>
<component x="7" y="1" db_entry="🧩 Set Ability Name"/>
<component x="9" y="1" db_entry="🧩 Set Image"/>
<component x="11" y="1" db_entry="🧩 Play Cost"/>
<component x="11" y="5" db_entry="🧩 CP Cost"/>
<component x="12" y="4" db_entry="🧩 Duration"/>
<component x="11" y="3" db_entry="🧩 Power"/>
<component x="11" y="4" db_entry="🧩 Difficulty"/>
<component x="12" y="3" db_entry="🧩 Symbols"/>
<component x="12" y="5" db_entry="🧩 Range"/>
<component x="8" y="2" db_entry="🧩 Set Description"/>
<component x="3" y="3" db_entry="🎺 Repertoire Card: Filler"/>