Easier syntax for quoting text and html?

Jim Ault jimaultwins at yahoo.com
Fri Jan 1 21:03:57 EST 2010


My plan is to use irev to call various working scripts that are run in  
Rev cgi, rather than try to build functions above working code in a  
single irev script.
The way I handle multiline storage of languages like AppleScript,  
Html, Php is the following:

A non-irev solution:
The only way I can think of at the moment to get a multiline text  
script to work in Rev so that it can be simply typed verbatim and then  
used in variables, then be shared between cards, stacks, and other Rev  
users, etc. is to do the following:


### stack script --------------------

put line 2 to -2 of the script of btn textSnip01 into multiLineVerbatim
put line 2 to -2 of the script of btn htmlSnip02 into multiLineHtml
--and you can copy and paste buttons between cards/stacks

-- if a button is NOT in a group, its ID is different on each card
-- if a button is in a group, it is the same as setting a field to  
'sharing' thus the same script is available to all cards that use that  
group


### button textSnip01 script ###
/*  --this allows compiling without errors
this is a long
multi line string.
I'd say "It's easy to embed quotes within it !!"
*/

### button htmlSnip02 script ###
/*
<b>Major Headline</b>
<p> More info on the next page if you click very fast.<br>
If not, there will be less info.<br>
<i>The clock is ticking...</i>
</p>
*/

### button appleScriptSnip03 script ###
/*
set thisUrl to "http://www.mapquest.com/maps/89117/90209/"
tell application "Safari"
	make new document
	set the URL of document 1 to thisUrl
	delay 5
	tell window 1
		set prevName to the name of current tab
		make new tab
		set current tab to last tab
	end tell
	set the URL of document 1 to thisUrl
	delay 5
	set listt to every document
	--MapQuest: Driving Directions & Business Directory
	return listt
end tell
*/
####################
One caution:  watch for tabs and high-ascii chars that may get pasted  
from other code editors

Hope this gives you a few ideas to get up and running before the  
script editor features are added.

Jim Ault
Las Vegas


On Jan 1, 2010, at 4:18 PM, Alex Tweedly wrote:

> David Bovill wrote:
>> 2009/12/31 Jim Ault <jimaultwins at yahoo.com>
>>  --// html honors both quote types, ignores extra spaces
>>
> Thanks Jim !! How did I get to this age in my life without realizing  
> that !?
>> NB - I do think that RunRev should add syntax to the language to  
>> make html
>> quoting very easy to use for both iRev scripts We need an elegant  
>> solution
>> to quoting html - other languages are easier to use and read with  
>> regard to
>> html quoting! using our own custom functions does not make read/ 
>> writeability
>> that much easier, and makes it harder to share scripts.
>>
> My first choice would be to allow either single or double quotes to  
> delimit strings - then I could put the other kind within it without  
> any problems (yep, idea borrowed from Python, amongst others).
>
> So we could go one step further and also borrow from Python a neat  
> method of allowing multi-line strings. Instead of using *one* quote  
> at start+end of the string, you use *three* of them (which is  
> unambiguous with any existing valid code, afaict).  So in revTalk  
> terms, I could do
>
> put 'I said "This way!"' into tVar
>
> put "it's mine" into tVar
>
> put """
> this is a long
> multi line string.
> I'd say "It's easy to embed quotes within it !!"
> """ into tVar
>
> Note the starting triple-quote has to be last item on line, and the  
> closing triple-quote has to be first item on its line - and the  
> first/last CR within the text are not part of the resulting string.
>> My suggestion is to extend the syntax for local variables and  
>> constants.
>> Currently we have:
>>
>>
> Hmmm :-(    I'd much rather find a syntax that works equally for  
> local, constants and plain old expressions - see above.
>
> -- Alex.
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution

Jim Ault
Las Vegas






More information about the use-livecode mailing list