Easier syntax for quoting text and html?

David Bovill david.bovill at gmail.com
Fri Jan 1 09:10:23 EST 2010


2009/12/31 Jim Ault <jimaultwins at yahoo.com>

>   --// html honors both quote types, ignores extra spaces
>   --// javascript honors both quote types
>
>   --build the Rev string without ANY ampersands
>   --use single, not double quotes
>

I use single quote - but run into some problems so got lazy and replaced
then at the end with "replace "'" with quote. Not sure what situations cause
the problems - is it OK to use single quotes in Rev htmlText? Not sure. But
thanks for the tip

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 personal choice would be to have an in-script syntax for putting raw text
into a variable. The idea would be that you could type the text inside some
sort of markup, in a way in which you could write anything, and then assign
it to a variable. That way you could just copy html or whatever and paste it
into the script editor - easy and readable.

While you can do this with custom properties - and the IDE could be changed
to make it easier to relate values in custom properties to the scripts by
showing both in the same window - I'd prefer the ability to do this all in a
script. This is also important for iRev server side scripts, where custom
properties are less easy to use.

My suggestion is to extend the syntax for local variables and constants.
Currently we have:

local someHtml = "<b> hello world </>"
>

How about something like:

local someHtml = {
>     <b> hello world </>
> }
>


This would then allow doing things like:

local someHtml = {
> It is <b>traditional</> to say "Happy New Year" at this time of year, & why
> not?
>
> You could 'single quote' or "double quote" etc
> }
>

Alternatives could be to use quotes as they are (but allow a special
exception for multiple lines):

local someHtml = "
> <b> hello world </>
> "
>

or to use C style quotes:

local someHtml = /*
> <b> hello world </>
> */
>

If you like this suggestion maybe vote for it / improve it here -
http://quality.runrev.com/qacenter/show_bug.cgi?id=8517

NB - at the same time perhaps as implementing this RunRev could take the
opportunity to enhance local/constant functionality by allowing a script to
assign values to locals (and constants?) as the value of an expression:

local someHtml = the htmltext of fld 1
> local someValue = fetchSomething("new")
>



More information about the use-livecode mailing list