lynx-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

LYNX-DEV For the FAQ: semi-fix for toasted bookmarks


From: Filip M Gieszczykiewicz
Subject: LYNX-DEV For the FAQ: semi-fix for toasted bookmarks
Date: Wed, 1 Jan 1997 19:30:46 -0600 (CST)

Greetings. I was kicking around the idea of whipping up a little awk
script that would fix toasted (saving rendered version to source will
do that) bookmarks files using a little nifty call to altavista :-)

1) get the toasted file into some format like this:

<li><a href="http://www.lycos.com/";>http://www.lycos.com/</a>
<li><a href="">Teacher Link Lists</a>
[..]
<li><a href="">About today's date </a>

(don't bug me - this is what I got it into with a little script).

but just a list of the titles will work (you'll have to change some
things in the awk script, easy!)

2) run this awk script on it: (save to file, say, "bm.awk")

-----------------chop-with-axe----------------chop-with-axe---------------------
BEGIN {
print "<ol>"
}
#####################
{
a=1;
 if (index($0,"http") || index($0,"HTTP")) {
        printf("<li><a href=\"%s\">%s</a>\n",$4,$4)
        a=0;
 }
 if (index($0,"\"\"")) {
#li  a href="" Information about Project Gutenberg (one page) /a
#li  a href="" EdWeb /a

        words=0;
        for (i=4;i<=(NF-1);i++){
                pattern[words] = $i
                words++;
        }
        out(pattern);
        a=0;
 }
 if (a) {print $0}
 else { a=1;}
}

function out(pattern) {
printf("<li>[");
dump(pattern);
printf("]\n");
printf("<FORM method=GET 
action=\"http://www.altavista.digital.com/cgi-bin/query\";>\n");
printf("<INPUT TYPE=hidden NAME=pg VALUE=q><INPUT TYPE=hidden NAME=what 
VALUE=web>\n");
printf("<INPUT TYPE=hidden NAME=fmt VALUE=c>\n");
printf("<INPUT TYPE=hidden NAME=q size=55 maxlength=200 VALUE=\"");
dump(pattern);
printf("\">\n",pattern);
printf("<INPUT TYPE=submit VALUE=\"Submit\">\n");
printf("<INPUT TYPE=hidden NAME=text VALUE=yes></FORM>\n");
}

function dump(pattern) {
for (i=0;i<=words;i++)
        printf("%s ",pattern[i]);
}
-----------------chop-with-axe----------------chop-with-axe---------------------

3) run it as follows:

cat toasted.txt | tr "<>" " " | awk -f bm.awk > books.html

4) lynx "books.html" and see what it did:

(result of 3 same lines above):

-----------------chop-with-axe----------------chop-with-axe---------------------
<ol>
<li><a href="http://www.lycos.com/";>http://www.lycos.com/</a>
<li>[Teacher Link Lists  ]
<FORM method=GET action="http://www.altavista.digital.com/cgi-bin/query";>
<INPUT TYPE=hidden NAME=pg VALUE=q><INPUT TYPE=hidden NAME=what VALUE=web>
<INPUT TYPE=hidden NAME=fmt VALUE=c>
<INPUT TYPE=hidden NAME=q size=55 maxlength=200 VALUE="Teacher Link Lists  ">
<INPUT TYPE=submit VALUE="Submit">
<INPUT TYPE=hidden NAME=text VALUE=yes></FORM>
<li>[About today's date  ]
<FORM method=GET action="http://www.altavista.digital.com/cgi-bin/query";>
<INPUT TYPE=hidden NAME=pg VALUE=q><INPUT TYPE=hidden NAME=what VALUE=web>
<INPUT TYPE=hidden NAME=fmt VALUE=c>
<INPUT TYPE=hidden NAME=q size=55 maxlength=200 VALUE="About today's date  ">
<INPUT TYPE=submit VALUE="Submit">
<INPUT TYPE=hidden NAME=text VALUE=yes></FORM>
-----------------chop-with-axe----------------chop-with-axe---------------------

Tada! [bow bow bow]

5) just add some header to the top and move the file to your bookmarks.
Just, uhm, don't try to remove any of the "kludged" bookmarks above
with the "r" command inside lynx. I wash my hands of what MIGHT happen ;-)

6) Any criticizm will be met with "oh, yeah, gotta better way?!?! No?
Then SHUDDUP!"

;-) ;-)

Take care.
;
; To UNSUBSCRIBE:  Send a mail message to address@hidden
;                  with "unsubscribe lynx-dev" (without the
;                  quotation marks) on a line by itself.
;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]