Foster is the xstring export so I'll let him answer - I suspect we're =20=
missing an API (I'd rather not have to go through a context for =20
replacement) - but I think you should be able to simply create a =20
local context as a workaround. I believe you also want to be using =20
the marker mechanism for the replacement (Foster?).
For the xstring_sub function call - I don't think you are getting any =20=
benefit by referring to cells by a quoted name then looking it up =20
manually - you can simply use the cell as a variable name. I'd =20
recommend making it a function taking named parameters -
xstring_replace(string: "<xstr id=3D'string'><marker id=3D'text'/> the =20=
number is <marker id=3D'num'/></xstr>",
text: val1, num: val2)
I spent some time looking at some Lua code this last week - I'm =20
considering unifying the function mechanism to take a =20
pair<dictionary_t, array_t> similar to a Lua table - This would let =20
you write:
xstring_replace("<xstr id=3D'string'><marker id=3D'text'/> the number is =
=20
<marker id=3D'num'/></xstr>",
text: val1, num: val2)
And would allow for a single API to plug-in functions. Thoughts?
Sean
On Feb 11, 2006, at 12:15 AM, Ralph Thomas wrote:
> Hi ASL,
>
> I'm trying to write a function to do xstring substitution, which
> should work something like this:
>
> sheet {
> interface:
> val1 : "hello world, " ;
> val2: 17 ;
> output:
> string <=3D=3D xstring_sub( "<xstring id=3D'text'/> the number is =
<xstring
> id=3D'num'/>", [{ name: "text", value: @val1 }, { name: "num", value:
> @val2 }] );
> };
>
> and have @string be "hello world, the number is 17". I can easily get
> the values that I need from the sheet, but how can I create an
> xstring_context_t that contains these values? Is there a way to put a
> value_t straight in there?
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc. Do you grep through =20
> log files
> for problems? Stop! Download the new AJAX search engine that makes
> searching your log files as easy as surfing the web. DOWNLOAD =20
> SPLUNK!
> http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=103432&bid#0486&dat=121642=
> _______________________________________________
> Adobe-source-devel mailing list
> Ado...@li...
> https://lists.sourceforge.net/lists/listinfo/adobe-source-devel
|