John Smith
|
Monday 20 March 2006 6:24:17 am
If you enter a text with a linebreak you will get the following results: <p>test<br />text<br /></p> The issue is with the last <br /> in the example. It is completly unneeded.. Is it a bug, has anybody solved it? Please help Cheers John Smith
|
Kirill Subbotin
|
Monday 27 March 2006 1:13:01 am
Yes, here is the patch:
Modified: trunk/kernel/classes/datatypes/ezxmltext/handlers/output/ezxhtmlxmloutput.php
===================================================================
--- trunk/kernel/classes/datatypes/ezxmltext/handlers/output/ezxhtmlxmloutput.php 2006-03-24 11:26:45 UTC (rev 15292)
+++ trunk/kernel/classes/datatypes/ezxmltext/handlers/output/ezxhtmlxmloutput.php 2006-03-24 11:29:44 UTC (rev 15293)
@@ -341,8 +341,20 @@
$sectionLevel = $currentSectionLevel;
$class = $paragraph->attributeValue( 'class' );
+ $curChildIndex = 0;
+ $totalChildren = count( $paragraph->children() );
foreach ( $paragraph->children() as $paragraphNode )
{
+ $curChildIndex++;
+
+ if ( $curChildIndex == $totalChildren )
+ {
+ $this->LastParagraphChild = true;
+ }
+ else
+ {
+ $this->LastParagraphChild = false;
+ }
$isBlockTag = false;
$content =& $this->renderXHTMLTag( $tpl, $paragraphNode, $sectionLevel, $isBlockTag, $tdSectionLevel );
if ( $isBlockTag === true )
@@ -1020,6 +1032,12 @@
$tpl->setVariable( 'content', $childTagText, 'xmltagns' );
$uri = "design:content/datatype/view/ezxmltags/$tagName.tpl";
+ //force rendering last line without <br> i.e. as plain text
+ if ( $tagName == 'line' && $this->LastParagraphChild )
+ {
+ $uri = "design:content/datatype/view/ezxmltags/text.tpl";
+ }
+
$textElements = array();
include_once( 'lib/eztemplate/classes/eztemplateincludefunction.php' );
eZTemplateIncludeFunction::handleInclude( $textElements, $uri, $tpl, 'foo', 'xmltagns' );
@@ -1110,6 +1128,10 @@
/// Contains the Nodes hashed by ID
var $NodeArray = array();
+
+ /// Contains boolean flag if current child is last among paragraph children
+ /// used when rendering last <line> tag.
+ var $LastParagraphChild = false;
/// Array of parameters for rendering tags that are children of 'link' tag
var $LinkParameters = array();
|
John Smith
|
Monday 27 March 2006 2:19:27 am
Thanks, I have tried on ezpublish 3.6.1, it seems to be working.Obviously the line numbers are different what you said in your last reply. Once again thanks for your kind help. Cheers. John...
|