Skip to content

Commit 24ba09b

Browse files
committed
show を YAML に近づける
1 parent 1d8ae06 commit 24ba09b

File tree

2 files changed

+25
-10
lines changed

2 files changed

+25
-10
lines changed

opensearch

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
## id - 6343b25a-bc74-43b4-8e61-e38b9d95523c
1010
## author - <qq542vev at https://purl.org/meta/me/>
1111
## version - 0.1.0
12-
## date - 2022-11-12
12+
## date - 2022-11-29
1313
## since - 2020-04-20
1414
## copyright - Copyright (C) 2020-2022 qq542vev. Some rights reserved.
1515
## license - <CC-BY at https://creativecommons.org/licenses/by/4.0/>
@@ -1856,14 +1856,21 @@ opensearch_file_show() {
18561856

18571857
<xsl:template match="os:Language | os:InputEncoding | os:OutputEncoding">
18581858
<xsl:if test="position() = 1">
1859-
<xsl:text> </xsl:text>
1859+
<xsl:text> [ </xsl:text>
18601860
</xsl:if>
18611861

1862-
<xsl:value-of select="normalize-space()"/>
1862+
<xsl:choose>
1863+
<xsl:when test="normalize-space() = '*'">
1864+
<xsl:value-of select="concat(&quot;'&quot;, normalize-space(), &quot;'&quot;)"/>
1865+
</xsl:when>
1866+
<xsl:otherwise>
1867+
<xsl:value-of select="normalize-space()"/>
1868+
</xsl:otherwise>
1869+
</xsl:choose>
18631870

18641871
<xsl:choose>
18651872
<xsl:when test="position() = last()">
1866-
<xsl:text>&#xA;</xsl:text>
1873+
<xsl:text> ]&#xA;</xsl:text>
18671874
</xsl:when>
18681875
<xsl:otherwise>, </xsl:otherwise>
18691876
</xsl:choose>
@@ -2563,7 +2570,7 @@ GETOPTIONSHERE
25632570
opensearch_file_check --err --quiet "${xmlFile}" || skip_error "${skipFlag}" 'status' "${EX_DATAERR}"
25642571

25652572
if [ '2' -le "${xmlFileCount}" ]; then
2566-
printf '=== %s ===\n' "${xmlFile}"
2573+
printf -- '--- # %s\n' "${xmlFile}"
25672574
fi
25682575

25692576
eval "set -- ${elements-}"

opensearch-show.xsl

100644100755
Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
id - ff68a9ee-63b4-4d79-925a-237542d63289
99
author - <qq542vev at https://purl.org/meta/me/>
1010
version - 0.1.0
11-
date - 2022-11-13
11+
date - 2022-11-28
1212
since - 2022-11-13
1313
copyright - Copyright (C) 2022-2022 qq542vev. Some rights reserved.
1414
license - <CC-BY at https://creativecommons.org/licenses/by/4.0/>
@@ -19,6 +19,7 @@
1919
* <Project homepage at https://github.com/qq542vev/shell-opensearch>
2020
* <Bag report at https://github.com/qq542vev/shell-opensearch/issues>
2121
-->
22+
<?xml version="1.0" encoding="UTF-8"?>
2223
<xsl:stylesheet
2324
version="1.0"
2425
xmlns:os="http://a9.com/-/spec/opensearch/1.1/"
@@ -121,14 +122,21 @@
121122

122123
<xsl:template match="os:Language | os:InputEncoding | os:OutputEncoding">
123124
<xsl:if test="position() = 1">
124-
<xsl:text> </xsl:text>
125+
<xsl:text> [ </xsl:text>
125126
</xsl:if>
126127

127-
<xsl:value-of select="normalize-space()"/>
128+
<xsl:choose>
129+
<xsl:when test="normalize-space() = '*'">
130+
<xsl:value-of select="concat(&quot;'&quot;, normalize-space(), &quot;'&quot;)"/>
131+
</xsl:when>
132+
<xsl:otherwise>
133+
<xsl:value-of select="normalize-space()"/>
134+
</xsl:otherwise>
135+
</xsl:choose>
128136

129137
<xsl:choose>
130138
<xsl:when test="position() = last()">
131-
<xsl:text>&#xA;</xsl:text>
139+
<xsl:text> ]&#xA;</xsl:text>
132140
</xsl:when>
133141
<xsl:otherwise>, </xsl:otherwise>
134142
</xsl:choose>
@@ -153,4 +161,4 @@
153161
<xsl:apply-templates select="$current[local-name() = current()]"/>
154162
</xsl:if>
155163
</xsl:template>
156-
</xsl:stylesheet>
164+
</xsl:stylesheet>

0 commit comments

Comments
 (0)