UBB.Dev
Posted By: Derek Carriage Returns and HTML - 04/04/2001 7:33 PM
Does anyone know of a tag that will allow for posting of HTML source into an HTML enabled board without carriage returns being inserted into the end result by wwwthreads?

Here is an example:

1. User publishes a poem she has written on her personal web site.
2. User wishes to post the poem she has written to an HTML enabled wwwthreads board.
3. User opens her poem from her web site, views its source, and copies the raw HTML to her clipboard.
4. User pastes the raw HTML code for her poem into a wwwthreads post and posts it.
5. Here is what the user had on her web site:
--------------------------
Roses are Red
Violets are Blue

I won't think up better words
because it's only you.
--------------------------

6. Here is what she ends up with on wwwthreads:

--------------------------
Roses are Red
Violets are Blue




I won't think up better words
because it's only you.
--------------------------

Notice the spacing difference between the two sections. It seems that, HTML does not interpret untagged line breaks, as actual line breaks. Unfortunately, when the raw text is posted into wwwthreads, wwwthreads inserts a CR at every line break, whether tagged or not.

This becomes a serious problem, when people are trying to post news articles, for example, and the spacing gets thrown out of whack, not to mention line wrapping. The {pre} tags don't really work, as they result in even stranger looking layout and fonts.

Does anyone have any idea how a user can post raw HTML into wwwthreads and retain the original HTML look without things like carriage returns being added? This question may have already been asked, so I apologize in advance if I am repeating something that has already been hashed out.

Derek

Posted By: dgermann Re: Carriage Returns and HTML - 04/05/2001 2:32 AM
Derek--

Dunno for sure but I get wacky things sometimes if I have both html and markup enabled, especially if they are both used in the same document (which latter is probably not your case).

:-Doug.
[][email protected][/]
www.FootprintsintheWind.com
Posted By: Sharif Re: Carriage Returns and HTML - 04/05/2001 9:55 AM
You need to hack w3t.pm to take out auto linebreaks

Comment line 63 : $value =~ s/\n/<BR>/g;
And line 127 : $body =~ s/\n/<BR>/g;

You need too a small hack in editpost.pl such that undo_markup shouldn't be called when HTML is enabled for a forum.

Add a query before calling undo_mark: (around line 141 in editpost.pl)

    my $Board_q = $dbh -> quote($Board);
$query = qq!
SELECT
Bo_HTML
FROM w3t_Boards
WHERE Bo_Keyword = $Board_q

!;
$sth = $dbh -> prepare ($query) or w3t::not_right("Query syntax error: $DBI::errstr. Query: $query",$Cat,1);
$sth -> execute() or w3t::not_right("Can't execute query: $query. Reason: $DBI::errstr",$Cat,1);
my ($HTML) = $sth -> fetchrow_array;
$sth -> finish;


Then do the necessary changes such that yoy get:

    $Body = w3t::undo_markup($Body) [:red]unless ($HTML eq "On");
$Body =~s /< br >/\ n/gi [:red]unless ($HTML eq "On")[/b];


This is not a complete satisfactory hack (when you edit a post, you'll see the HTML
tags instead of invisible carriage returns) but it works fine to display the HTMl documents.

Posted By: Derek Re: Carriage Returns and HTML - 04/06/2001 2:28 AM
Thank you very much Sharif. I appreciate the time and effort you put into your response. We will give your solution a try.

One thing I would like to see, would be a tag, similar to {pre}, but which treats everything inside it as HTML and presents the HTML inside it just as it was entered, with no modifications.

Thanks again,

Derek

Posted By: Sharif Re: Carriage Returns and HTML - 04/06/2001 11:46 AM
So, you just want to publish the HTML source as it is. The browser will not interpret the tags inside < HTML > ... < /HTML >.
If this is the case, it's not hard to do it, I think, if there's one instance of the < HTML > and < /HTML > markups.

The idea would be to grab the text inside these tags and then to replace < and > by "& lt;" and "& gt;"
This way, the text wil be displayed as a raw HTML code

Posted By: Derek Re: Carriage Returns and HTML - 04/11/2001 5:51 AM
Dear Sharif,

I didn't make myself clear. Your first suggestion was close to what we are looking for. In essence what we would like is the ability to allow people to post raw HTML code, without needing to strip all line breaks from the code in order to get the final result to look as it did on the original HTML page.

I thought that the best way to accomplish this in an HTML enabled forum, would be to give the user a new tag that they could use around the HTML code which would keep W3T from changing the HTML code in any way (i.e. adding
, etc.). Thus people who didn't want to use HTML, would simply press CR to create line breaks. But those who wanted to use HTML wouldn't need to worry that W3T would insert line breaks in the middle of sentences and extra lines between paragraphs. I hope I haven't just confused things []/w3timages/icons/smile.gif[/]

Derek

Posted By: Sharif Re: The answer will come from Scream! - 04/11/2001 11:46 AM
OK, I see what you want. In fact the post would be splitted into several pieces, those enclosed into the tags, say [newhtml]...[/newhtml], and that need no markup treatment -if HTML is On- and the rest that needs a markup conversion.

That would be a very nice and powerful feature, indeed. It would solve a lot of troubles we have now because of the mix of HTML and MARKUP.
Only Scream can do it. I mean this feature needs to modify several scripts and to find a simple way to keep backward compatibility.

Scream, what do you think about this feature request? I think it's worthy to seriously consider it.

Posted By: Derek Re: The answer will come from Scream! - 04/11/2001 8:20 PM
Sharif,

That is exacly what I want, and you said it much more succinctly and elegantly than I was able to over 3 posts []/w3timages/icons/smile.gif[/] We have a definite need for this feature. I think that in boards that are HTML enabled, markup should be the default (easy for newcomers). The problem arises when more experienced users attempt to cut and paste HTML code. If the poster does not carefully strip all line breaks from the HTML, the results can turn out looking quite unlike what the poster expected.

The HTML tags I'm suggesting (and which you so kindly clarified for everyone) would resolve this problem. Thanks for your help Sharif []/w3timages/icons/smile.gif[/]

Derek

© UBB.Developers