Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Re, Re: Parse problem

From: Patrick::Philipot::laposte::net at: 9-Oct-2005 11:14

Hi List, Previouly on "Parse problem" The problem was to found how to replace any URL found in a text by a valid HTML link <a href= ...>. You will find the complete answer in the following. However a second problem arised with to-block.
>> to-block "(foo"
** Syntax Error: Missing ) at end-of-script ** Near: (line 1) (foo It seems like a bug to me. My workaround is to catch the error to remove the "faulty" text from evaluation. Here is my code, if it may be of some interest ... ; pat665 handling URL link directly in the text ; ; ; transform-url: func [s [string!]] [ ; replace any URL found by a valid HTML link <a href= ...> bs: parse s none remove-each w bs [error? try [to-block w]] remove-each w bs [not parse to-block w [url!]] bs: unique bs foreach w bs [ replace/all find s w w rejoin [{<a href="} w {">} w {</a>}] ] s ] ; ; ; -- Ciao Patrick