Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #36484
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!feed.xsnews.nl!border-2.ams.xsnews.nl!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'example:': 0.03; 'output': 0.04; 'debug': 0.05; 'debugging': 0.05; 'modify': 0.05; 'default.': 0.07; 'subject:How': 0.09; 'python': 0.09; '"%s"': 0.09; 'homepage.': 0.09; 'inserted': 0.09; 'snippet': 0.09; 'subject:script': 0.09; 'texts.': 0.09; 'worked.': 0.09; 'def': 0.10; 'kurt': 0.11; '.app': 0.16; 'bind': 0.16; 'binding.': 0.16; 'buggy': 0.16; 'columns': 0.16; 'item)': 0.16; 'script?': 0.16; 'snippets': 0.16; 'tabs': 0.16; 'tool.': 0.16; 'url:records': 0.16; 'copied': 0.17; 'skip:" 30': 0.20; 'to:name:python- list@python.org': 0.20; 'wednesday,': 0.22; '>': 0.23; 'to:2**1': 0.23; 'feature': 0.24; 'script': 0.24; 'header:In- Reply-To:1': 0.25; 'select': 0.26; 'skip:" 20': 0.26; 'separate': 0.27; "doesn't": 0.28; 'lines': 0.28; 'went': 0.28; 'key,': 0.29; 'received:98.138.87': 0.29; 'yes.': 0.29; 'url:mailman': 0.29; 'included': 0.29; 'source': 0.29; 'figure': 0.30; 'code': 0.31; 'url:python': 0.32; 'mac': 0.32; 'structure': 0.32; 'skip:_ 30': 0.32; 'url:listinfo': 0.32; 'text,': 0.33; 'traceback': 0.33; 'to:addr:python-list': 0.33; 'know.': 0.33; 'text': 0.34; 'reply- to:addr:yahoo.com': 0.34; 'wrong': 0.34; 'adds': 0.35; 'open': 0.35; 'table': 0.35; 'subject:?': 0.35; 'there': 0.35; 'list.': 0.35; 'add': 0.36; 'subject:': 0.36; 'ability': 0.36; 'but': 0.36; 'url:org': 0.36; 'email addr:python.org': 0.36; 'item': 0.37; 'sent:': 0.37; 'subject:: ': 0.38; 'mark': 0.38; 'from:': 0.38; 'skip:l 20': 0.38; 'to:addr:python.org': 0.39; 'skip:" 10': 0.40; 'url:mail': 0.40; 'your': 0.60; 'easy': 0.60; 'email name:python- list': 0.62; 'safe': 0.63; 'url:png': 0.63; 'here': 0.65; 'header :Reply-To:1': 0.68; 'received:41': 0.73; 'click': 0.76; 'subject:this': 0.84; '2013': 0.84; 'console,': 0.84; 'organize,': 0.84; 'url:dk': 0.84; 'activated': 0.91; 'received:98.138.226': 0.91 |
| X-Yahoo-Newman-Property | ymail-3 |
| X-Yahoo-Newman-Id | 931616.20902.bm@omp1008.mail.ne1.yahoo.com |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1357726988; bh=lQ1thkSgdxJWLB+r3GXglGjgDDzK0Iaab9uu6jRhBoo=; 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=ZuVFHsMWTA2Q3yA3+Cz/QushyPy2WaTBylxlRO3G8MJ9g0QqCHuXq7pKx5nQqT99eGTPRh46ZN5IDHySaiRWezFaSwmNrB8MIgdNqhIk6uybjCg9r64W/HXGDsrZk3d8TBaTB4jAgjilMCvf0ivr5UPdeCEb6GtBEhqHrVlgNBE= |
| 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=epBvRJa0aTdEsKUsmS6bn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bm93LCBJIGJvdW5kIGl0IHRvIEN0cmwtRS4gU28gcGFzdGUgaXQgaW4gYSBuZXcgc25pcHBldCAoa2VlcCB0aGUgb3JpZ2luYWwgaW4gYSBzYWZlIHBsYWNlKSwgYmluZCB0byBhIGtleSwgc2VsZWN0IHRoZSB0ZXh0IHlvdSB3YW50IHRvIGh0bWwtdGFibGVpemUgYW5kIGhpdCB0aGUga2V5IGJpbmRpbmcuIEluIG15IGMBMAEBAQE- |
| 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> |
| Date | Wed, 9 Jan 2013 02:23:08 -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 | <50ed336f$0$284$14726298@news.sunsite.dk> |
| MIME-Version | 1.0 |
| Content-Type | multipart/alternative; boundary="329289550-1982634150-1357726988=:24875" |
| 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.310.1357726998.2939.python-list@python.org> (permalink) |
| Lines | 116 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1357726998 news.xs4all.nl 6954 [2001:888:2000:d::a6]:59225 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:36484 |
Show key headers only | View raw
[Multipart message — attachments visible in raw view] - view raw
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.
$<
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"
for line in """$GEDIT_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>
Here's a screenshit, sorry screenshot :) http://h.dropcanvas.com/521xc/gedit.png
The python support in gedit snippets is very poor when it comes to debugging because there are traceback printed in the console, that means gedit actually breaks without even noticing the user about what went wrong (ex. : your snippet is malformed or has errors). I had to debug it using pdb.set_trace directly inside its source code to figure out what was wrong in the snippet.
If this doesn't work for you, please let me know.
________________________________
From: Kurt Hansen <kurt@ugyldig.invalid>
To: python-list@python.org
Sent: Wednesday, January 9, 2013 10:07 AM
Subject: Re: How to modify this script?
Den 08/01/13 16.31, chaouche yacine skrev:
> Well tell me how do you use this script in gedit, are you using it as a
> plugin ?
"Snippets" is a plugin, yes. It's included in the .app for Mac (v. 2.30.2), but not activated af default.
Open "Tools" in the menu line and click "Manage snippets...". Here you can organize, add and edit snippets of texts. The feature olså has the ability to work with Python code inside the snippet content.
I am re-building a 15 years old homepage. The HTML code is handmade over the years and very varying, buggy etc., så I would like to renew the HTML for the table structure in an easy way.
Example: On this page: http://www.danacord.dk/frmsets/records/732-r.html I mark the content of the CD, copy it to the clipboard and paste it into the editing area in Gedit. cmd-a marks it all again and then I "run" the snippet upon the text, either using my self-defined hotkey or by pushing ctrl+space and select my snippet from a list.
The copied text is inserted as clean text without any HTML. The Python-snippet we are discussing recognizes tabs to separate the columns and adds the apprpriate HTML-code to it.
-- 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