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

Regarding tags

 [1/2] from: chalz:earthlink at: 1-Aug-2002 23:04


Hey! Yet another question from me :) How about this one. I have a tag, for instance:
>> imgtag: <IMG SRC="../somedir/someimage.jpg">
To break it into its constituent parts, I do:
>> imgtag: parse imgtag {"}
== ["IMG" "SRC=" "../something/someimage.jpg"] So I change imgtag/3 to something else, and I wish to rebuild the tag and reinsert it into the source code. However:
>> build-tag imgtag
== <IMG="SRC="="someimage.jpg"> So, uhh.. Seeing as how I'm such an ultranovice and all... now what? Or... let me guess... There's a better way, using parse, to extract the image's path (so I can append it to the URL for reading) and allow me to modify it without breaking the tag up so, right? :( The emphasis here is the ability to get the image's path so I can append it to a URL, and when I'm done, alter the image's path and save the new <IMG SRC= tag back into the source. Right now I'm being excessively ugly:
>> imgtag: to-tag rejoin [imgtag/1 " " imgtag/2 {"} imgtag/3 {"}]
== <IMG SRC="someimage.jpg"> *sighs* I have a lot to learn... and that is why I'm doing this. *smirk* Thanks everyone. --Charles

 [2/2] from: greggirwin:mindspring at: 2-Aug-2002 9:54


Hi Charles, << The emphasis here is the ability to get the image's path so I can append it to a URL, and when I'm done, alter the image's path and save the new <IMG SRC= tag back into the source. >> I haven't done much with tags myself, but there are often times where it just isn't as easy as you think it should be to modify data while preserving original formatting. Here I use the /ALL refinement on parse and MOLD to try and simplify things.
>> imgtag: <IMG SRC="../somedir/someimage.jpg">
== <IMG SRC="../somedir/someimage.jpg">
>> parse/all imgtag {"}
== ["IMG SRC=" "../somedir/someimage.jpg"]
>> b/2: "../somedir/newimg.jpg"
== ["IMG SRC=" "../somedir/newimg.jpg"]
>> to tag! join b/1 mold b/2
== <IMG SRC="../somedir/newimg.jpg"> --Gregg