[REBOL] It's Mine Now 1.1
From: depotcity::home::com at: 10-Mar-2001 12:06
Here's a simple script that checks for the <base href=> tag (thanks Renaud) and creates
one if not found.
I tried to make this a function, but the function input (the-url) choked and said it
wasn't a url? Any takers?
Terry Brownell
[tbrownell--yahoo--com]
www.lfred.com
REBOL [
Title: "It's Mine Now 1.1"
Date: 10-Mar-2001
Author: Terry Brownell
File: %pathmaker.r
Purpose: {To set relative paths to complete URL's in
Rebol read HTML for archiving purposes.}
Category: [web related]
]
the-url: to-url ask "What domain?: "
the-doc: read the-url
parse the-doc [thru "<head>" copy the-header to "</head>"]
if not found? find the-header {<base href="}[add-base: rejoin [{<base href="} the-site
{">}]insert find the-doc "</head>" add-base]
; An example.. the following line will replace a occurences of the word "the" with a
link to my agent LFReD (cheap plug)
replace/all the-doc "the " {<a href="http://www.lfred.com"> LFReD </a>}
; Print or save the doc
;print the-doc
;write %its-mine-demo.htm the-doc