I'm trying to understand and unpick an HTML template file, an automatic 'beautifier' would help no end, are there any out there?
On 07/03/07, Eur Ing Chris Green cl@isbd.net wrote:
I'm trying to understand and unpick an HTML template file, an automatic 'beautifier' would help no end, are there any out there?
Not had to do this under Linux so far, tho I used to use Dreamweaver and Homesite to do it. Have you tried Bluefish, under Linux? I've heard good things about it, tho I've yet to install it.
There's probably a function for it in one of the GUI text editors but I haven't found one yet. I'm still using Kwrite for GUI stuff, though I don't much like it ... haven't yet found anything I like as much as i did Crimson Editor on Windows.
Peter.
On Wed, Mar 07, 2007 at 09:34:08PM +0000, samwise wrote:
On 07/03/07, Eur Ing Chris Green cl@isbd.net wrote:
I'm trying to understand and unpick an HTML template file, an automatic 'beautifier' would help no end, are there any out there?
Not had to do this under Linux so far, tho I used to use Dreamweaver and Homesite to do it. Have you tried Bluefish, under Linux? I've heard good things about it, tho I've yet to install it.
Bluefish is just an HTML editting program, loading my template file into it just shows the code exactly 'as is' with all the unhelpful formatting, there doesn't seem to be any way to beautify it (i.e. to match up beginning and ending tags and to make the indenting consistent).
Really? That's a bit poor - I thought it would have had a pretty-print function, it's been kicking around for a while ...
Hmm, 'fraid I can't think of anything apart from trawling through some different text editors. Unless maybe Mozilla Composer has it?
I dunno, I'm out!
Peter.
On Wed, 2007-03-07 at 21:14 +0000, Eur Ing Chris Green wrote:
I'm trying to understand and unpick an HTML template file, an automatic 'beautifier' would help no end, are there any out there?
tidy.sourceforge.net
It's a command line tool that takes a truly bewildering array of switches, but it seems to work...
Dave.
The kitten on the keyboard of Eur Ing Chris Green resulted in::
I'm trying to understand and unpick an HTML template file, an automatic 'beautifier' would help no end, are there any out there?
Hi, I have to deal with this at work. The tools I use, well, there's tidy which seems ok, but a bit primitive, not sure how recent the html can be. Should be available in most distros.
There's a perl script knocking around called hindent that's ok, but fragile. I.E. if there's things like closing tags without opening, or quotes closed with single quotes and that manner of vileness, it will barf, and not help much in fixing the html. So if the code's been machine generated, it's worth a shot.
I generally edit using VIM, and there's a very good html mode available. Things like bracket matching, "%: getting overloaded to zip from opening to closing tags, command-sequences for pasting in more complex tagging (;ta puts in a pair of table tags, with the cursor in the middle). I feel unclean for saying this ;-) but there's just *got* to be something similar for emacs!
However, about once a week, I get a website through that's been "outsourced" to a sweatshop in India. The code is, erm, interesting. (Using a table for layout is bad? Ha! These get nested 7 deep!!! Auto-generated from PhotoShop, at a guess.) The best tool I've found for dealing with this, buy far, is, unfortunately, Windows shareware, "CSE HTML Validator" Very, very good. But once the code's fixed, back to VIM I go!
Best of Luck! Bill
On Thu, Mar 08, 2007 at 09:53:33AM +0000, W.B.Hill wrote:
The kitten on the keyboard of Eur Ing Chris Green resulted in::
I'm trying to understand and unpick an HTML template file, an automatic 'beautifier' would help no end, are there any out there?
Hi, I have to deal with this at work. The tools I use, well, there's tidy which seems ok, but a bit primitive, not sure how recent the html can be. Should be available in most distros.
There's a perl script knocking around called hindent that's ok, but fragile. I.E. if there's things like closing tags without opening, or quotes closed with single quotes and that manner of vileness, it will barf, and not help much in fixing the html. So if the code's been machine generated, it's worth a shot.
I generally edit using VIM, and there's a very good html mode available. Things like bracket matching, "%: getting overloaded to zip from opening to closing tags, command-sequences for pasting in more complex tagging (;ta puts in a pair of table tags, with the cursor in the middle). I feel unclean for saying this ;-) but there's just *got* to be something similar for emacs!
However, about once a week, I get a website through that's been "outsourced" to a sweatshop in India. The code is, erm, interesting. (Using a table for layout is bad? Ha! These get nested 7 deep!!! Auto-generated from PhotoShop, at a guess.) The best tool I've found for dealing with this, buy far, is, unfortunately, Windows shareware, "CSE HTML Validator" Very, very good. But once the code's fixed, back to VIM I go!
I don't want an HTML *validator*, I want an HTML *beautifier* so that it's prettily indented so I can understand it.
I use vile (another vi clone) which also has a good HTML mode with syntax highlighting etc. but I don't think any editor is likely to be able to auto-format HTML (well, no doubt they *could* but it's not a common requirement or ability).
I don't want an HTML *validator*, I want an HTML *beautifier* so that it's prettily indented so I can understand it.
I use vile (another vi clone) which also has a good HTML mode with syntax highlighting etc. but I don't think any editor is likely to be able to auto-format HTML (well, no doubt they *could* but it's not a common requirement or ability).
As I said, Dreamweaver definitely had a pretty print function ... not that that helps you much. Very expensive to get legit. I think you'll have to resort to some heavy googling ... or try and find a linux web development forum to ask in ..
Peter.
On Thu, Mar 08, 2007 at 09:59:26AM +0000, Eur Ing Chris Green wrote:
On Thu, Mar 08, 2007 at 09:53:33AM +0000, W.B.Hill wrote:
The kitten on the keyboard of Eur Ing Chris Green resulted in::
I'm trying to understand and unpick an HTML template file, an automatic 'beautifier' would help no end, are there any out there?
[snip]
I don't want an HTML *validator*, I want an HTML *beautifier* so that it's prettily indented so I can understand it.
I use vile (another vi clone) which also has a good HTML mode with syntax highlighting etc. but I don't think any editor is likely to be able to auto-format HTML (well, no doubt they *could* but it's not a common requirement or ability).
Emacs has a HTML mode which supports emacs's generic "code grinding" mechanisms.
I just tried loading one of my old HTML files and running the "indent-region" command on it. That made a neat "staircase" out of a lengthy unordered list (<ul> ... </ul>), because back when I wrote that file I didn't use closing tags for list items (</li>) -- so it at least does indent according to the HTML syntax which may be useful to understand the structure of unknown HTML code.
Best regards, Jan
The kitten on the keyboard of Eur Ing Chris Green resulted in::
I don't want an HTML *validator*, I want an HTML *beautifier* so that it's prettily indented so I can understand it.
Validation, beautifier, spell checker, html version converter, syntax highlighter, image size tag generator, link validator... So it's a big hammer! (Swiss Army Sledge??!)
The usual workflow is load up a document. Tell it what version of html/xhtml to go with. Parse through and fix errors. (It's kinda hard to indent sensibly when there's 5 open table tags, then 3 close ones, and they overlap... Or the table has 11 columns at the top and 7 at the bottom!) Then indent, beautify, convert to whatever. Save. Load into VIM. Break. ;-) And no it's time to stop plugging WindozeWare!
tidy -indent is useful, and I've got it as a vim macro, but can have trouble with some of the more broken html. Haven't tried it in a while, though, has it improved? Also, if you're a TeX user, there's always lgrind (Don't think vgrind has an html mode.)
As an aside, is there an indenter for java anywhere???
On Wed, Mar 07, 2007 at 09:14:19PM +0000, Eur Ing Chris Green wrote:
I'm trying to understand and unpick an HTML template file, an automatic 'beautifier' would help no end, are there any out there?
There is a python library called beautiful soup which can do this..
alan@hactar:~$ python Python 2.5 (release25-maint, Mar 5 2007, 20:06:09) [GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2 Type "help", "copyright", "credits" or "license" for more information.
import urllib2 from BeautifulSoup import BeautifulSoup page = urllib2.urlopen("http://google.com/") soup = BeautifulSoup(page) print soup.prettify()
<html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title> Google </title> <style> <!--
--------------------------8<----------------------
<p> <font size="-2"> ©2007 Google </font> </p> </center> </body> </html>
Cheers, Al.
On Thu, Mar 08, 2007 at 12:01:35PM +0000, Alan Pope wrote:
On Wed, Mar 07, 2007 at 09:14:19PM +0000, Eur Ing Chris Green wrote:
I'm trying to understand and unpick an HTML template file, an automatic 'beautifier' would help no end, are there any out there?
There is a python library called beautiful soup which can do this..
I might have guessed that there was a Python utility to do what I wanted! It looks like a more modern version of tidy in many ways.
On Wednesday 07 March 2007 21:14, Eur Ing Chris Green wrote:
I'm trying to understand and unpick an HTML template file, an automatic 'beautifier' would help no end, are there any out there?
Incidentally, you might want to check out Quanta, I used it a while back just for kicks, plugged right into the site via ssh, gave nice tree views of the document like an XML editor in the side panel and had code folding and basic source formatting/indentation stuff although more importantly it had now fairly standard ability to pipe through whatever other scripts/programs you want from the app UI.