[29 Apr 2007] formatted text

Contains all messages from the Hollywood mailing list between 01/2006 and 08/2012
Locked
User avatar
lazi
Posts: 646
Joined: Thu Feb 24, 2011 11:08 pm

[29 Apr 2007] formatted text

Post by lazi »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Sun, 29 Apr 2007 23:14:45 +0100

Hello Andreas!

My didkmag has got a problem with the new text processor. I have to make every square bracket doubled before print the article.

However this is a great feature for such tasks, but this project is made without this one in mind.

It would be great if this on-the-fly text formatting could be enabled/disabled from the script. PLease let me know what do think about this!
User avatar
airsoftsoftwair
Posts: 5834
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

[30 Apr 2007] Re: formatted text

Post by airsoftsoftwair »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Mon, 30 Apr 2007 11:25:32 +0200
Hello Andreas!

My didkmag has got a problem with the new text processor. I have to make every square bracket doubled before print the article.

However this is a great feature for such tasks, but this project is made without this one in mind.

It would be great if this on-the-fly text formatting could be enabled/disabled from the script. PLease let me know what do think about this!
Hmm, not likely. I would have to implement a new command for that which I don't want to do. I can't just add an optional argument because commands like Print() and NPrint() accept an unlimited number of arguments and thus there is no place for an optional argument which says "don't use autoformat".
User avatar
lazi
Posts: 646
Joined: Thu Feb 24, 2011 11:08 pm

[27 May 2007] Re: formatted text

Post by lazi »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Sun, 27 May 2007 00:24:26 +0100

Hi!

I've just made an elegant solution for the discussed problem which shows the real power in Hollywood. I am so excited about this ability so I share with you. :)

Andreas, you do not need to implement another print command, when I am able to implement it from the script. :)

So, I changed the behaviour of the print command to not make any text formatting.

Here it comes:

Code: Select all

/* Save the original print command because we need it in the new "print"
function. This is so easy. */
old_print=print

/* Here is the new print function that doubles all [,]
control characters and print the string */
Function print(a$)
 darabok, db=SplitStr(a$,"[")
 a$= darabok[0]
 for i=2 to db do a$= a$ .. "[[" .. darabok[i-1]
 darabok, db=SplitStr(a$,"]")
 a$= darabok[0]
 for i=2 to db do a$= a$ .. "]]" .. darabok[i-1]
 old_print (a$)
endfunction     

/* After this line, every print() commands calls the new print
function*/
Locked