From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: TheFlyingDutchman Newsgroups: gmane.emacs.help Subject: Re: yow Date: Fri, 24 Oct 2008 00:53:06 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: <87abcvlzhe.fsf@nonospaz.fatphil.org> <588e63d3-52d3-4d9a-8726-07b85aaed7bd@m32g2000hsf.googlegroups.com> <871vy6n8uv.fsf@nonospaz.fatphil.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1224837787 21201 80.91.229.12 (24 Oct 2008 08:43:07 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 24 Oct 2008 08:43:07 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Oct 24 10:44:08 2008 connect(): Connection refused Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KtIH9-0002wc-6Z for geh-help-gnu-emacs@m.gmane.org; Fri, 24 Oct 2008 10:44:07 +0200 Original-Received: from localhost ([127.0.0.1]:37058 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KtIG3-0007x4-GB for geh-help-gnu-emacs@m.gmane.org; Fri, 24 Oct 2008 04:42:59 -0400 Original-Path: news.stanford.edu!newsfeed.stanford.edu!postnews.google.com!v56g2000hsf.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 61 Original-NNTP-Posting-Host: 192.91.147.35 Original-X-Trace: posting.google.com 1224834787 25017 127.0.0.1 (24 Oct 2008 07:53:07 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Fri, 24 Oct 2008 07:53:07 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: v56g2000hsf.googlegroups.com; posting-host=192.91.147.35; posting-account=9bWHAAoAAAAxSFC_2O_ssTETNW9NhMbW User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3,gzip(gfe),gzip(gfe) Original-Xref: news.stanford.edu gnu.emacs.help:163772 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:59115 Archived-At: > > 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("&","&") 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])