Bug 19616: (follow-up) Breaking items according to punctuation
authorKatrin Fischer <katrin.fischer.83@web.de>
Sun, 13 Sep 2020 17:16:22 +0000 (17:16 +0000)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Thu, 8 Oct 2020 14:03:49 +0000 (16:03 +0200)
Previously the code assumed that $t indicates a new line in the
listing. But this is not true. The standard tells us that -- or
.-- will indicate a new item.

"In records formulated according to AACR 2, a space-hyphen-hyphen-space
( -- ) is recorded between each item in the contents note unless a
delimiter/subfield code follows in which case there is no ending space.
In pre-AACR 2 records, items are separated by a period-hyphen-hyphen (.--)."

The previous logic did no longer work with $g added. From the LOC
examples:

This would work:
505 2 0 $tBaptisms, 1816-1872 --$tChurch members, 1816-1831 --$tHistory of the Second Presbyterian Church of West Durham /$rby L. H. Fellows.
505 0 0 $tQuatrain II$g(16:35) --$tWater ways$g(1:57) --$tWaves$g(10:49).

This wouldn't:
505 1 0 $gNr. 1.$tRegion Neusiedlersee --$gNr. 2.$tRegion Rosalia/Lithagebirge --$gNr. 3.$tRegion Mettelburgenland --$gNr. 4.$tRegion südliches Burgenland --$gNr. 5.$tRegion Südburgland

With the patches applied, all examples should display nicely now.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss
koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl
koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slimUtils.xsl
koha-tmpl/opac-tmpl/bootstrap/css/src/opac.scss
koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl
koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slimUtils.xsl

index 0af3e05..70c754e 100644 (file)
@@ -2880,30 +2880,31 @@ li {
 .contents {
     width: 75%;
 
-    .r {
-        display: inline;
+    .newline::after {
+        content: "\A → ";
+        white-space: pre;
     }
 
     .t {
-        display: inline;
         font-weight: bold;
+        display: inline;
+    }
 
-        &:first-child {
-            &::before {
-                content: "→ ";
-            }
-        }
-
-        &::before {
-            content: "\A→ ";
-            white-space: pre;
-        }
+    .r {
+        display: inline;
     }
 }
 
+
 .contentblock {
+    font-size: 95%;
+    line-height: 135%;
     margin-left: 2em;
     position: relative;
+
+    :first-child::before {
+        content: "→ ";
+    }
 }
 
 #hierarchies {
index deecd43..c33ad9a 100644 (file)
                         <xsl:choose>
                         <xsl:when test="@ind2=0">
                             <xsl:call-template name="subfieldSelectSpan">
+                                <xsl:with-param name="newline">1</xsl:with-param>
                                 <xsl:with-param name="codes">trug</xsl:with-param>
                             </xsl:call-template>
                         </xsl:when>
                         <xsl:otherwise>
                             <xsl:call-template name="subfieldSelectSpan">
+                                <xsl:with-param name="newline">1</xsl:with-param>
                                 <xsl:with-param name="codes">atrug</xsl:with-param>
                             </xsl:call-template>
                         </xsl:otherwise>
index 7fb14ad..d43e6ed 100644 (file)
         <xsl:param name="subdivDelimiter"/>
         <xsl:param name="prefix"/>
         <xsl:param name="suffix"/>
+        <xsl:param name="newline"/>
             <xsl:for-each select="marc:subfield">
                 <xsl:if test="contains($codes, @code)">
                     <span>
-                        <xsl:attribute name="class"><xsl:value-of select="@code"/></xsl:attribute>
+                        <xsl:attribute name="class">
+                            <xsl:value-of select="@code"/>
+                            <xsl:if test="$newline = 1 and contains(text(), '--')">
+                                <xsl:text> newline</xsl:text>
+                            </xsl:if>
+                        </xsl:attribute>
                         <xsl:if test="contains($subdivCodes, @code)">
                             <xsl:value-of select="$subdivDelimiter"/>
                         </xsl:if>
index 96b7de8..615c9a0 100644 (file)
@@ -2215,11 +2215,7 @@ nav {
 .contents {
     width: 75%;
 
-    .t:first-child::before {
-        content: "→ ";
-    }
-
-    .t::before {
+    .newline::after {
         content: "\A → ";
         white-space: pre;
     }
@@ -2240,6 +2236,10 @@ nav {
     line-height: 135%;
     margin-left: 2em;
     position: relative;
+
+    :first-child::before {
+        content: "→ ";
+    }
 }
 
 .m880 {
index 3adcc64..063d669 100644 (file)
                         <xsl:choose>
                             <xsl:when test="@ind2=0">
                                 <xsl:call-template name="subfieldSelectSpan">
+                                    <xsl:with-param name="newline">1</xsl:with-param>
                                     <xsl:with-param name="codes">trug</xsl:with-param>
                                 </xsl:call-template>
                             </xsl:when>
                             <xsl:otherwise>
                                 <xsl:call-template name="subfieldSelectSpan">
+                                    <xsl:with-param name="newline">1</xsl:with-param>
                                     <xsl:with-param name="codes">atrug</xsl:with-param>
                                 </xsl:call-template>
                             </xsl:otherwise>
index bc8b4f7..a8be280 100644 (file)
         <xsl:param name="subdivDelimiter"/>
         <xsl:param name="prefix"/>
         <xsl:param name="suffix"/>
+        <xsl:param name="newline"/>
             <xsl:for-each select="marc:subfield">
                 <xsl:if test="contains($codes, @code)">
                     <span>
-                        <xsl:attribute name="class"><xsl:value-of select="@code"/></xsl:attribute>
+                        <xsl:attribute name="class">
+                            <xsl:value-of select="@code"/>
+                            <xsl:if test="$newline = 1 and contains(text(), '--')">
+                                <xsl:text> newline</xsl:text>
+                            </xsl:if>
+                        </xsl:attribute>
                         <xsl:if test="contains($subdivCodes, @code)">
                             <xsl:value-of select="$subdivDelimiter"/>
                         </xsl:if>