Skip to content

Commit

Permalink
Fix missing newlines, redux
Browse files Browse the repository at this point in the history
  • Loading branch information
gucci-on-fleek committed Sep 7, 2024
1 parent 375d354 commit a1444a8
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 23 deletions.
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
test-*
node_modules/**
dist/
node_modules/
package-lock.json
testing/**
test-*
testing/
41 changes: 21 additions & 20 deletions src/items-to-tsv.xslt
Original file line number Diff line number Diff line change
Expand Up @@ -7,48 +7,49 @@
-->
<xsl:output method="text" encoding="utf-8" />

<xsl:variable name="col_sep" select="'&#x9;'" />
<xsl:variable name="quote" select="''" />
<xsl:variable name="_col_sep">x<![CDATA[ ]]></xsl:variable>
<xsl:variable name="col_sep" select="substring($_col_sep, 2)" />
<xsl:variable name="_row_sep">x<![CDATA[
]]></xsl:variable>
<xsl:variable name="row_sep" select="substring($_row_sep, 2)" />

<xsl:template match="/items">
<xsl:value-of select="concat($quote, 'Item Name', $quote, $col_sep)" />
<xsl:value-of select="concat($quote, 'Quality', $quote, $col_sep)" />
<xsl:value-of select="concat($quote, 'Price', $quote, $col_sep)" />
<xsl:value-of select="concat($quote, 'Count', $quote, $col_sep)" />
<xsl:value-of select="concat($quote, 'Stored in', $quote, $col_sep)" />
<xsl:value-of select="concat($quote, 'Stack Price', $quote)" />
<xsl:text>&#xD;&#xA;</xsl:text>
<xsl:value-of select="concat('Item Name', $col_sep)" />
<xsl:value-of select="concat('Quality', $col_sep)" />
<xsl:value-of select="concat('Price', $col_sep)" />
<xsl:value-of select="concat('Count', $col_sep)" />
<xsl:value-of select="concat('Stored in', $col_sep)" />
<xsl:value-of select="concat('Stack Price', $row_sep)" />

<xsl:for-each select="item">
<xsl:sort select="actual_price * count" data-type="number" order="descending" />
<xsl:value-of select="concat($quote, normalize-space(name), $quote, $col_sep)" />
<xsl:value-of select="concat(normalize-space(name), $col_sep)" />
<xsl:choose>
<xsl:when test="quality">
<xsl:value-of select="concat($quote, quality, $quote, $col_sep)" />
<xsl:value-of select="concat(quality, $col_sep)" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat($quote, $quote, $col_sep)" />
<xsl:value-of select="$col_sep" />
</xsl:otherwise>
</xsl:choose>
<xsl:value-of select="concat($quote, normalize-space(actual_price), $quote, $col_sep)" />
<xsl:value-of select="concat($quote, normalize-space(count), $quote, $col_sep)" />
<xsl:value-of select="concat(normalize-space(actual_price), $col_sep)" />
<xsl:value-of select="concat(normalize-space(count), $col_sep)" />
<xsl:choose>
<xsl:when test="contained_in/type = 'Player'">
<xsl:value-of select="concat($quote, 'Player (', normalize-space(contained_in/description), ')', $quote, $col_sep)" />
<xsl:value-of select="concat('Player (', normalize-space(contained_in/description), ')', $col_sep)" />
</xsl:when>
<xsl:when test="contained_in/description">
<xsl:value-of select="concat($quote, normalize-space(contained_in/description), ' ', normalize-space(contained_in/type), ' (', normalize-space(contained_in/location), ')', $quote, $col_sep)" />
<xsl:value-of select="concat(normalize-space(contained_in/description), ' ', normalize-space(contained_in/type), ' (', normalize-space(contained_in/location), ')', $col_sep)" />
</xsl:when>
<xsl:when test="contained_in/type = contained_in/location">
<!--Junimo Hut-->
<xsl:value-of select="concat($quote, normalize-space(contained_in/type), $quote, $col_sep)" />
<xsl:value-of select="concat(normalize-space(contained_in/type), $col_sep)" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat($quote, normalize-space(contained_in/type), ' (', normalize-space(contained_in/location), ')', $quote, $col_sep)" />
<xsl:value-of select="concat(normalize-space(contained_in/type), ' (', normalize-space(contained_in/location), ')', $col_sep)" />
</xsl:otherwise>
</xsl:choose>
<xsl:value-of select="concat($quote, actual_price * count, $quote)" />
<xsl:text>&#xD;&#xA;</xsl:text>
<xsl:value-of select="concat(actual_price * count, $row_sep)" />
</xsl:for-each>
</xsl:template>

Expand Down

0 comments on commit a1444a8

Please sign in to comment.