all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: TheFlyingDutchman <zzbbaadd@aol.com>
To: help-gnu-emacs@gnu.org
Subject: Re: yow
Date: Fri, 24 Oct 2008 00:53:06 -0700 (PDT)	[thread overview]
Message-ID: <ebac3fc2-2f58-4254-a2e7-d788282efb6b@v56g2000hsf.googlegroups.com> (raw)
In-Reply-To: 871vy6n8uv.fsf@nonospaz.fatphil.org


>
> Eeep, I just did a wget of that file, and now it's worse:

I don't know Emacs Lisp so I wrote this little program in Python to
convert the HTML from that page into an Emacs yow.lines. You have to
save the page into a text file with Internet Explorer (not Firefox)
and then run this program to produce yow.lines.
__________________________________________________________________________________________________________________________

# convert  HTML page source representing "yow.lines" to an Emacs
usable format
# --------------------------------------------------------------
# save (File-Save As...)
# http://olympus.het.brown.edu/cgi-bin/dwww?type=file&location=/usr/share/doc/emacs21-common/etc/yow.lines
# to a html or text file using Internet Explorer 6 (not Firefox which
requires slightly different processing for
# what it saves)
# Use that file as input to this program. This program will output a
file called yow.lines.
# Copy yow.lines to the directory referenced in the Emacs variable ->
data-directory <- . (eg: "c:/Program Files/Emacs/etc")
import sys
import os

if __name__ == "__main__":

    if  len(sys.argv) == 1:
        print "ERROR: You must input the name of the file to convert
to yow.lines"
        exit(1)
    if os.path.exists(sys.argv[1]):
        f_input = open( sys.argv[1] )
        f_output = open( "yow.lines",'w')
    else:
        print "ERROR: File " + sys.argv[1] + " not found"
        exit(2)
    print "will convert html page source to usable yow.lines"
    dataHit = False
    finished = False
    f_output.write("Zippy the pinhead data base.\n")
    for line in f_input.readlines():
        if line[0] != '<' and not finished:
            outputLine = line.rstrip("\n\r")
            outputLine = outputLine.replace("&amp;","&")
            if outputLine.startswith("A can of ASPARAGUS"):
                dataHit = True
                f_output.write( chr(0) + "\n")
            if len(outputLine) > 0:
                lastChar = outputLine[-1]
                if lastChar in ['!', '?', '.'] and dataHit:
                    outputLine = outputLine + chr(0) + "\n"
                else:
                    outputLine = outputLine + "\n"
                f_output.write(outputLine)
            if outputLine.startswith("Zippy's brain cells are
straining to bridge synapses..."):
                finished = True
    f_input.close()
    f_output.close()
    print "program %s ended successfully" % (sys.argv[0])


  parent reply	other threads:[~2008-10-24  7:53 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-23 22:26 yow Phil Carmody
2008-10-23 23:53 ` yow TheFlyingDutchman
2008-10-23 23:58   ` yow TheFlyingDutchman
2008-10-24  0:18   ` yow Phil Carmody
2008-10-24  0:41     ` yow TheFlyingDutchman
2008-10-24  7:53     ` TheFlyingDutchman [this message]
2008-10-24  8:10       ` yow TheFlyingDutchman
2008-10-24  0:20 ` yow Drew Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ebac3fc2-2f58-4254-a2e7-d788282efb6b@v56g2000hsf.googlegroups.com \
    --to=zzbbaadd@aol.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.