Skip to content
Permalink
Browse files

EZP-29658: Changed OE format for ezembed > ezlink tag to anchor tag (#20

)

* EZP-29658: Changed OE format for ezembed > ezlink tag to anchor tag

XHTML5Edit (Online Editor) format transforms ezlink inside ezembed
into link tag which is semantically incorrect[1] and Online Editor
is unable to handle that properly.

It needs to be replaced by an anchor ("a") tag.
This change applies to Online Editor format only, keeping DocBook as-is.

[1] link tag actually belongs to meta tags per HTML5 spec.

* EZP-29658: Provided BC for link inside ezembed for XHTML5Edit format

BC applies to converting XHTML5Edit to DocBook, the other way around
is not possible
  • Loading branch information...
alongosz authored and lserwatka committed Dec 4, 2018
1 parent b8c665f commit c4aa555560ba43de489c3498b6710e18f2d6bada
@@ -551,8 +551,7 @@
</xsl:template>

<xsl:template match="docbook:ezembed/docbook:ezlink | docbook:ezembedinline/docbook:ezlink">
<xsl:element name="link" namespace="{$outputNamespace}">
<xsl:attribute name="itemprop">url</xsl:attribute>
<xsl:element name="a" namespace="{$outputNamespace}">
<xsl:attribute name="data-ezelement">ezlink</xsl:attribute>
<xsl:attribute name="href">
<xsl:value-of select="@xlink:href"/>
@@ -575,6 +574,7 @@
<xsl:value-of select="@xml:id"/>
</xsl:attribute>
</xsl:if>
<xsl:text> </xsl:text>
</xsl:element>
</xsl:template>

@@ -559,7 +559,7 @@
</xsl:if>
</xsl:template>

<xsl:template match="ezxhtml5:div[@data-ezelement='ezembed']/ezxhtml5:link[@data-ezelement='ezlink'] | ezxhtml5:span[@data-ezelement='ezembedinline']/ezxhtml5:link[@data-ezelement='ezlink']">
<xsl:template name="embeddedLink">
<xsl:element name="ezlink" namespace="http://docbook.org/ns/docbook">
<xsl:attribute name="xlink:href">
<xsl:value-of select="@href"/>
@@ -592,6 +592,15 @@
</xsl:element>
</xsl:template>

<xsl:template match="ezxhtml5:div[@data-ezelement='ezembed']/ezxhtml5:a[@data-ezelement='ezlink'] | ezxhtml5:span[@data-ezelement='ezembedinline']/ezxhtml5:a[@data-ezelement='ezlink']">
<xsl:call-template name="embeddedLink"/>
</xsl:template>

<!-- BC layer: using "link" tag instead of "a" tag inside of div[@data-ezelement='ezembed'] is deprecated and will be dropped in the next major release -->
<xsl:template match="ezxhtml5:div[@data-ezelement='ezembed']/ezxhtml5:link[@data-ezelement='ezlink'] | ezxhtml5:span[@data-ezelement='ezembedinline']/ezxhtml5:link[@data-ezelement='ezlink']">
<xsl:call-template name="embeddedLink"/>
</xsl:template>

<xsl:template match="ezxhtml5:span[@data-ezelement='ezconfig']">
<xsl:element name="ezconfig" namespace="http://docbook.org/ns/docbook">
<xsl:apply-templates/>
@@ -1,14 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<section xmlns="http://ez.no/namespaces/ezpublish5/xhtml5/edit">
<div itemscope="itemscope" data-ezelement="ezembed" data-href="ezcontent://106" id="embed-id-1" data-ezview="embed" class="embed-class" data-ezalign="left">
<link itemprop="url" data-ezelement="ezlink" href="ezurl://95#fragment1" target="_blank" id="link-id-1" title="Link title" class="link-class"/>
<a data-ezelement="ezlink" href="ezurl://95#fragment1" target="_blank" id="link-id-1" title="Link title" class="link-class"> </a>
<span data-ezelement="ezconfig">
<span data-ezelement="ezvalue" data-ezvalue-key="size">medium</span>
<span data-ezelement="ezvalue" data-ezvalue-key="offset">10</span>
<span data-ezelement="ezvalue" data-ezvalue-key="limit">5</span>
</span>
</div>
<div itemscope="itemscope" data-ezelement="ezembed" data-href="ezlocation://601" id="embed-id-2" data-ezview="line" class="embedClass2" data-ezalign="right">
<link itemprop="url" data-ezelement="ezlink" href="ezlocation://202" class="linkClass2"/>
<a data-ezelement="ezlink" href="ezlocation://202" class="linkClass2"> </a>
</div>
</section>
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<section xmlns="http://ez.no/namespaces/ezpublish5/xhtml5/edit">
<p>Some <span itemscope="itemscope" data-ezelement="ezembedinline" id="id3" data-href="ezcontent://601" data-ezview="embed-inline-custom" class="embedClass" data-ezalign="left">
<link itemprop="url" data-ezelement="ezlink" href="ezcontent://106" id="id4" target="_blank" title="Link title" class="linkClass"/>
<a data-ezelement="ezlink" href="ezcontent://106" id="id4" target="_blank" title="Link title" class="linkClass"> </a>
</span> for the otherwise unremarkable paragraph.</p>
<p>This paragraph is just showing off its <span itemscope="itemscope" data-ezelement="ezembedinline" id="id5" data-href="ezcontent://501" data-ezview="embed-inline" class="embedClass2" data-ezalign="right">
<link itemprop="url" data-ezelement="ezlink" href="ezcontent://105" id="id6" title="Link title 2" class="linkClass2"/>
<a data-ezelement="ezlink" href="ezcontent://105" id="id6" title="Link title 2" class="linkClass2"> </a>
<span data-ezelement="ezconfig">
<span data-ezelement="ezvalue" data-ezvalue-key="size">medium</span>
</span>

0 comments on commit c4aa555

Please sign in to comment.
You can’t perform that action at this time.