Wednesday, May 07, 2003

There's lots of talk about a weblog allegedly written by a very wealthy heiress on the run. I first saw mention of it over at memepool and now is running a story about it, too.

Hoax or not, it's a story that has me hooked. I tried reading in backwards order, but it isn't easy. So, for those, like me, who joined the story late, here's some help.

The following tcl script will reverse the order of the entries. Copy the HTML of the main content (i.e. not the menu bar, not the title bars) into a file. Edit the script to find your saved file and run it. Don't expect tech support.


    set input_file "flight-risk.html"
    set output_file "out.html"
    set open_tag "<blockquote>"
    set close_tag "</blockquote>"

    set ip [open $input_file]
    set input [read $ip]
    close $ip

    set index 0
    set length [string length $input]
    set quote_count 0
    puts "starting... length is $length"

    set outl [list]

    while {$index < $length && \
               [set this_one [string first $open_tag $input $index]] != -1} {
        set this_one [expr $this_one + [string length $open_tag]]
        set this_end [string first $close_tag $input $this_one]
        set this_end [expr $this_end - 1]

        incr quote_count
        set index [expr $this_end + [string length $close_tag]]

        set this_chunk [string range $input $this_one $this_end]
        append this_chunk "\n"
        set outl [linsert $outl 0 $this_chunk]

    puts "found $quote_count total"

    set op [open $output_file "w"]
    foreach chunk $outl {
        puts $op $chunk
    close $op
Now you can print and read at your leisure.

No comments: