Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #36514
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <yacinechaouche@yahoo.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.001 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'output': 0.04; 'modify': 0.05; 'subject:How': 0.09; '"%s"': 0.09; '(it': 0.09; 'formatted': 0.09; 'indeed,': 0.09; 'rows': 0.09; 'script,': 0.09; 'snippet': 0.09; 'subject:script': 0.09; 'worked.': 0.09; 'def': 0.10; ';-)': 0.11; 'kurt': 0.11; '12:04': 0.16; 'bind': 0.16; 'binding.': 0.16; 'columns': 0.16; 'item)': 0.16; 'script?': 0.16; 'snippets': 0.16; 'tool.': 0.16; 'url:records': 0.16; 'to:name:python- list@python.org': 0.20; '(on': 0.22; 'skip:$ 20': 0.22; 'wednesday,': 0.22; '>': 0.23; 'to:2**1': 0.23; "i've": 0.23; 'header:In-Reply-To:1': 0.25; 'select': 0.26; 'skip:" 20': 0.26; '(see': 0.27; 'lines': 0.28; 'behavior.': 0.29; 'key,': 0.29; 'url:mailman': 0.29; 'maybe': 0.29; 'worked': 0.30; 'code': 0.31; 'url:python': 0.32; 'mac': 0.32; 'running': 0.32; 'skip:_ 30': 0.32; 'url:listinfo': 0.32; 'quotes': 0.33; 'traceback': 0.33; 'to:addr:python-list': 0.33; 'text': 0.34; 'reply- to:addr:yahoo.com': 0.34; 'doing': 0.35; 'table': 0.35; 'subject:?': 0.35; 'subject:': 0.36; 'but': 0.36; 'url:org': 0.36; 'email addr:python.org': 0.36; 'item': 0.37; 'sent:': 0.37; 'data': 0.37; 'subject:: ': 0.38; 'from:': 0.38; 'skip:l 20': 0.38; 'shows': 0.38; 'to:addr:python.org': 0.39; 'where': 0.40; 'skip:" 10': 0.40; 'url:mail': 0.40; 'your': 0.60; 'link': 0.60; 'email name:python-list': 0.62; 'safe': 0.63; '14.': 0.65; 'due': 0.66; 'header:Reply-To:1': 0.68; 'online': 0.70; 'subject:this': 0.84; '2013': 0.84; 'pasting': 0.84; 'url:dk': 0.84; 'realistic': 0.93 |
| X-Yahoo-Newman-Property | ymail-3 |
| X-Yahoo-Newman-Id | 228513.21141.bm@omp1034.mail.ne1.yahoo.com |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1357755945; bh=M070e+qAiOYXZOpctGlMqRYW517Ys3u1w/AleQnBCd0=; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:In-Reply-To:MIME-Version:Content-Type; b=1dMn6kYzGs4iq1Hk8bxLpnebPr7yo8NY/VaSZxUKGBxkGCLFQcRvTJKK6/LJKFHsqnwtJXxiGBNBOcHF6NINtTOxfGNNqduBBSW2KFSQitkNTL3QGO9gCY+ivz6wLdLngfcMBT0FNiRZLzKHbFdnKs0aSnt/ClJFxQfypcxh9Q8= |
| DomainKey-Signature | a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:In-Reply-To:MIME-Version:Content-Type; b=Da5CSdA72ppqmGDn62Om41caX+TYB1OigWEg3wc+pPlReL+T+qB2DI0Z5hnUY4MKIInsFjn1u6kcsngMrCjl2auwmFJmXZkEn5K74+KM/R3bEbUuNWJMrDlhQ82QJU4GpcEHVWxqKNpy92uTaph/onrmR47aYgGXKDpVn9lGHxQ=; |
| X-YMail-OSG | eo_Fec0VM1k6KYXfo_HPQBpudc_fshpfip0JddMTDwiw9EJ 3aA7nmKHuPB1FUYn1UGcmj.4mB_O0zynC_B_wLHWiU0QRR043ht7DOr.PfVv R7vdPPzD2ektQRzohuD7R7XRAZbzf3Ri4gzz11HpCazTla4J5cSJeCIvGbBM S9x1W6W00QYOYzN86La2KYgnB1s4XAo2CvhJN.NAqPeZfdS0C_kHrkj46pLQ bNdb9nf9zSuJAcJboTtDN30x2RWeVpKH6DgX54DhVOUfCc9nQsFwcQV5_agm 9b01J8fhixk.Dt9cc..n1nLSUgfJJd_rx9Q4DLbkjMVziKXO.NtShjRNkuLd 81efQ3rJgI2JXCmUCcAVnqosIUIf4budPVrqf.jWeZDjzQQNGp0xNdVCt5DM CmjYzVs_pRZteLx4pU7WoNqPnGdGM7ehPu.mIRNNUmTiSjrKrswBSo96MbsU ApeK9opX6oK8nT10u53gviLMYDh4Qt_BLVMHPnbkKvFlWs.oofsG7GflhW_2 NYOj4_lLw_237trWPt8bPb1OZuP5ZEehm77v4N9NqhkHmby11VfmnES_uySG Q6ynA3NNPlXiF0ohzO8WVRCALFQUjr3Fs1ReTp1Y5ndsKso0MJTxhaiH4bgu KCMkimeY- |
| X-Rocket-MIMEInfo | 001.001, SW5kZWVkLCB0aGUgY29uc29sZSBzaG93cyBhIHRyYWNlYmFjayB3aGVyZSBkYXRhIGlzIG1pc2ludGVycHJldGVkLCBtYXliZSBkdWUgdG8gbXkgdHJpcGxlIHByb3RlY3RpdmUgcXVvdGVzIGFyb3VuZCAkR0VESVRfU0VMRUNURURfVEVYVC4gVHJ5IHdpdGhvdXQgdGhlbSwgbGlrZSBzbyAoaXQgd29ya2VkIGZvciBtZSkgOiAKCiQ8CmRlZiBhZGRsaW5lKGxpbmUpOgrCoMKgwqAgcmV0dXJuICI8dHJcPiVzPC90clw.XG4iICUgbGluZQoKZGVmIGFkZGNvbHVtbihpdGVtLG5iX2NvbHVtbnMpOgrCoMKgwqAgaWYBMAEBAQE- |
| X-Mailer | YahooMailWebService/0.8.130.494 |
| References | <50e97123$0$294$14726298@news.sunsite.dk> <mailman.161.1357477260.2939.python-list@python.org> <50e97e4c$0$294$14726298@news.sunsite.dk> <mailman.168.1357481051.2939.python-list@python.org> <50e9885e$0$294$14726298@news.sunsite.dk> <mailman.173.1357485172.2939.python-list@python.org> <50eafb00$0$287$14726298@news.sunsite.dk> <mailman.280.1357659111.2939.python-list@python.org> <50ed336f$0$284$14726298@news.sunsite.dk> <mailman.310.1357726998.2939.python-list@python.org> <50ed4eaf$0$284$14726298@news.sunsite.dk> |
| Date | Wed, 9 Jan 2013 10:25:45 -0800 (PST) |
| From | chaouche yacine <yacinechaouche@yahoo.com> |
| Subject | Re: How to modify this script? |
| To | Kurt Hansen <kurt@ugyldig.invalid>, "python-list@python.org" <python-list@python.org> |
| In-Reply-To | <50ed4eaf$0$284$14726298@news.sunsite.dk> |
| MIME-Version | 1.0 |
| Content-Type | multipart/alternative; boundary="318864283-1556366751-1357755945=:50400" |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| Reply-To | chaouche yacine <yacinechaouche@yahoo.com> |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.333.1357756068.2939.python-list@python.org> (permalink) |
| Lines | 83 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1357756068 news.xs4all.nl 6867 [2001:888:2000:d::a6]:36343 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:36514 |
Show key headers only | View raw
[Multipart message — attachments visible in raw view] - view raw
Indeed, the console shows a traceback where data is misinterpreted, maybe due to my triple protective quotes around $GEDIT_SELECTED_TEXT. Try without them, like so (it worked for me) :
$<
def addline(line):
return "<tr\>%s</tr\>\n" % line
def addcolumn(item,nb_columns):
if nb_columns != 3:
return "<td colspan='%s'\>%s</td\>" % (3 - nb_columns + 1, item)
return "<td\>%s</td\>" % item
output = "<table\>\n"
selected_text = $GEDIT_SELECTED_TEXT
for line in selected_text.split("\n"):
items = line.strip().split("\t")
columns = ""
for item in items :
columns += addcolumn(item,len(items))
output += addline(columns)
output += "</table\>"
return output>
________________________________
From: Kurt Hansen <kurt@ugyldig.invalid>
To: python-list@python.org
Sent: Wednesday, January 9, 2013 12:04 PM
Subject: Re: How to modify this script?
Den 09/01/13 11.23, chaouche yacine skrev:
> I figrued it out. Copy/paste exactly these lines in the snippets tool.
> You can bind it to a key as you may know, I bound it to Ctrl-E. So paste
> it in a new snippet (keep the original in a safe place), bind to a key,
> select the text you want to html-tableize and hit the key binding. In my
> case it worked.
>
> $<
[cut]
> def addline(line):
Spooky behavior. Yes, the green-apple-example also works for me with your new script, BUT ...!
Try to copy the table content on this page:
http://www.danacord.dk/frmsets/records/732-r.html
which is a realistic scenario. That's whar I am doing these days.
Pasting it into Gedit and running the snippet blanks the edit area (on MY Mac at least).
And yes: I have pasted your code excatly and I've double-checked for linewraps. Everything is okay.
For your cenvenience I have put borders on the table online (see link above). You may ommit the rows after track 14. Not that it makes any differerence, but that block is surposed to be formatted differerent. I do that manually afterwards ... if not ... ;-)
-- Regards
Kurt Hansen
-- http://mail.python.org/mailman/listinfo/python-list
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
How to modify this script? Kurt Hansen <kurt@ugyldig.invalid> - 2013-01-06 13:42 +0100
Re: How to modify this script? Chris Angelico <rosuav@gmail.com> - 2013-01-06 23:52 +1100
Re: How to modify this script? Kurt Hansen <kurt@ugyldig.invalid> - 2013-01-06 14:34 +0100
Re: How to modify this script? Chris Angelico <rosuav@gmail.com> - 2013-01-07 00:44 +1100
Re: How to modify this script? Kurt Hansen <kurt@ugyldig.invalid> - 2013-01-06 15:03 +0100
Re: How to modify this script? Chris Angelico <rosuav@gmail.com> - 2013-01-07 01:20 +1100
Re: How to modify this script? Kurt Hansen <kurt@ugyldig.invalid> - 2013-01-06 15:30 +0100
Re: How to modify this script? Chris Angelico <rosuav@gmail.com> - 2013-01-07 01:41 +1100
Re: How to modify this script? Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2013-01-08 15:18 +0100
Re: How to modify this script? Kurt Hansen <kurt@ugyldig.invalid> - 2013-01-09 10:21 +0100
Re: How to modify this script? chaouche yacine <yacinechaouche@yahoo.com> - 2013-01-06 04:58 -0800
Re: How to modify this script? Kurt Hansen <kurt@ugyldig.invalid> - 2013-01-06 14:38 +0100
Re: How to modify this script? chaouche yacine <yacinechaouche@yahoo.com> - 2013-01-06 06:01 -0800
Re: How to modify this script? Kurt Hansen <kurt@ugyldig.invalid> - 2013-01-06 15:21 +0100
Re: How to modify this script? chaouche yacine <yacinechaouche@yahoo.com> - 2013-01-06 07:12 -0800
Re: How to modify this script? Kurt Hansen <kurt@ugyldig.invalid> - 2013-01-07 17:42 +0100
Re: How to modify this script? chaouche yacine <yacinechaouche@yahoo.com> - 2013-01-08 07:31 -0800
Re: How to modify this script? Kurt Hansen <kurt@ugyldig.invalid> - 2013-01-09 10:07 +0100
Re: How to modify this script? chaouche yacine <yacinechaouche@yahoo.com> - 2013-01-09 02:23 -0800
Re: How to modify this script? Kurt Hansen <kurt@ugyldig.invalid> - 2013-01-09 12:04 +0100
Re: How to modify this script? chaouche yacine <yacinechaouche@yahoo.com> - 2013-01-09 10:25 -0800
Re: How to modify this script? Kurt Hansen <kurt@ugyldig.invalid> - 2013-01-11 05:35 +0100
Re: How to modify this script? Subimal Deb <subimal.deb@gmail.com> - 2013-01-06 06:22 -0800
Re: How to modify this script? Kurt Hansen <kurt@ugyldig.invalid> - 2013-01-06 15:40 +0100
Re: How to modify this script? Chris Angelico <rosuav@gmail.com> - 2013-01-07 01:52 +1100
Re: How to modify this script? Kurt Hansen <kurt@ugyldig.invalid> - 2013-01-06 16:05 +0100
Re: How to modify this script? Gertjan Klein <gklein@xs4all.nl> - 2013-01-07 18:56 +0100
Re: How to modify this script? Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2013-01-08 15:22 +0100
Re: How to modify this script? Gertjan Klein <gklein@xs4all.nl> - 2013-01-08 17:22 +0100
csiph-web