Skip to content

Commit

Permalink
Merge branch '1.7'
Browse files Browse the repository at this point in the history
  • Loading branch information
andrerom committed Dec 10, 2018
2 parents ba13194 + abe2e5c commit 697da56
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 5 deletions.
13 changes: 8 additions & 5 deletions lib/FieldType/XmlText/Converter/EzLinkToHtml5.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,14 @@ public function convert(DOMDocument $xmlDoc)
}

if ($this->elementHasAttribute($element, 'anchor_name')) {
$element->setAttribute(
'url',
$element->getAttribute('url') . '#' .
$this->getElementAttribute($element, 'anchor_name')
);
$anchor = '#' . $this->getElementAttribute($element, 'anchor_name');
if (strpos($element->getAttribute('url'), $anchor) === false) {
$element->setAttribute(
'url',
$element->getAttribute('url') . '#' .
$this->getElementAttribute($element, 'anchor_name')
);
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,4 +259,15 @@
</xsl:copy>
</xsl:template>

<xsl:template match="paragraph[not(text())][custom][count(custom)=count(*)]">
<xsl:apply-templates select="custom"/>
</xsl:template>

<xsl:template match="@custom|node()">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates select="@custom|node()" />
</xsl:copy>
</xsl:template>

</xsl:stylesheet>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<section
xmlns:image="http://ez.no/namespaces/ezpublish3/image/"
xmlns:xhtml="http://ez.no/namespaces/ezpublish3/xhtml/"
xmlns:custom="http://ez.no/namespaces/ezpublish3/custom/">
<paragraph>Lorem ipsum.</paragraph>
<paragraph>
<custom name="test1">One</custom>
<custom name="test2" attr="test2a">Two</custom>
<custom name="test3"/>
</paragraph>
<paragraph>Lorem ipsum</paragraph>
</section>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<section xmlns="http://ez.no/namespaces/ezpublish5/xhtml5">
<p>Lorem ipsum.</p>
<custom name="test1">One</custom>
<custom name="test2" attr="test2a">Two</custom>
<custom name="test3"/>
<p>Lorem ipsum</p>
</section>

0 comments on commit 697da56

Please sign in to comment.