translating a color name to RGB triplet

classic Classic list List threaded Threaded
40 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Re: remove html tags from text

J. Landman Gay
[hidden email] wrote:

> In a message dated 9/8/06 11:40:31 AM, Mark Wieder <[hidden email]>
> writes:
>> Friday, September 8, 2006, 6:10:53 AM, you wrote:
>>> barely tested, but maybe a starting point:
>>> function striptags tHtml
>>>    replace cr with empty in tHtml -- in case of multi-line tags
>>>    replace "<" with cr & "<" in tHtml
>>>    replace ">" with ">" & cr in tHtml
>>>    filter tHtml without "*<*"
>>>    filter tHtml without "*>*"
>>>    return tHtml
>>> end striptags
>> Clever... but it'll fail on
>>
>> if xyz > 4096 then
>    No, it won't; not if you're working with an honest-to-God HTML document,
> at least. Greater-than and less-than signs are *only* found *in the HTML
> source*; if you want either of those symbols to show up when someone views your page
> in a browser window, both of them will be HTML entities that start with an
> ampersand and end with a semicolon.

Except when placed within a set of <CODE> tags. ;)

The tutorials at my web site are full of this sort of thing.

--
Jacqueline Landman Gay         |     [hidden email]
HyperActive Software           |     http://www.hyperactivesw.com
_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: remove html tags from text

Jim Ault
In reply to this post by Richard Gaskin

On 9/8/06 7:57 PM, "Richard Gaskin" <[hidden email]> wrote:

> Jim Ault wrote:
>
>> Cubist  is correct.  Any well-formed page will have balanced tags and only
>> use the < and > chars to mean tag markers.
>
> But can one deliver a product which assumes all the html thrown at it
> will be well-formed?
>
> So I have two questions about the sort of variable-based methods for
> filtering SGML-style tags and using a field object to so the same:
>
> 1. Which is more forgiving of html which may not be well-formed?
>
> 2. Which is faster?

My quick comment is to consider the sources of data and the intended use.
If gathering content for human review, many tools are possible to build that
could refine 'raw content' and even index it using a controlled vocabulary.

In my projects, the data needs to be mined and honed without human
intervention, so the 'smart' functions need to be applied judiciously.
Further, since my text blocks are small, I can afford to do more elaborate
steps that involve RegEx and error checking.  Additionally, if any data is
suspicious, it can be discarded with little penalty.

> 1. Which is more forgiving of html which may not be well-formed?
I would favor a decision tree that applied specific rules, found exceptions
and tried to react to them, thus variable-based methods with elaborate
parsing rules.  So many html sources are generated by database engines these
days, that errors which make no difference to the viewer will be propagated
throughout a site.  This means that 'bad' html tags to a parser like you
make no diff to a site manager, thus there is no reason to fix them.

A parallel is the use of OCR (optical character recognition) software.  How
fast do you want to go to get to 85% correct... 95% correct.. then have a
reviewer do the final editing?

If you are repeatedly mining the same sites (eg news agencies, competitors)
then it is easier.  Random authors/sites become more difficult.

Hope this gives you a bit of my opinion, but everyone's mileage can and will
vary.

Jim Ault
Las Vegas



_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: remove html tags from text

masmit
In reply to this post by Richard Gaskin

On 9 Sep 2006, at 03:57, Richard Gaskin wrote:
>
> So I have two questions about the sort of variable-based methods  
> for filtering SGML-style tags and using a field object to so the same:
>
> 1. Which is more forgiving of html which may not be well-formed?
>
> 2. Which is faster?
>

A quick initial test. The html used was what returned from

get URL "http://google.com"

I amended a tag that was <b>Web</b>
to  <b>Web 5<10 </b>
and then
<b>Web 10>5 </b>


I ran 100 iterations of each of the following

1)
function stripHtmlTagsUsingField tHtml
   set the htmlText of fld "hiddenFld" to tHtml
   return the text of fld "hiddenFld"
end stripHtmlTagsUsingField

This took 370 ms
it failed on 5<10 (the tag content returned was "Web 5", though the  
following content was ok)
it succeeded with 10>5

2)
function stsStripHTML what
   replace cr with empty in what -- my addition to Kens handler - to  
handle tags containing cr
   put replaceText(what,"<.*?>","") into noHTML
   return noHTML
end stsStripHTML

This took 920 ms
Same results as 1)

3)
function stripHtmlTags tHtml
   replace cr with empty in tHtml -- in case of multi-line tags
   replace "<" with cr & "<" in tHtml
   replace ">" with ">" & cr in tHtml
   filter tHtml without "<*>"
   repeat for each line LNN in tHtml
     put word 1 to -1 of LNN  & cr after newHtml
   end repeat
   filter newHtml without empty
   replace cr with space in newHtml
   return newHtml
end stripHtmlTags

This took 45 ms
Semi-succeeded with the amended tag content, in that 10>5 became 10>  
5 (additional space) and 5<10 became 5 <10.

The hidden field approach was the only one that translated html  
entities.

Best,

Mark




_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: translating a color name to RGB triplet

xtalkprogrammer
In reply to this post by KALANGI Vijay BABU
This appears to work in the IDE:

put revNumberToColor("249,232,210")

I haven't tested it in a standalone.

To create a function that uses an array, use the properties  
cRevColorTranslation and cRevColorTranslation2 of stack  
"revlibrary" (or test if above function works in a standalone).

Best regards,

Mark

--

Economy-x-Talk
Consultancy and Software Engineering
http://economy-x-talk.com
http://www.salery.biz

Get your store on-line within minutes with Salery Web Store software.  
Download at http://www.salery.biz

Op 8-sep-2006, om 14:32 heeft KALANGI Vijay BABU het volgende  
geschreven:

> Hi All,
>
>
>
> Can somebody suggest me a way to "translate a color name to RGB  
> triplet"
>
>
>
>
>
>
> Thanks in advance
>
>
>
>
>
> Bubye
>
> Vijay.


_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Kind regards,

Drs. Mark Schonewille

Economy-x-Talk Consultancy and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
Facebook: http://facebook.com/LiveCode.Beginner
KvK: 50277553
Reply | Threaded
Open this post in threaded view
|

selection differences in table

viktoras d.
Dear all,
 
field "fTable" has a script (tables Cell editing is set to true):
on arrowKey theKey
switch theKey
case "up"
..
break
case "down"
..
break
case "left"
..
break
case "right"
..
break
end arrowkey
 
when table cell text is selected but does not display editing field,
everything works OK - each case is being executed and selection moves in
correct directions. But when the cell is selected for editing and displays
cell editing field, everything stops working. Now arrow key movements move
the selection, but arrowKey ignores this. How to handle this correctly
(behavior of a stack in RevStudio 2.7.1) ?
 
Best wishes
Viktoras
_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: selection differences in table

viktoras d.
Additional info to the previous,
 
switch in the original is terminated by end switch. And the isue is same
with a tiny script like this:
on arrowKey
exit arrowKey
end arrowKey
 
once cell is selected but no editing field appears, it correctly ignores
arrow keys, but if cell editing field appears, it looks like it does not
catch arrowKey message and allows movement of the selection along with the
editing field with arrow keys. What I am doing wrong here?
 
Viktoras
 
 
 
-------Original Message-------
 
From: Viktoras Didziulis
Date: 09/09/06 14:20:20
To: How to use Revolution
Subject: selection differences in table
 
Dear all,
 
field "fTable" has a script (tables Cell editing is set to true):
on arrowKey theKey
switch theKey
case "up"
..
break
case "down"
..
break
case "left"
..
break
case "right"
..
break
end arrowkey
 
when table cell text is selected but does not display editing field,
everything works OK - each case is being executed and selection moves in
correct directions. But when the cell is selected for editing and displays
cell editing field, everything stops working. Now arrow key movements move
the selection, but arrowKey ignores this. How to handle this correctly
(behavior of a stack in RevStudio 2.7.1) ?
 
Best wishes
Viktoras
_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: translating a color name to RGB triplet

mwieder
In reply to this post by Stephen Barncard
Stephen-

Friday, September 8, 2006, 12:29:41 PM, you wrote:

> somewhere within the bowels of Rev must be a way to convert this directly.

>From Mark Waddingham earlier this year:

In terms of the colours themselves, then they come from the standard
X11 named colour table. One reference for this is at:

http://www.febooti.com/products/iezoom/online-help/html-color-names-x11-color-chart.html

You can access the full list from within Revolution by using the  
colorNames function.

--
-Mark Wieder
 [hidden email]

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
--
 Mark Wieder
 ahsoftware@gmail.com
Reply | Threaded
Open this post in threaded view
|

Re: translating a color name to RGB triplet

mwieder
In reply to this post by xtalkprogrammer
Mark-

Saturday, September 9, 2006, 2:54:15 AM, you wrote:

> This appears to work in the IDE:

> put revNumberToColor("249,232,210")

Interesting. I had no idea revNumberToColor() and revColorToNumber()
existed... I can see why they're not documented, though...

put revColorToNumber("squirrel")

returns "AliceBlue,239,247"

--
-Mark Wieder
 [hidden email]

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
--
 Mark Wieder
 ahsoftware@gmail.com
Reply | Threaded
Open this post in threaded view
|

Re: translating a color name to RGB triplet

Stephen Barncard
In reply to this post by mwieder
Somehow the thread has been lost.

The colornames does not give a list of the color RGB triad, just the
names themselves. In the user-accessible, documented Rev world, there
is no way shown to CONVERT from color name to RGB triad and
vice-versa. This is what I was looking for.

Mark Schonewille's suggestion of using revNumbertoColor() appears to
be the hidden function to do this. It needs to be tested to see if it
works in a standalone. Otherwise, one might have to dig into a revLib.

Grabbing the X11 list (with decimal RGB triad), putting it into a
custom property, turning it into an array, and using it to
cross-reference is really a workaround, reinventing the wheel, as I
knew using other commands in Rev that used this conversion lived
somewhere in REV.

This method is covered well in earlier posts by Eric Chatonet:

>About colours convert functions you could have a look at this post:
>http://lists.runrev.com/pipermail/use-revolution/2005-May/058259.html
>The list of the color names/RGB values are here:
>Part1:
>http://article.gmane.org/gmane.comp.ide.revolution.user/58156/match=color+names+chatonet
>Part2:
>http://article.gmane.org/gmane.comp.ide.revolution.user/58157/match=color+names+chatonet


>Stephen-
>
>Friday, September 8, 2006, 12:29:41 PM, you wrote:
>
>>  somewhere within the bowels of Rev must be a way to convert this directly.
>
>>From Mark Waddingham earlier this year:
>
>In terms of the colours themselves, then they come from the standard
>X11 named colour table. One reference for this is at:
>
>http://www.febooti.com/products/iezoom/online-help/html-color-names-x11-color-chart.html
>
>You can access the full list from within Revolution by using the
>colorNames function.
>
>--
>-Mark Wieder

--
stephen barncard
s a n  f r a n c i s c o
- - -  - - - - - - - - -
_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: translating a color name to RGB triplet

Stephen Barncard
In reply to this post by mwieder
Ok, test done.

These internal functions don't even agree with each other. AND they
don't show up in a standalone.  Many of the color names don't come
back the same.

Verdict: Use the colornames for official names, but make up your own
array or conversion table for any translation, i.e. the Eric Chatonet
method. The internal calls are not reliable. I wouldn't bother with
trying to pull it from rev libraries. The array method will also
return empty if the color name isn't found, not a guess.

note the discrepancies below:

Name from
colornames(),revColorToNumber(colorname),revNumberToColor(RGBtriad
from revColorToNumber)

Aquamarine3 = 102,205,170 = MediumAquamarine
Azure1 = 239,255,255 = Azure
Chartreuse1 = 127,255,0 = Chartreuse
Chocolate4 = 126,49,23 = SaddleBrown
Coral1 = 247,101,65 = Coral
CornSilk1 = 255,247,215 = CornSilk
DarkOrange1 = 248,114,23 = Chocolate1
DarkOrange2 = 229,103,23 = Chocolate2
DarkOrange3 = 195,86,23 = Chocolate3
DarkOrange4 = 126,49,23 = SaddleBrown
DarkSalmon = 225,139,107 = Salmon
Firebrick3 = 193,27,23 = Red3
Firebrick4 = 126,5,23 = Brown4
Gray0 = 0,0,0 = Black
Gray1 = 21,5,23 = Transparent
Gray10 = 21,5,23 = Transparent
Gray100 = 255,255,255 = White
Gray11 = 21,5,23 = Transparent
Gray12 = 21,5,23 = Transparent
Gray13 = 21,5,23 = Transparent
Gray14 = 21,5,23 = Transparent
Gray15 = 21,5,23 = Transparent
Gray16 = 21,5,23 = Transparent
Gray17 = 21,5,23 = Transparent
Gray19 = 37,5,23 = Gray18
Gray2 = 21,5,23 = Transparent
Gray20 = 37,5,23 = Gray18
Gray22 = 43,27,23 = Gray21
Gray3 = 21,5,23 = Transparent
Gray33 = 70,62,65 = DimGray
Gray66 = 160,159,157 = LightGray
Gray9 = 21,5,23 = Transparent
Gray96 = 244,244,243 = WhiteSmoke
IndianRed4 = 126,34,23 = Tomato4
Ivory1 = 255,255,238 = Ivory
LightCyan1 = 224,255,255 = LightCyan
Magenta4 = 125,27,126 = DarkOrchid
NavyBlue = 0,0,128 = Navy
OrangeRed4 = 126,5,23 = Brown4
PaleGreen2 = 144,238,144 = LightGreen
Red4 = 126,5,23 = Brown4
SeaGreen4 = 46,139,87 = SeaGreen
Tan3 = 197,119,38 = Peru
Tan4 = 127,72,23 = Orange4
Yellow1 = 255,255,0 = Yellow

sqb

>Mark-
>
>Saturday, September 9, 2006, 2:54:15 AM, you wrote:
>
>>  This appears to work in the IDE:
>
>>  put revNumberToColor("249,232,210")
>
>Interesting. I had no idea revNumberToColor() and revColorToNumber()
>existed... I can see why they're not documented, though...
>
>put revColorToNumber("squirrel")
>
>returns "AliceBlue,239,247"
>
>--
>-Mark Wieder
>  [hidden email]

--
stephen barncard
s a n  f r a n c i s c o
- - -  - - - - - - - - -
_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: translating a color name to RGB triplet

Ken Ray
In reply to this post by Stephen Barncard
On 9/9/06 12:34 PM, "Stephen Barncard" <[hidden email]>
wrote:

> Somehow the thread has been lost.
>
> The colornames does not give a list of the color RGB triad, just the
> names themselves. In the user-accessible, documented Rev world, there
> is no way shown to CONVERT from color name to RGB triad and
> vice-versa. This is what I was looking for.

Actually there is one that is documented (per se), that I suggested earlier,
but it is not "user-accessible" (meaning you can't search for 'convert color
name to RGB' in the Rev docs and find it):

You need to have a graphic object (like a square) and then execute this (I
called my graphic "ColorHolder"):

function getRGB pColorName
      put the long id of grc "ColorHolder" into tObj
      set the backColor of tObj to pColorName
      set the backPixel of tObj to (the effective backPixel of tObj)
      return (the backColor of tObj)
end getRGB

Basically if you set the color of a graphic object to the color name, you
can then retrieve the color value of the color.

Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: [hidden email]

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: remove html tags from text

Brian Yennie
In reply to this post by masmit
FWIW:

http://www.amk.ca/python/howto/regex/

Check out section 6.3, which presents the same regex that Ken  
suggested. Also not the parenthetical statement, which I've come  
across in so many words before. Basically, if you want industrial  
strength HTML tag processing, you should really consider an actual  
parser and not a single expression. For most purposes, RegEx is  
probably fine:

"(Note that parsing HTML or XML with regular expressions is painful.  
Quick-and-dirty patterns will handle common cases, but HTML and XML  
have special cases that will break the obvious regular expression; by  
the time you've written a regular expression that handles all of the  
possible cases, the patterns will be very complicated. Use an HTML or  
XML parser module for such tasks.)"

- Brian


_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: remove html tags from text

Richard Gaskin
In reply to this post by paolo mazza-2
Brian Yennie wrote:
> Check out section 6.3, which presents the same regex that Ken  
> suggested. Also not the parenthetical statement, which I've come  
> across in so many words before. Basically, if you want industrial  
> strength HTML tag processing, you should really consider an actual  
> parser and not a single expression.

So I have two questions about this sort of parsing as opposed to using a
field object to so the same:

1. Which is more fault-tolerant?

2. Which is faster?


--
  Richard Gaskin
  Managing Editor, revJournal
  _______________________________________________________
  Rev tips, tutorials and more: http://www.revJournal.com
_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: remove html tags from text

Ken Ray
On 9/10/06 12:06 AM, "Richard Gaskin" <[hidden email]> wrote:

> So I have two questions about this sort of parsing as opposed to using a
> field object to so the same:
>
> 1. Which is more fault-tolerant?

Good question - one problem with the field object that was identified by
Sivakatirswami back in August with this was that if you have an html tag
with <title> in it (like: <title>Chapter 1: Great Revolution
Recipes</title>), when you set the htmlText of the field to the html that
contains the <title>, everything that is in the <title> tag doesn't show up
in the field, and can't be retrieved ever again.

Granted, I'm sure there are only a few situations like this, and are not
likely to affect 99% of us, but I think the replaceText solution is at about
the same level of efficiency.
 
> 2. Which is faster?

The field approach, hands down. This is because any regex that needs to run
needs to be handled by the PCRE library so there's more "hand off" time
involved.

Just my 2 cents,

Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: [hidden email]

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: remove html tags from text

Richard Gaskin
In reply to this post by paolo mazza-2

Ken Ray wrote:

>> So I have two questions about this sort of parsing as opposed to using a
>> field object to so the same:
>>
>> 1. Which is more fault-tolerant?
>
> Good question - one problem with the field object that was identified by
> Sivakatirswami back in August with this was that if you have an html tag
> with <title> in it (like: <title>Chapter 1: Great Revolution
> Recipes</title>), when you set the htmlText of the field to the html that
> contains the <title>, everything that is in the <title> tag doesn't show up
> in the field, and can't be retrieved ever again.

As a HEAD element and not a BODY element, should <title> be considered
data or metadata?  After all, <title> is only used by the browser to set
the window name, and the contents of that tag are not rendered in the
page.  In this regard Rev does the same:  it doesn't render <title>
content in the field, but if you want to process the HEAD data before
passing the BODY into the field for rendering you can handle <title>
just like a browser does.


> Granted, I'm sure there are only a few situations like this, and are not
> likely to affect 99% of us, but I think the replaceText solution is at about
> the same level of efficiency.

How does the regex solution hold up to things like "<" and ">" within
"<code>" tags as Jacque noted, or other legitimate incusions of those or
other characters which are also used as control characters in SGML?


>> 2. Which is faster?
>
> The field approach, hands down. This is because any regex that needs to run
> needs to be handled by the PCRE library so there's more "hand off" time
> involved.

Yes, the generalization of regex makes it convenient but I've never seen
any case where a faster solution couldn't be crafted from the offset
function and the like.

So until someone can demonstrate otherwise, I'm sticking with using
fields to strip tags from text.....

--
  Richard Gaskin
  Managing Editor, revJournal
  _______________________________________________________
  Rev tips, tutorials and more: http://www.revJournal.com
_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: remove html tags from text

masmit

On 10 Sep 2006, at 16:26, Richard Gaskin wrote:

> So until someone can demonstrate otherwise, I'm sticking with using  
> fields to strip tags from text.....


Though doesn't this approach fail with legitimate "<" characters in  
<code>  (or other) tags?

Of course, that may not be important in your usage.


Best,

Mark
_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: remove html tags from text

Richard Gaskin
In reply to this post by paolo mazza-2
Mark Smith wrote:
> On 10 Sep 2006, at 16:26, Richard Gaskin wrote:
>
>> So until someone can demonstrate otherwise, I'm sticking with using  
>> fields to strip tags from text.....
>
> Though doesn't this approach fail with legitimate "<" characters in  
> <code>  (or other) tags?
>
> Of course, that may not be important in your usage.

It's very important for most of us, since we're looking for the most
robust solution.

I just tried it and found that this:

<pre>
put 2<3
</pre>

...produces an incomplete rendering like this:

   put 2

...but this:

<pre>
put 2< 3
</pre>

...is rendered as expected like this:

put 2< 3


I would imagine similar results if we special-case the regex solution to
also handle non-white space after a "<".

If both methods are equally robust then the one to use would be the
fastest.  But if one of more fault-tolerant than the other, than if the
speed of both is at least acceptable than I'd go with the more robust one.

--
  Richard Gaskin
  Managing Editor, revJournal
  _______________________________________________________
  Rev tips, tutorials and more: http://www.revJournal.com
_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: remove html tags from text

Jim Ault
Richard,

Is the white space a " " in the html, or a &nbsp; that appears to be a
space?
> <pre>
> put 2<3  |   put 2< 3    |   put 2<&nbsp;3
> </pre>


Jim Ault
Las Vagas


On 9/10/06 10:55 AM, "Richard Gaskin" <[hidden email]> wrote:

> Mark Smith wrote:
>> On 10 Sep 2006, at 16:26, Richard Gaskin wrote:
>>
>>> So until someone can demonstrate otherwise, I'm sticking with using
>>> fields to strip tags from text.....
>>
>> Though doesn't this approach fail with legitimate "<" characters in
>> <code>  (or other) tags?
>>
>> Of course, that may not be important in your usage.
>
> It's very important for most of us, since we're looking for the most
> robust solution.
>
> I just tried it and found that this:
>
> <pre>
> put 2<3
> </pre>
>
> ...produces an incomplete rendering like this:
>
>    put 2
>
> ...but this:
>
> <pre>
> put 2< 3
> </pre>
>
> ...is rendered as expected like this:
>
> put 2< 3
>
>
> I would imagine similar results if we special-case the regex solution to
> also handle non-white space after a "<".
>
> If both methods are equally robust then the one to use would be the
> fastest.  But if one of more fault-tolerant than the other, than if the
> speed of both is at least acceptable than I'd go with the more robust one.


_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: remove html tags from text

Jim Ault
In reply to this post by Richard Gaskin
By the way, which tags are used makes a big difference.

Table tags are used frequently for layout.  Notice the difference below

Depending on the tags used, html considers a run of spaces as one space, but
a parser has to accommodate the difference.  This means that the source can
have extra characters and still look the same to the viewer.

----- paste into your favorite word processor, save as something.html, then
---- open in a browser

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Untitled</title>
    <meta name="generator" content="BBEdit 8.2" />
</head>
<body>
<pre>
 put 2< 3
 put 2<      3
 put 2<           3
 </pre>
 <table>
    <tr>
        <td>
             put 2< 3
        </td>
            <td>
                  second 2 <      3
        </td>
        <td>
                 third    2  <           3
        </td>
    </tr>
</table>
</body>
</html>


Ahh, the wonderful world of browsers and html.

Jim Ault
Las Vegas

On 9/10/06 10:55 AM, "Richard Gaskin" <[hidden email]> wrote:

> Mark Smith wrote:
>> On 10 Sep 2006, at 16:26, Richard Gaskin wrote:
>>
>>> So until someone can demonstrate otherwise, I'm sticking with using
>>> fields to strip tags from text.....
>>
>> Though doesn't this approach fail with legitimate "<" characters in
>> <code>  (or other) tags?
>>
>> Of course, that may not be important in your usage.
>
> It's very important for most of us, since we're looking for the most
> robust solution.
>
> I just tried it and found that this:
>
> <pre>
> put 2<3
> </pre>
>
> ...produces an incomplete rendering like this:
>
>    put 2
>
> ...but this:
>
> <pre>
> put 2< 3
> </pre>
>
> ...is rendered as expected like this:
>
> put 2< 3
>
>
> I would imagine similar results if we special-case the regex solution to
> also handle non-white space after a "<".
>
> If both methods are equally robust then the one to use would be the
> fastest.  But if one of more fault-tolerant than the other, than if the
> speed of both is at least acceptable than I'd go with the more robust one.
>
> --
>   Richard Gaskin
>   Managing Editor, revJournal
>   _______________________________________________________
>   Rev tips, tutorials and more: http://www.revJournal.com
> _______________________________________________
> use-revolution mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution


_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: translating a color name to RGB triplet

Chipp Walters
In reply to this post by Ken Ray
Ken,
I took care to notice that gem of scripting the first time you
mentioned it. It also has the benefit of being able to reconcile new
colornames (if Rev ever adds them).

-Chipp
_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
12