Announcement

Do not use the forums to submit bug reports, feature requests or patches, submit a New Ticket instead.

#1 2005-04-13 20:14:43

dbakkers
New member
Registered: 2005-03-23
Posts: 4

Creating line feed during createElement() or surroundContents()

I need to alter the behaviour of the creation of the child nodes so that each element has a line return. Currently, Xinha creates one long string of text by using surroundContents() without any line feeds. This results in one long string of HTML output :

<p>this is one line</p><p>this is the next</p></br>linebreak etc

What I want is to force a HTML escape character (
) at the beginning of each child node so that the resulting HTML text is broken into smaller blocks :

<p>this is one line</p>
<p>this is the next</p>
</br>linebreak etc

I need this as I am using Xinha to format HTML email messages and many SMTP servers have rules or use RBLs that block messages with too many characters on one line.

I'm not sure how, in the section that appends the nodes using createElement(newTagName), this might be done.
Can anyone give me some help.

Offline

#2 2005-04-14 00:42:58

gogo
Xinha Leader
From: New Zealand
Registered: 2005-02-11
Posts: 1,015
Website

Re: Creating line feed during createElement() or surroundContents()

The simplest method would be for you to insert the linebreaks yourself when the text is submitted to you, eg in php

$text = $_POST['myXinhaField'];
$text = preg_replace('/(<\/[a-z0-9]+>)/i', '$1\r\n', $text);

James Sleeman

Offline

#3 2005-04-14 02:36:28

dbakkers
New member
Registered: 2005-03-23
Posts: 4

Re: Creating line feed during createElement() or surroundContents()

The problem I face is that there are no server side scripting like PHP or Perl, available.

Could I insert an equivalent JavaScript regex search into the HTMLarea f.onsubmit to break it down into smaller pieces prior to it being submitted back to the textarea ?

Offline

#4 2005-04-14 03:38:20

gogo
Xinha Leader
From: New Zealand
Registered: 2005-02-11
Posts: 1,015
Website

Re: Creating line feed during createElement() or surroundContents()

dbakkers wrote:

The problem I face is that there are no server side scripting like PHP or Perl, available.

Could I insert an equivalent JavaScript regex search into the HTMLarea f.onsubmit to break it down into smaller pieces prior to it being submitted back to the textarea ?

Yes,

<form ... onsubmit="this['myTextArea'].value = this['myTextArea'].value.replace(/(<\/?[a-z0-9]+>)/ig, '\1\r\n');return true">

(I'm just not sure on the backreference format in javascript regex off the top of my head, it might be $1 instead of \1)


James Sleeman

Offline

Board footer

Powered by FluxBB