Scripting: Breaking Lines

Features wanted...
Post Reply
admin
Site Admin
Posts: 66305
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Scripting: Breaking Lines

Post by admin »

I was trying

Code: Select all

::readurl $a, "http://www.xyplorer.com/index.htm"; text $a
and found two things I did not like.

1. UNIX line breaks (LF) are not recognized by text, so the file is displayed in one long line.
2. the text command took out all <BR> tags from index.htm (and replaced them by CRLF because the line breaker defaults to <BR>)

That first one was easily fixed.

But concerning the <BR> tags: it's probably no good idea to initialize that line breaker to <BR>, and/or to use it by default in the text command. More elegant would have been to add a line breaker as an optional argument! This argument would have to be added to the following commands:
copytext
msg
text


The "br" command could then be dropped.

Agree everybody?

EDIT: Don't bother: I did it. :mrgreen:

jacky
XYwiki Master
Posts: 3106
Joined: 23 Aug 2005 22:25
Location: France
Contact:

Re: Scripting: Breaking Lines

Post by jacky »

admin wrote:EDIT: Don't bother: I did it. :mrgreen:
Yeah well, I'm not sure that was such a good idea :roll:

Because while I can totally see your problem with <br> and HTML files/code, I'm not sure it justifies the "probably no good idea to initialize that line breaker to <BR>" actually. I mean, maybe it is true, maybe not, but it's not like XY was supposed to be dealing with HTML code anyways, and all it took to get ride of that what one call to command br.

More importantly is your decision to not only change the syntax of how the line breaker works, but make a major change by dropping the default one ! Now that means all of the scripts where <br> was used as a line-breaker, and it was obviously used a lot since it was the default one, it doesn't work anymore, and all scripts must be fixed.

It's a bit of a PITA I'd say, and all that for what? So that one can do a msg/text/copytext of some HTML code without having to change the line breaker first? Yeah well, if I had had a say in this, I'd have say that <br> should have remained the default line breaker, as to not break any existing scripts, and if you want to do a text $html just add ,,,,,"" to disable the line breaker, much like you'd have called br before. Why give the potential use of HTML code preference over all previous scripts written since v7.00 ?? :?

(Unless you actually meant to do that, and just forgot to set <br> as new default line breaker on commands copytext, msg & text ; in such case I apologize, it probably was a good idea then... will be once fixed ;))
Proud XYplorer Fanatic

admin
Site Admin
Posts: 66305
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Scripting: Breaking Lines

Post by admin »

jacky wrote:
admin wrote:EDIT: Don't bother: I did it. :mrgreen:
Yeah well, I'm not sure that was such a good idea :roll:

Because while I can totally see your problem with <br> and HTML files/code, I'm not sure it justifies the "probably no good idea to initialize that line breaker to <BR>" actually. I mean, maybe it is true, maybe not, but it's not like XY was supposed to be dealing with HTML code anyways, and all it took to get ride of that what one call to command br.

More importantly is your decision to not only change the syntax of how the line breaker works, but make a major change by dropping the default one ! Now that means all of the scripts where <br> was used as a line-breaker, and it was obviously used a lot since it was the default one, it doesn't work anymore, and all scripts must be fixed.

It's a bit of a PITA I'd say, and all that for what? So that one can do a msg/text/copytext of some HTML code without having to change the line breaker first? Yeah well, if I had had a say in this, I'd have say that <br> should have remained the default line breaker, as to not break any existing scripts, and if you want to do a text $html just add ,,,,,"" to disable the line breaker, much like you'd have called br before. Why give the potential use of HTML code preference over all previous scripts written since v7.00 ?? :?

(Unless you actually meant to do that, and just forgot to set <br> as new default line breaker on commands copytext, msg & text ; in such case I apologize, it probably was a good idea then... will be once fixed ;))
Hey, I gave you 20 minutes to reply in time! Now you come complaining... :P

Ok, I guess you are not totally unright here. So, do not change your scripts. I think about a solution.

jacky
XYwiki Master
Posts: 3106
Joined: 23 Aug 2005 22:25
Location: France
Contact:

Re: Scripting: Breaking Lines

Post by jacky »

admin wrote:Hey, I gave you 20 minutes to reply in time! Now you come complaining... :P
hehe... Right, my bad.
admin wrote:Ok, I guess you are not totally unright here. So, do not change your scripts. I think about a solution.
No guess here, I'm totally unwrong is what you mean, just admit it: Yes, I am right. :mrgreen: ;)
Proud XYplorer Fanatic

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: Scripting: Breaking Lines

Post by TheQwerty »

Well if 20 minutes is pushing the acceptable response time for this, I guess 21 hours is out of the question...

That said, I agree with jacky and I'm also really glad you made the change on a weekend since I usually skip those betas. :P

Post Reply