Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

- Fixed bug #016814: Rendering problems in ezxmltext datatype

git-svn-id: file:///home/patrick.allaert/svn-git/ezp-repo/ezpublish/trunk@25307 a01eee8c-daba-0310-acae-fa49f3023285
  • Loading branch information...
commit 9df764fc6561e0464ee4705f1365726929716a23 1 parent 17937f5
@andrerom andrerom authored
View
1  doc/changelogs/4.4/unstable/CHANGELOG-4.4.0alpha1-to-4.4.0alpha2
@@ -22,6 +22,7 @@ Changes from 4.4.0alpha1 to 4.4.0alpha2
- Fixed bug #016830: kernel/setup/systemupgrade.php - typo in php classname
- Fixed bug #016829: Bug in user/preferences
- Fixed bug #016828: content/view/full => if node_id is no numeric or < 2 ez should return an error_code
+- Fixed bug #016814: Rendering problems in ezxmltext datatype
- Fixed bug #016799: CSS class doesn't show when link is image, not text
- Fixed bug #016797: eZSimplifiedXMLEditOutput does not unescape &nbsp; like output handler does
- Fixed bug #016713: eZImageType doesn't use real main node for image path
View
11 kernel/classes/datatypes/ezxmltext/handlers/output/ezxhtmlxmloutput.php
@@ -449,7 +449,10 @@ function renderParagraph( $element, $childrenOutput, $vars )
{
if( $childOutput[1] === ' ' )
{
- continue;
+ if ( isset( $childrenOutput[ $key + 1 ] ) )
+ continue;
+ else if ( isset( $childrenOutput[ $key - 1 ] ) && $childrenOutput[ $key - 1 ][0] === false )
+ continue;
}
$inlineContent .= $childOutput[1];
@@ -539,6 +542,12 @@ function renderLine( $element, $childrenOutput, $vars )
elseif ( $childOutput[0] === true && !isset( $childrenOutput[ $key + 1 ] ) )
{
$next = $element->nextSibling;
+ // Make sure we get next element that is an element (ignoring whitespace)
+ while ( $next && !$next instanceof DOMElement )
+ {
+ $next = $next->nextSibling;
+ }
+
if ( $next && $next->nodeName == 'line' )
{
$tagText = $this->renderTag( $element, $inlineContent, $vars );
View
63 tests/tests/kernel/datatypes/ezxmltext/handlers/output/ezxhtmlxmloutput_regression.php
@@ -9,7 +9,6 @@
class eZXHTMLXMLOutputRegression extends ezpDatabaseTestCase
{
-
public function __construct()
{
parent::__construct();
@@ -60,7 +59,7 @@ public function testRenderParagraphBlockTags()
$XMLString = '<?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> <table><tr><td>foo</td></tr></table> </paragraph>
+ <paragraph> <table><tr><td>foo</td></tr></table> </paragraph>
</section>';
$outputHandler = new eZXHTMLXMLOutput( $XMLString, false );
@@ -79,8 +78,64 @@ public function testRenderParagraphBlockTags()
}
/**
- * Tests that eZXML from ezp3 and ezp4 produces the same
- * result
+ * Regression in renderParagraph() after #16184 causing last paragraphs to not be shown
+ *
+ * @link http://issues.ez.no/16814
+ * @note Test depends on template output!!
+ */
+ public function testMissingParagraphs()
+ {
+ $XMLString = '<?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>
+ <line>Haustsemesteret,
+ <strong>7,5 studiepoeng</strong>
+ </line>
+ <line><strong>FP 336 620 Naturfag, del 1</strong>: Individuell, skriftleg mappe (HSF Oppdrag/betalingsemne)</line>
+ </paragraph>
+ <paragraph>
+ <line><strong>FP334 620 Naturfag, del 2</strong> : Individuell, skriftleg eksamen.</line>
+ <line>Tid: 4 timar </line>
+ </paragraph>
+</section>';
+
+ $outputHandler = new eZXHTMLXMLOutput( $XMLString, false );
+ $result = $outputHandler->outputText();
+
+ $html = ' <p>
+Haustsemesteret, <b>7,5 studiepoeng</b> <br /><b>FP 336 620 Naturfag, del 1</b>: Individuell, skriftleg mappe (HSF Oppdrag/betalingsemne) </p> <p>
+<b>FP334 620 Naturfag, del 2</b> : Individuell, skriftleg eksamen.<br />Tid: 4 timar </p>';
+
+ $this->assertEquals( $html, $result );
+ }
+
+ /**
+ * Regression in renderParagraph() after #15310 causing lines to not have line breaks in ouput
+ *
+ * @link http://issues.ez.no/16814
+ * @note Test depends on template output!!
+ */
+ public function testMissingBreak()
+ {
+ $XMLString = '<?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>
+ <line>Telephone #1</line>
+ <line>Telephone #2</line>
+</paragraph>
+</section>';
+
+ $outputHandler = new eZXHTMLXMLOutput( $XMLString, false );
+ $result = $outputHandler->outputText();
+
+ $html = '<p>
+Telephone #1<br />Telephone #2</p>';
+
+ $this->assertEquals( $html, $result );
+ }
+
+ /**
+ * Tests that eZXML from ezp3 and ezp4 produces the same result
*
* @link http://issues.ez.no/16184
* @note XML is from actual customer xml
Please sign in to comment.
Something went wrong with that request. Please try again.