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

[REBOL] Re: html

From: john_kenyon:mlc:au at: 8-Jan-2002 17:59

Greg,
>No speed problem with upper/lower case, but it is always better to have >links, tags in lower case. >This is because you may move the web site from Windows to Unix and all
your
>links may break because some are upper and some are lower.
Very true - hence the following code snippet I used to go from Domino NT to AIX. (Has the nice side effect of converting the end of line chars too) Uses the recurse-files script by Bo http://www.rebol.org/file/recursive-dir.r cheers, John REBOL [ ] ; (very old bad code but functional) source-dir: %/home/xxx/temp/html/ all-files: recursive-files source-dir html-files: copy [] foreach file all-files [ if find to-string file ".htm" [ insert html-files file ] ] ; Firsly the html files foreach file html-files [ print file file-contents: read file parse file-contents [ any [ thru {src="} mark: copy file-name :mark to {"} (if string? file-name [ change mark lowercase file-name ]) ] any [ thru {img="} mark: copy file-name :mark to {"} (if string? file-name [ change mark lowercase file-name ]) ] ] write file file-contents ] ; now lowercase all of the file names foreach file all-files [ print file if not strict-equal? to-string file lowercase to-string file [ rename file to-file lowercase to-string file ] ]