This is Interesting: Free Magazines for Graphics designers and webmasters
Home > Archive > Webmaster forum > August 2006 > Wtd: HTML editor to swap the order of columns in tables
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Wtd: HTML editor to swap the order of columns in tables
|
|
| Andy Mabbett 2006-08-27, 6:39 pm |
|
I have an HTML document which has a long table, with five columns.
I want to swap the order of columns four and five, without breaking
(indeed, without otherwise altering) the valid markup.
Is there a tool which will allow me to do this?
(Cross-posted; comp.infosystems.www.authoring.html used, as I don't
receive comp.infosystems.www.authoring.tools)
--
Andy Mabbett
Say "NO!" to compulsory ID Cards: <http://www.no2id.net/>
Free Our Data: <http://www.freeourdata.org.uk>
| |
| Paul Lutus 2006-08-27, 6:39 pm |
| Andy Mabbett wrote:
>
> I have an HTML document which has a long table, with five columns.
>
> I want to swap the order of columns four and five, without breaking
> (indeed, without otherwise altering) the valid markup.
>
> Is there a tool which will allow me to do this?
Yes. It's called a "Regular Expression Processor", and it is part of most
modern programming languages.
Untested example script (Ruby):
-------------------------------
#!/usr/bin/ruby -w
data = STDIN.read
data.gsub!(%r{(<tr><td>.*?</td><td>.*?</td><td>.*?</td> )(<td>.*?</td>
(<td>.*?</td> )}m,"\\1\\3\\2")
puts data
------------------------------
Use:
scriptname < input.file > output.file
Or, you could download my freeware HTML workshop Arachnophilia and write the
above regular expression into its search/replace window. That would be
easier for an end user, while the above Ruby script is easier and more
flexible (will process any number of files by simply naming them) for a
more advanced computer user.
In the long term, it is much more productive to learn how to process HTML
using scripts that contain regular expressions.
Arachnophilia:
http://www.arachnoid.com/arachnophilia/index.html
--
Paul Lutus
http://www.arachnoid.com
| |
| Ben Jamieson 2006-08-27, 6:39 pm |
| On 2006-08-27 07:05:54 -0400, Andy Mabbett
<usenet200309@pigsonthewing.org.uk> said:
>
> I have an HTML document which has a long table, with five columns.
>
> I want to swap the order of columns four and five, without breaking
> (indeed, without otherwise altering) the valid markup.
>
> Is there a tool which will allow me to do this?
>
> (Cross-posted; comp.infosystems.www.authoring.html used, as I don't
> receive comp.infosystems.www.authoring.tools)
If you're not comfortable with RegEx/perl/scripting etc (many aren't)
then DreamWeaver will do this with a simple 'Cut/Paste' option.
Might be an easier way to go.
Ben
| |
|
| In article <GdB7OoUSyX8EFw7h@pigsonthewing.org.uk>,
Andy Mabbett <usenet200309@pigsonthewing.org.uk> wrote:
> I want to swap the order of columns four and five, without breaking
> (indeed, without otherwise altering) the valid markup.
>
> Is there a tool which will allow me to do this?
Excel? (or other low cost spreadsheet)
| |
|
| Ben Jamieson <ben@thymeonline.com> wrote:
> If you're not comfortable with RegEx/perl/scripting etc (many aren't)
> then DreamWeaver will do this with a simple 'Cut/Paste' option.
And create shit code? Besides, it's not a freeware solution.
KBB
| |
| blanketyblankman@gmail.com 2006-08-29, 6:46 pm |
| AES wrote:
> In article <GdB7OoUSyX8EFw7h@pigsonthewing.org.uk>,
> Andy Mabbett <usenet200309@pigsonthewing.org.uk> wrote:
>
>
> Excel? (or other low cost spreadsheet)
Google Spreadsheet? =)
| |
| Andy Dingley 2006-08-29, 6:47 pm |
|
Andy Mabbett wrote:
> I want to swap the order of columns four and five, without breaking
> (indeed, without otherwise altering) the valid markup.
Time to learn regexes.
Then probably find yourself an editor that allows reasonable regex
processing, and to allow this processing to be applied only to a
highlighted selection. You could do it over the whole file with sed,
but that's often ghastly if you're just re-arranging one chunk of a
large file.
Sadly most editors that "support regexes" have bizarre, inconsistent
and partial ideas about regex syntax. Be careful here, especially with
TextPad -- try jEdit.
| |
| Al Klein 2006-08-29, 6:47 pm |
| On 29 Aug 2006 03:00:46 -0700, "Andy Dingley" <dingbat@codesmiths.com>
wrote:
>Then probably find yourself an editor that allows reasonable regex
>processing, and to allow this processing to be applied only to a
>highlighted selection. You could do it over the whole file with sed,
>but that's often ghastly if you're just re-arranging one chunk of a
>large file.
Or take the chunk that has to be changed to another file by itself,
change it and paste it back, if doing the whole file is easier.
|
|
|
| | Copyright 2003 - 2008 forum4designers.com Software forum Computer Hardware reviews |
|