From e01fa4302aabcdf34a2147611641e0a102deb72a Mon Sep 17 00:00:00 2001 From: Vidar Langseid Date: Tue, 8 Oct 2019 13:57:05 +0200 Subject: [PATCH 1/2] Added tests --- .../richtext/input/048-link_outside_embed.xml | 10 ++++++++++ .../richtext/input/049-link_outside_embeds.xml | 11 +++++++++++ .../richtext/output/048-link_outside_embed.xml | 9 +++++++++ .../richtext/output/049-link_outside_embeds.xml | 12 ++++++++++++ 4 files changed, 42 insertions(+) create mode 100644 tests/lib/FieldType/Converter/_fixtures/richtext/input/048-link_outside_embed.xml create mode 100644 tests/lib/FieldType/Converter/_fixtures/richtext/input/049-link_outside_embeds.xml create mode 100644 tests/lib/FieldType/Converter/_fixtures/richtext/output/048-link_outside_embed.xml create mode 100644 tests/lib/FieldType/Converter/_fixtures/richtext/output/049-link_outside_embeds.xml diff --git a/tests/lib/FieldType/Converter/_fixtures/richtext/input/048-link_outside_embed.xml b/tests/lib/FieldType/Converter/_fixtures/richtext/input/048-link_outside_embed.xml new file mode 100644 index 00000000..49c73216 --- /dev/null +++ b/tests/lib/FieldType/Converter/_fixtures/richtext/input/048-link_outside_embed.xml @@ -0,0 +1,10 @@ + +
+ paragraph text and ( + + + +
diff --git a/tests/lib/FieldType/Converter/_fixtures/richtext/input/049-link_outside_embeds.xml b/tests/lib/FieldType/Converter/_fixtures/richtext/input/049-link_outside_embeds.xml new file mode 100644 index 00000000..55e6b62a --- /dev/null +++ b/tests/lib/FieldType/Converter/_fixtures/richtext/input/049-link_outside_embeds.xml @@ -0,0 +1,11 @@ + +
+ paragraph text and ( + Foo + bar + 2 + +
diff --git a/tests/lib/FieldType/Converter/_fixtures/richtext/output/048-link_outside_embed.xml b/tests/lib/FieldType/Converter/_fixtures/richtext/output/048-link_outside_embed.xml new file mode 100644 index 00000000..648c8c89 --- /dev/null +++ b/tests/lib/FieldType/Converter/_fixtures/richtext/output/048-link_outside_embed.xml @@ -0,0 +1,9 @@ + +
+ paragraph text and ( + original +
diff --git a/tests/lib/FieldType/Converter/_fixtures/richtext/output/049-link_outside_embeds.xml b/tests/lib/FieldType/Converter/_fixtures/richtext/output/049-link_outside_embeds.xml new file mode 100644 index 00000000..ed906a68 --- /dev/null +++ b/tests/lib/FieldType/Converter/_fixtures/richtext/output/049-link_outside_embeds.xml @@ -0,0 +1,12 @@ + +
+ paragraph text and ( + Foo + originalbar + original2 + +
From cd093bb00f292be28c54a7f240ea8a0238365f10 Mon Sep 17 00:00:00 2001 From: Vidar Langseid Date: Wed, 16 Oct 2019 15:07:21 +0200 Subject: [PATCH 2/2] EZP-30513: eZXMLText Migration: link tags containing embed-inline + other elements fails --- lib/FieldType/XmlText/Converter/EmbedLinking.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/FieldType/XmlText/Converter/EmbedLinking.php b/lib/FieldType/XmlText/Converter/EmbedLinking.php index 21c42f88..6c893841 100644 --- a/lib/FieldType/XmlText/Converter/EmbedLinking.php +++ b/lib/FieldType/XmlText/Converter/EmbedLinking.php @@ -31,9 +31,9 @@ class EmbedLinking implements Converter public function convert(DOMDocument $document) { $xpath = new DOMXPath($document); - // Select embeds that are linked + // Select embeds that are linked ( but only where embed is the only child of the link ) // After Expanding converter such links will contain only single embed element - $xpathExpression = '//embed[parent::link]|//embed-inline[parent::link]'; + $xpathExpression = '//embed[parent::link][count(preceding-sibling::*)+count(following-sibling::*)=0]|//embed-inline[parent::link][count(preceding-sibling::*)+count(following-sibling::*)=0]'; $linkedEmbeds = $xpath->query($xpathExpression);