From a72530073a95a60cd382fe8bec2155fb34c08866 Mon Sep 17 00:00:00 2001
From: bricebou <bricebou@momh.fr>
Date: Thu, 28 Nov 2024 14:53:35 +0100
Subject: [PATCH] =?UTF-8?q?fix:=20bien=20ins=C3=A9rer=20<quote>=20ou=20</q?=
 =?UTF-8?q?uote>=20lorsque=20la=20citation=20est=20en=20d=C3=A9but=20ou=20?=
 =?UTF-8?q?en=20fin=20respectivement=20du=20fichier=20odt?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Refs: #4679
---
 inc/odt2spip.xsl | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/inc/odt2spip.xsl b/inc/odt2spip.xsl
index 57760ee..bd9b328 100644
--- a/inc/odt2spip.xsl
+++ b/inc/odt2spip.xsl
@@ -251,9 +251,19 @@ intertitres_riches= <xsl:value-of select="$IntertitresRiches" />
 </xsl:template>
 <xsl:template match="text:p">
 	<!-- en cas de citation, ajout de la balise <quote> -->
-	<xsl:if test="(@text:style-name='Quotations' and preceding-sibling::text:p[1][not(starts-with(@text:style-name, 'Quotations'))]) or (@text:style-name='Quote' and preceding-sibling::text:p[1][not(starts-with(@text:style-name, 'Quote'))])"><xsl:text>&lt;quote&gt;</xsl:text></xsl:if>
+	<xsl:if test="
+		((not(preceding-sibling::text:p[1]) or preceding-sibling::text:p[1][not(starts-with(@text:style-name, 'Quotations'))]) and @text:style-name='Quotations')
+		or ((not(preceding-sibling::text:p[1]) or preceding-sibling::text:p[1][not(starts-with(@text:style-name, 'Quote'))]) and @text:style-name='Quote')
+	">
+		<xsl:text>&lt;quote&gt;</xsl:text>
+	</xsl:if>
 	<xsl:apply-templates/>
-	<xsl:if test="(@text:style-name='Quotations' and following-sibling::text:p[1][not(starts-with(@text:style-name, 'Quotations'))]) or (@text:style-name='Quote' and following-sibling::text:p[1][not(starts-with(@text:style-name, 'Quote'))])"><xsl:text>&lt;/quote&gt;</xsl:text></xsl:if>
+	<xsl:if test="
+		((not(following-sibling::text:p[1]) or following-sibling::text:p[1][not(starts-with(@text:style-name, 'Quotations'))]) and @text:style-name='Quotations')
+		or ((not(following-sibling::text:p[1]) or following-sibling::text:p[1][not(starts-with(@text:style-name, 'Quote'))]) and @text:style-name='Quote')
+	">
+		<xsl:text>&lt;/quote&gt;</xsl:text>
+	</xsl:if>
 	<xsl:text >&#xA;&#xA;</xsl:text>
     <xsl:if test="count(node())=0">
 		<xsl:text>&#xA;&#xA;</xsl:text>
-- 
GitLab