Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > html "cleaner"

html "cleaner"
Thread Tools
Junior Member
Join Date: Sep 2003
Location: Ireland
Status: Offline
Reply With Quote
Apr 20, 2004, 03:48 PM
 
is there software that will clean up html pages? i used word, dreamweaver and front page at different stages on a web site and would like to strip the pages of all the rubbish they put in!

thanks in advance,
Jan
     
Clinically Insane
Join Date: Nov 1999
Status: Offline
Reply With Quote
Apr 20, 2004, 03:58 PM
 
Your best bet is Terry Teague's MacTidy, at http://www.geocities.com/terry_teague/tidy.html

This should do just about everything you need. There's a BBEdit plugin too, in case you use that.
You are in Soviet Russia. It is dark. Grue is likely to be eaten by YOU!
     
Occasionally Useful
Join Date: Jun 2001
Location: Liverpool, UK
Status: Offline
Reply With Quote
Apr 21, 2004, 05:20 AM
 
i'd be interested to know what "rubbish" you think Dreamweaver adds to your code. GoLive, yes; that outputs some messy code. Dreamweaver doesn't particularly add anything that i can think i wouldn't add if i was coding by hand.
"Have sharp knives. Be creative. Cook to music" ~ maxelson
     
Grizzled Veteran
Join Date: Jun 2001
Location: Melbourne, Australia
Status: Offline
Reply With Quote
Apr 21, 2004, 09:15 AM
 
Originally posted by philzilla:
i'd be interested to know what "rubbish" you think Dreamweaver adds to your code. GoLive, yes; that outputs some messy code. Dreamweaver doesn't particularly add anything that i can think i wouldn't add if i was coding by hand.
Hmmm... lets see now...

Code:
<script language="JavaScript"> <!-- function MM_findObj(n, d) { //v4.0 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x && document.getElementById) x=document.getElementById(n); return x; } function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} } function MM_swapImgRestore() { //v3.0 var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc; } function MM_swapImage() { //v3.0 var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} } //--> </script> </head> <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" background="gfx/home/background.gif" onLoad="MM_preloadImages('gfx/home/oval_two_over.gif','gfx/home/oval_one_over.gif','gfx/home/oval_three_over.gif','gfx/home/oval_four_over.gif','gfx/home/oval_five_over.gif', 'gfx/home/background.jpg','gfx/home/blob1.jpg', 'gfx/home/blob1_over.jpg','gfx/home/blob2.jpg', 'gfx/home/blob2_over.jpg','gfx/home/blob3.jpg', 'gfx/home/blob3_over.jpg','gfx/home/blob4.jpg', 'gfx/home/blob4_over.jpg','gfx/home/blob5.jpg', 'gfx/home/blob5_over.jpg','gfx/home/blob6.jpg', 'gfx/home/blob6_over.jpg','gfx/home/blob7.jpg', 'gfx/home/blob7_over.jpg','gfx/home/blob8.jpg', 'gfx/home/blob8_over.jpg','gfx/home/blob9.jpg', 'gfx/home/blob9_over.jpg','gfx/home/blob10.jpg', 'gfx/home/blob10_over.jpg','gfx/home/blob11.jpg', 'gfx/home/blob11_over.jpg','gfx/home/blob12.jpg', 'gfx/home/blob12_over.jpg')" bgcolor="#4F56B1">
Not that GoLive's is much better, it's just that all the 'default' WYSIWYG javascript, comments and extra unnecessary attributes seem plain icky.

BTW, this was code that was given to me - I HAD NOTHING TO DO WITH IT, OK!!!
Computer thez nohhh...
     
Occasionally Useful
Join Date: Jun 2001
Location: Liverpool, UK
Status: Offline
Reply With Quote
Apr 21, 2004, 10:32 AM
 
Originally posted by Simon Mundy:
BTW, this was code that was given to me - I HAD NOTHING TO DO WITH IT, OK!!!
yeah yeah, that's your story and you're sticking to it, right?

okay, i forgot about all that javascript. i usually just throw all that in its own file anyway, and then call it from each page it's needed on. much better.
"Have sharp knives. Be creative. Cook to music" ~ maxelson
     
janmc  (op)
Junior Member
Join Date: Sep 2003
Location: Ireland
Status: Offline
Reply With Quote
Apr 21, 2004, 05:02 PM
 
I used the 'save as web page' tool in Word... I know it's very lazy, but I had to get a site up quickly. Even my basic knowledge of html tells me there's far too much rubbish in the code - but unfortunately I don't know enough to clean it up myself! Also, it would take far too long for all the pages.
     
Forum Regular
Join Date: Feb 2004
Location: Manhattan
Status: Offline
Reply With Quote
Apr 21, 2004, 05:50 PM
 
There's more reason than just that not to use Word. It has non-printing characters which can mess up your page.
I saw a woman with a sweatshirt that said "Guess", so I said, "Implants?"
     
Occasionally Useful
Join Date: Jun 2001
Location: Liverpool, UK
Status: Offline
Reply With Quote
Apr 21, 2004, 06:01 PM
 
ugh. Word's HTML. i think i'd rather have my gonads replaced with red hot coals, than have to deal with that mess.
"Have sharp knives. Be creative. Cook to music" ~ maxelson
     
Mac Elite
Join Date: Mar 2002
Location: Clogland
Status: Offline
Reply With Quote
Apr 22, 2004, 01:59 AM
 
Originally posted by philzilla:
ugh. Word's HTML. i think i'd rather have my gonads replaced with red hot coals, than have to deal with that mess.
That should be an option.
     
Mac Enthusiast
Join Date: Nov 2002
Location: Barcelona, Spain
Status: Offline
Reply With Quote
Apr 22, 2004, 04:12 AM
 
Dreamweaver produces reasonably clean code, but your pages will not validate because DW does not close some tags, "JavaScript" etc.

MS Word?!?! What are you smoking, cuz I want some of that

Oh well, I'll just get back into my box.
My Blog & Photos
PowerBook (Ti) 1Ghz · 1Gb · 60Gb · SD
     
janmc  (op)
Junior Member
Join Date: Sep 2003
Location: Ireland
Status: Offline
Reply With Quote
Apr 22, 2004, 12:54 PM
 
i know, i know! it's just that i had a load of word documents with tables and i took a shortcut. now i'm stuck with ugly ugly script. it will take forever from scratch and redo them.
     
Mac Elite
Join Date: Oct 2000
Status: Offline
Reply With Quote
Apr 22, 2004, 02:30 PM
 
     
janmc  (op)
Junior Member
Join Date: Sep 2003
Location: Ireland
Status: Offline
Reply With Quote
Apr 24, 2004, 12:44 PM
 
Thanks - that textism thing is brilliant. The MacTidy was too complicated for my non-using Terminal self
     
Addicted to MacNN
Join Date: Oct 2001
Location: Yokohama, Japan
Status: Offline
Reply With Quote
Apr 28, 2004, 12:23 AM
 
Originally posted by philzilla:
ugh. Word's HTML. i think i'd rather have my gonads replaced with red hot coals, than have to deal with that mess.
I once cleaned up a large file converted from Word to HTML. It went from 500KB to around 70KB.
     
Mac Elite
Join Date: May 2001
Location: Melbourne, Australia
Status: Offline
Reply With Quote
Apr 28, 2004, 12:44 AM
 
Originally posted by wataru:
I once cleaned up a large file converted from Word to HTML. It went from 500KB to around 70KB.
I once looked at a HTML file from Word. I couldn't sleep for weeks. That thing was scary!
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 09:10 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2