Bugzilla – Attachment 42739 Details for
Bug 14217
Add a DOM syntax for specifying conditions on indexes
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14217: (QA followup) avoid repeating code
Bug-14217-QA-followup-avoid-repeating-code.patch (text/plain), 7.20 KB, created by
Tomás Cohen Arazi (tcohen)
on 2015-09-21 16:04:17 UTC
(
hide
)
Description:
Bug 14217: (QA followup) avoid repeating code
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2015-09-21 16:04:17 UTC
Size:
7.20 KB
patch
obsolete
>From 3ff4384fc74a87c27f43cd5a9d41d3101ec1bcd4 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 21 Sep 2015 12:46:02 -0300 >Subject: [PATCH] Bug 14217: (QA followup) avoid repeating code > >This patch refactors the handle-one-index-subfields template to >call a new template handle-one-index-subfields-helper instead >of repeating the code for subfields indexing (index-subfields) >which gets wrapped inside the new condition test if needed. > >This avoids code duplication, with the same results. > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > etc/zebradb/xsl/koha-indexdefs-to-zebra.xsl | 107 +++++++++++----------------- > 1 file changed, 40 insertions(+), 67 deletions(-) > >diff --git a/etc/zebradb/xsl/koha-indexdefs-to-zebra.xsl b/etc/zebradb/xsl/koha-indexdefs-to-zebra.xsl >index 9573d85..9718e26 100644 >--- a/etc/zebradb/xsl/koha-indexdefs-to-zebra.xsl >+++ b/etc/zebradb/xsl/koha-indexdefs-to-zebra.xsl >@@ -250,7 +250,19 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml) > <xsl:text>']</xsl:text> > </xsl:attribute> > <xsl:for-each select="key('index_subfields_tag', @tag)"> >- <xsl:call-template name="handle-one-index-subfields"/> >+ <xsl:choose> >+ <xsl:when test="@condition"> >+ <xslo:if> >+ <xsl:attribute name="test"> >+ <xsl:value-of select="@condition"/> >+ </xsl:attribute> >+ <xsl:call-template name="handle-one-index-subfields" /> >+ </xslo:if> >+ </xsl:when> >+ <xsl:otherwise> >+ <xsl:call-template name="handle-one-index-subfields" /> >+ </xsl:otherwise> >+ </xsl:choose> > </xsl:for-each> > </xslo:template> > </xsl:for-each> >@@ -263,73 +275,34 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml) > <xsl:call-template name="get-target-indexes"/> > </xsl:variable> > >- <xsl:choose> >- <xsl:when test="@condition"> >- <xslo:if> >- <xsl:attribute name="test"> >- <xsl:value-of select="@condition"/> >- </xsl:attribute> >- <xslo:for-each select="marc:subfield"> >- <xslo:if> >- <xsl:attribute name="test"> >- <xsl:text>contains('</xsl:text> >- <xsl:value-of select="@subfields"/> >- <xsl:text>', @code)</xsl:text> >- </xsl:attribute> >- <z:index> >- <xsl:attribute name="name"><xsl:value-of select="normalize-space($indexes)"/></xsl:attribute> >- <xslo:value-of> >- <xsl:attribute name="select"> >- <xsl:choose> >- <xsl:when test="@length"> >- <xsl:text>substring(., </xsl:text> >- <xsl:value-of select="$offset + 1" /> >- <xsl:text>, </xsl:text> >- <xsl:value-of select="$length"/> >- <xsl:text>)</xsl:text> >- </xsl:when> >- <xsl:otherwise> >- <xsl:text>.</xsl:text> >- </xsl:otherwise> >- </xsl:choose> >- </xsl:attribute> >- </xslo:value-of> >- </z:index> >- </xslo:if> >- </xslo:for-each> >- </xslo:if> >- </xsl:when> >- <xsl:otherwise> >- <xslo:for-each select="marc:subfield"> >- <xslo:if> >- <xsl:attribute name="test"> >- <xsl:text>contains('</xsl:text> >- <xsl:value-of select="@subfields"/> >- <xsl:text>', @code)</xsl:text> >+ <xslo:for-each select="marc:subfield"> >+ <xslo:if> >+ <xsl:attribute name="test"> >+ <xsl:text>contains('</xsl:text> >+ <xsl:value-of select="@subfields"/> >+ <xsl:text>', @code)</xsl:text> >+ </xsl:attribute> >+ <z:index> >+ <xsl:attribute name="name"><xsl:value-of select="normalize-space($indexes)"/></xsl:attribute> >+ <xslo:value-of> >+ <xsl:attribute name="select"> >+ <xsl:choose> >+ <xsl:when test="@length"> >+ <xsl:text>substring(., </xsl:text> >+ <xsl:value-of select="$offset + 1" /> >+ <xsl:text>, </xsl:text> >+ <xsl:value-of select="$length"/> >+ <xsl:text>)</xsl:text> >+ </xsl:when> >+ <xsl:otherwise> >+ <xsl:text>.</xsl:text> >+ </xsl:otherwise> >+ </xsl:choose> > </xsl:attribute> >- <z:index> >- <xsl:attribute name="name"><xsl:value-of select="normalize-space($indexes)"/></xsl:attribute> >- <xslo:value-of> >- <xsl:attribute name="select"> >- <xsl:choose> >- <xsl:when test="@length"> >- <xsl:text>substring(., </xsl:text> >- <xsl:value-of select="$offset + 1" /> >- <xsl:text>, </xsl:text> >- <xsl:value-of select="$length"/> >- <xsl:text>)</xsl:text> >- </xsl:when> >- <xsl:otherwise> >- <xsl:text>.</xsl:text> >- </xsl:otherwise> >- </xsl:choose> >- </xsl:attribute> >- </xslo:value-of> >- </z:index> >- </xslo:if> >- </xslo:for-each> >- </xsl:otherwise> >- </xsl:choose> >+ </xslo:value-of> >+ </z:index> >+ </xslo:if> >+ </xslo:for-each> > </xsl:template> > > <xsl:template name="handle-index-facets"> >-- >2.5.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 14217
:
40841
|
40842
|
42045
|
42737
|
42739
|
42740
|
42741