-
console.putmsg alternative that returns a string
From
Nightfox@VERT/DIGDIST to
All on Tue Sep 30 12:39:49 2014
Is there an alternative to console.putmsg() that returns a string instead ofãoutputting to the console? What I'd like to do is to have @-codes, etc.ãinterpreted in a string and save that string so I can then pass that string toãprintf() so I can specify a field length for the text.ããNightfoxãã---ã þ Synchronet þ Digital Distortion BBS - digitaldistortionbbs.comã
-
From
Psi-Jack@VERT/DECKHVN2 to
Nightfox on Wed Oct 1 09:32:55 2014
Re: console.putmsg alternative that returns a stringã By: Nightfox to All on Tue Sep 30 2014 12:39 pmãã Ni> Is there an alternative to console.putmsg() that returns a string insteadã Ni> of outputting to the console? What I'd like to do is to have @-codes,ã Ni> etc. interpreted in a string and save that string so I can then pass thatã Ni> string to printf() so I can specify a field length for the text.ããI believe what you're looking for is bbs.atcode():ããtext = text.replace(/@([^@]+)@/g, function(m, code) {ã return bbs.atcode(code);ã});ãã---ã>>>[Psi-Jack -//- Decker]ã þ Synchronet þ Decker's Heaven -//- bbs.deckersheaven.comã
-
From
Nightfox@VERT/DIGDIST to
Psi-Jack on Wed Oct 1 07:44:15 2014
Re: console.putmsg alternative that returns a stringã By: Psi-Jack to Nightfox on Wed Oct 01 2014 09:32:55ãã Ni>> Is there an alternative to console.putmsg() that returns a stringã Ni>> instead of outputting to the console? What I'd like to do is toã Ni>> have @-codes, etc. interpreted in a string and save that string so Iã Ni>> can then pass that string to printf() so I can specify a fieldã Ni>> length for the text.ãã Ps> I believe what you're looking for is bbs.atcode():ãã Ps> text = text.replace(/@([^@]+)@/g, function(m, code) {ã Ps> return bbs.atcode(code);ã Ps> });ããI saw bbs.atcode() in the docs.. I was hoping for something that handles aãwhole string, similar to console.putmsg(). bbs.atcode() only interprets aãsingle @-code, which requires writing some more code, but I suppose that willãhave to do. Thanks.ããNightfoxãã---ã þ Synchronet þ Digital Distortion BBS - digitaldistortionbbs.comã
-
From
Digital Man@VERT to
Nightfox on Wed Oct 1 16:13:25 2014
Re: console.putmsg alternative that returns a stringã By: Nightfox to All on Tue Sep 30 2014 12:39 pmãã > Is there an alternative to console.putmsg() that returns a string insteadã > of outputting to the console? What I'd like to do is to have @-codes, etc.ã > interpreted in a string and save that string so I can then pass that stringã > to printf() so I can specify a field length for the text.ããI think you're looking for bbs.atcode().ããThat said, Synchronet @-codes already support a method for length field specification as well as left and rigth justification:ã
http://wiki.synchro.net/custom:atcodes#formattingãã digital manããSynchronet "Real Fact" #55:ãSynchronet Terminal Server introduced SecureShell (SSH) support w/v3.14a (2006).ãNorco, CA WX: 83.1øF, 45.0% humidity, 3 mph ESE wind, 0.00 inches rain/24hrsã---ã þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.netã
-
From
Nightfox@VERT/DIGDIST to
Digital Man on Wed Oct 1 18:06:21 2014
Re: console.putmsg alternative that returns a stringã By: Digital Man to Nightfox on Wed Oct 01 2014 16:13:25ãã DM> I think you're looking for bbs.atcode().ããI was hoping for something similar to console.putmsg which would interpretãcodes in a whole string and return the new string, but I suppose I could writeãsomething to do that with bbs.atcode().ãã DM> That said, Synchronet @-codes already support a method for length fieldã DM> specification as well as left and rigth justification:ã DM>
http://wiki.synchro.net/custom:atcodes#formattingããThat's not exactly what I'm looking for - What I will be using this for isãreading messages posted on sub-boards, which might include @-codes. Thoseãmight not necessarily include length formatting. I'll be taking each line fromãthe message and word-wrapping the line (as the interpreted @-code will likelyãdiffer in length from the @-code) and then displaying the message line on theãscreen with a specific width.ããNightfoxãã---ã þ Synchronet þ Digital Distortion BBS - digitaldistortionbbs.comã
-
From
Psi-Jack@VERT/DECKHVN2 to
Nightfox on Thu Oct 2 08:23:32 2014
Re: console.putmsg alternative that returns a stringã By: Nightfox to Psi-Jack on Wed Oct 01 2014 07:44 amãã Ni> Re: console.putmsg alternative that returns a stringã Ni> By: Psi-Jack to Nightfox on Wed Oct 01 2014 09:32:55ãã Ps>> I believe what you're looking for is bbs.atcode():ãã Ps>> text = text.replace(/@([^@]+)@/g, function(m, code) {ã Ps>> return bbs.atcode(code);ã Ps>> });ãã Ni> I saw bbs.atcode() in the docs.. I was hoping for something that handlesã Ni> a whole string, similar to console.putmsg(). bbs.atcode() only interpretsã Ni> a single @-code, which requires writing some more code, but I suppose thatã Ni> will have to do. Thanks.ããHmm, yeah. I don't think there's anything else. This text.replace itself goesãthrough each beginning and ending @ code block and translates each one, atãleast as far as I can tell it does. the variable, text, becomes the fullãat-code translated result. ããEither way, you're welcome, and hope it helps. :)ãã---ã>>>[Psi-Jack -//- Decker]ã þ Synchronet þ Decker's Heaven -//- bbs.deckersheaven.comã
-
From
Psi-Jack@VERT/DECKHVN2 to
Digital Man on Thu Oct 2 08:27:57 2014
Re: console.putmsg alternative that returns a stringã By: Digital Man to Nightfox on Wed Oct 01 2014 04:13 pmãã DM> Re: console.putmsg alternative that returns a stringã DM> By: Nightfox to All on Tue Sep 30 2014 12:39 pmãã >> Is there an alternative to console.putmsg() that returns a stringã >> instead of outputting to the console? What I'd like to do is to haveã >> @-codes, etc. interpreted in a string and save that string so I canã >> then pass that string to printf() so I can specify a field length forã >> the text.ãã DM> I think you're looking for bbs.atcode().ãã DM> That said, Synchronet @-codes already support a method for length fieldã DM> specification as well as left and rigth justification:ã DM>
http://wiki.synchro.net/custom:atcodes#formattingããI think he's looking to get the entire value of the string withãmultiple translated at-codes combined, and possibly even other text, whichã@-code formatting does not work on. On a singular one, the formatting wouldãwork, but combined with others, not so much. :)ãã---ã>>>[Psi-Jack -//- Decker]ã þ Synchronet þ Decker's Heaven -//- bbs.deckersheaven.comã
-
From
Nightfox@VERT/DIGDIST to
Psi-Jack on Thu Oct 2 07:29:35 2014
Re: console.putmsg alternative that returns a stringã By: Psi-Jack to Nightfox on Thu Oct 02 2014 08:23:32ãã Ps>>> text = text.replace(/@([^@]+)@/g, function(m, code) {ã Ps>>> return bbs.atcode(code);ã Ps>>> });ãã Ps> Hmm, yeah. I don't think there's anything else. This text.replace itselfã Ps> goes through each beginning and ending @ code block and translates eachã Ps> one, at least as far as I can tell it does. the variable, text, becomesã Ps> the full at-code translated result. ããYep, I've used JavaScript's string replace() function in some of my scripts. ãAnd regular expressions are awesome.ããNightfoxãã---ã þ Synchronet þ Digital Distortion BBS - digitaldistortionbbs.comã
-
From
Nightfox@VERT/DIGDIST to
Psi-Jack on Sun Oct 5 09:51:55 2014
Re: console.putmsg alternative that returns a stringã By: Psi-Jack to Nightfox on Wed Oct 01 2014 09:32:55ãã Ps> text = text.replace(/@([^@]+)@/g, function(m, code) {ã Ps> return bbs.atcode(code);ã Ps> });ããThat seems to work well. I'm curious, how did you find that you could use anãanonymous function for the replacement value in the JavaScript string replace()ãmethod? I've often referred to the w3schools.com JavaScript documentation, andãtheir documentation for the string replace() method seems to imply that itãexpects a string for the replacement value:ãwww.w3schools.com/jsref/jsref_replace.aspããNightfoxãã---ã þ Synchronet þ Digital Distortion BBS - digitaldistortionbbs.comã
-
From
Psi-Jack@VERT/DECKHVN2 to
Nightfox on Mon Oct 6 15:27:46 2014
Re: console.putmsg alternative that returns a stringã By: Nightfox to Psi-Jack on Sun Oct 05 2014 09:51 amãã Ni> Re: console.putmsg alternative that returns a stringã Ni> By: Psi-Jack to Nightfox on Wed Oct 01 2014 09:32:55ãã Ps>> text = text.replace(/@([^@]+)@/g, function(m, code) {ã Ps>> return bbs.atcode(code);ã Ps>> });ãã Ni> That seems to work well. I'm curious, how did you find that you could useã Ni> an anonymous function for the replacement value in the JavaScript stringã Ni> replace() method? I've often referred to the w3schools.com JavaScriptã Ni> documentation, and their documentation for the string replace() methodã Ni> seems to imply that it expects a string for the replacement value:ã Ni> www.w3schools.com/jsref/jsref_replace.aspããWell, I didn't.. This is just stuff Deuce came up with for theãnewuser_signup.js I've been testing. ;)ãã---ã>>>[Psi-Jack -//- Decker]ã þ Synchronet þ Decker's Heaven -//- bbs.deckersheaven.comã
-
From
Nightfox@VERT to
Psi-Jack on Mon Oct 6 12:47:50 2014
text = text.replace(/@([^@]+)@/g, function(m, code) {ã > Ps>> return bbs.atcode(code);ã > Ps>> });ã > ã > Ni> That seems to work well. I'm curious, how did you find that you ãcouldã > Ni> use an anonymous function for the replacement value in the ãJavaScriptã > Ni> string replace() method? I've often referred to the w3schools.comã > Ni> JavaScript documentation, and their documentation for the stringã > Ni> replace() method seems to imply that it expects a string for theã > Ni> replacement value: www.w3schools.com/jsref/jsref_replace.aspã > ã > Well, I didn't.. This is just stuff Deuce came up with for theã > newuser_signup.js I've been testing. ;)ããAh, I see.ãI tried the code that you shared, and I think it might need some moreãtweaking, as it seems it will replace text around a @ even if it's not a validãSynchronet @-code..ããNightfoxã---ã þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.netã
-
From
Deuce@VERT/SYNCNIX to
Nightfox on Mon Oct 6 14:38:12 2014
Re: console.putmsg alternative that returns a stringã By: Nightfox to Psi-Jack on Sun Oct 05 2014 09:51 amãã > That seems to work well. I'm curious, how did you find that you could useã > an anonymous function for the replacement value in the JavaScript stringã > replace() method? I've often referred to the w3schools.com JavaScriptã > documentation, and their documentation for the string replace() methodã > seems to imply that it expects a string for the replacement value:ã > www.w3schools.com/jsref/jsref_replace.aspãã
http://www.synchro.net/docs/js/refããSpecifically:ãhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Object
s/String/replace#Specifying_a_function_as_a_parameterããã---ã
http://DuckDuckGo.com/ a better search engine that respects your privacy.ã þ Synchronet þ My Brand-New BBS (All the cool SysOps run STOCK!)ã
-
From
Deuce@VERT/SYNCNIX to
Nightfox on Mon Oct 6 14:39:36 2014
Re: console.putmsg alternative that returns a stringã By: Nightfox to Psi-Jack on Mon Oct 06 2014 12:47 pmãã > I tried the code that you shared, and I think it might need some moreã > tweaking, as it seems it will replace text around a @ even if it's not aã > valid Synchronet @-code..ããIt replaces everything between two @s, so two e-mail addresses would get borked
and merged for example.ãã---ã
http://DuckDuckGo.com/ a better search engine that respects your privacy.ã þ Synchronet þ My Brand-New BBS (All the cool SysOps run STOCK!)ã
-
From
Psi-Jack@VERT/DECKHVN2 to
Deuce on Tue Oct 7 11:23:29 2014
Re: console.putmsg alternative that returns a stringã > By: Nightfox to Psi-Jack on Mon Oct 06 2014 12:47 pmã > ã > > I tried the code that you shared, and I think it might need some moreã > > tweaking, as it seems it will replace text around a @ even if it's not aã > > valid Synchronet @-code..ã > ã > It replaces everything between two @s, so two e-mail addresses would getã > borked and merged for example.ã ãYikes! Yeah.. That could definitely be bad.. ã ã--- ã>>>[Psi-Jack -//- Decker]ã þ Synchronet þ Decker's Heaven -//- bbs.deckersheaven.comã
-
From
Psi-Jack@VERT/DECKHVN2 to
Deuce on Tue Oct 7 14:47:24 2014
Re: Re: console.putmsg alternative that returns a stringã By: Psi-Jack to Deuce on Tue Oct 07 2014 11:23 amãã >> Re: console.putmsg alternative that returns a stringã >> By: Nightfox to Psi-Jack on Mon Oct 06 2014 12:47 pmãã > >> I tried the code that you shared, and I think it might need someã > >> more tweaking, as it seems it will replace text around a @ even ifã > >> it's not a valid Synchronet @-code..ãã >> It replaces everything between two @s, so two e-mail addresses wouldã >> get borked and merged for example.ãã > Yikes! Yeah.. That could definitely be bad.. ããQuite bad. Yeah. ãã---ã>>>[Psi-Jack -//- Decker]ã þ Synchronet þ Decker's Heaven -//- bbs.deckersheaven.comã
-
From
Nightfox@VERT/DIGDIST to
Deuce on Tue Oct 7 19:38:13 2014