mirror of https://github.com/FreeCol/freecol.git
Update GenerateDocumentation for the newer resource naming convention.
This commit is contained in:
parent
9439bfc85d
commit
e998755ca0
|
@ -81,7 +81,8 @@
|
|||
<xsl:choose>
|
||||
<xsl:when test="@made-from">
|
||||
<xsl:variable name="id" select="@made-from"/>
|
||||
<xsl:variable name="src" select="freecol:getResource(concat(@made-from, '.image'))"/>
|
||||
<xsl:variable name="src"
|
||||
select="freecol:getResource(@made-from)"/>
|
||||
<img src="../data/rules/classic/{$src}"/><br />
|
||||
<a href="#{$id}">
|
||||
<xsl:value-of select="freecol:localize(concat(@made-from, '.name'))"/>
|
||||
|
@ -213,12 +214,6 @@
|
|||
<tr>
|
||||
<xsl:call-template name="name">
|
||||
<xsl:with-param name="id"><xsl:value-of select="@id"/></xsl:with-param>
|
||||
<xsl:with-param name="key">
|
||||
<xsl:choose>
|
||||
<xsl:when test="@is-forest='true'">.forest</xsl:when>
|
||||
<xsl:otherwise>.center0.image</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:with-param>
|
||||
</xsl:call-template>
|
||||
<td>
|
||||
<xsl:value-of select="@basic-move-cost"/>
|
||||
|
@ -498,7 +493,7 @@
|
|||
|
||||
<xsl:template match="settlement">
|
||||
<div class="center">
|
||||
<xsl:variable name="src" select="freecol:getResource(concat(@id, '.image'))"/>
|
||||
<xsl:variable name="src" select="freecol:getResource(@id)"/>
|
||||
<img src="../data/rules/classic/{$src}"/>
|
||||
</div>
|
||||
<ul>
|
||||
|
@ -733,8 +728,7 @@
|
|||
</xsl:template>
|
||||
<xsl:template name="name">
|
||||
<xsl:param name="id"></xsl:param>
|
||||
<xsl:param name="key">.image</xsl:param>
|
||||
<xsl:variable name="src" select="freecol:getResource(concat($id, $key))"/>
|
||||
<xsl:variable name="src" select="freecol:getResource($id)"/>
|
||||
<td class="name">
|
||||
<a id="{$id}">
|
||||
<img src="../data/rules/classic/{$src}"/><br />
|
||||
|
|
|
@ -131,7 +131,8 @@ public class GenerateDocumentation {
|
|||
if (index >= 0) {
|
||||
String key = line.substring(0, index).trim();
|
||||
String value = line.substring(index + 1).trim()
|
||||
.replace("<", "<").replace(">", ">").replace("&", "&");
|
||||
.replace("<", "<").replace(">", ">")
|
||||
.replace("&", "&");
|
||||
Map<String, String> map = translations.get(key);
|
||||
if (map == null) {
|
||||
map = new HashMap<>();
|
||||
|
@ -217,7 +218,23 @@ public class GenerateDocumentation {
|
|||
}
|
||||
|
||||
public static String getResource(String key) {
|
||||
return resources.get(key);
|
||||
final String[] options = {
|
||||
null,null,/*placeholders*/ "icon", "flavor", "tileitem" };
|
||||
String ourKey = key;
|
||||
final String[] splitKey = key.split("\\.");
|
||||
String found = resources.get(ourKey);
|
||||
if (found == null && splitKey.length > 2
|
||||
&& splitKey[0].equals("model")) {
|
||||
String suffix = (splitKey[1].equals("tile")) ? ".center.r0" : "";
|
||||
options[0] = splitKey[1];
|
||||
options[1] = splitKey[1] + "icon";
|
||||
for (String x : options) {
|
||||
ourKey = "image." + x + "." + key + suffix;
|
||||
found = resources.get(ourKey);
|
||||
if (found != null) break;
|
||||
}
|
||||
}
|
||||
return found;
|
||||
}
|
||||
|
||||
public static String localize(String template) {
|
||||
|
|
Loading…
Reference in New Issue