Forum Moderators: open

Message Too Old, No Replies

Software to tidy up code

What is available

         

jeremy

11:24 pm on May 7, 2003 (gmt 0)

10+ Year Member



Is there any decent software available to format code in the manner I want it formatted and also to define the opening and closing of tags so I can check all is balanced.

I use the Dreamweaver mx editor and it seems to have a mind of its own when formatting code.

keyplyr

11:30 pm on May 7, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Try in this forum: [webmasterworld.com...]

pageoneresults

11:35 pm on May 7, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I use the Dreamweaver mx editor and it seems to have a mind of its own when formatting code.

keyplyr sent you to the right forum.

In reference to you using DW, I would imagine you have a set of preferences that you can modify to format your html code. I utilize FP and I have total control over how my html is formatted. Since DW is a little more robust than FP (according to users who post here), I would think you have this option available to you.

pageoneresults

11:37 pm on May 7, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I should also point out that if you do use another program to tidy up your code, as soon as you save that page again in DW, it will revert back to whatever defaults are set in DW. You will then need to open up your tidy program and redo what you previously did.

That is why I think it is very important that you investigate what your DW has to offer before looking for third party tools to do the job.

grahamstewart

11:56 pm on May 7, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You could try HTMLTidy [w3.org]

Never used it myself (because I hand code, so I don't need to tidy up sloppy WSYIWYG work) but its linked to from the W3C Validator [validator.w3.org] page so I'd hope its fairly reasonable.

jeremy

1:05 am on May 8, 2003 (gmt 0)

10+ Year Member



Dreamweaver allows me to format the code to a degree, but it in not that good at what it does. Also when you save the page it shuffles the deck again and you have to reformat all the time.
Most of the dreamweaver stuff works Ok, but this aspect is fairly limited. It also has a major problem working out css display formatting. It is worse that nn4.

pageoneresults

1:18 am on May 8, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Hmmm, something doesn't sound right. I just opened up a copy of DW that I have on my system (DW2 - It's older). From what I can see, it has basically the same formatting rules that FP does. The one thing I did not see were selections for; preserve existing html and save this page using the rules below.

If you've got the preferences set correctly, DW should not be shuffling the deck each time you save the page. Something isn't right somewhere. What type of formatting issues are you having? What happens when you save the page?

In regards to the css, my understanding is that DW works very well with css. Again, it comes down to how the preferences are set up within the program. What type of problems are you seeing there? Maybe one of the resident DW experts will jump in and offer some assistance.

Smilesalot

2:12 am on May 8, 2003 (gmt 0)

10+ Year Member



Jeremy, looking at your answers, I am guessing that you also do quite a bit of hand-editing of the code.

Dreaweaver will only rewrite code in its own style on sections that you edit using the design (WYSIWYG) view. If, for example, you loaded a page formatted by you, and you inserted an image while in design mode, DW would write the HTML code to insert the image in its own style AND leave the rest of the code unchanged.

BUT

If your code had certain errors in it, such as invalidly nested and unclosed tags or extra closing tags, by default, DW would rewrite your code automatically and may shuffle the "deck" completely, so to speak.

Try this - Open your nicely formatted file, if an asterix appears (to indicate that the file needs to be saved) at the end of the file's filename at the top of the screen, then DW has edited your code. If this is the problem, then let DW edit the code, run "Clean up HTML" and "Apply source formatting", then save your file (under a different name, to be sure). Then get a program like PrettyHTML (http://www.mpp.at/pretty/index.htm) to format your code the way you want it.

Hope this helps.

jeremy

2:14 am on May 8, 2003 (gmt 0)

10+ Year Member



When I save after a re-format the indenting goes anywhere, well not really anywhere, but anything that is indented the indenting relates back to column 0, rather than where the tag is indented to.

With the css problems and DW.-- I am using a 2 and 3, liquid columns setup, and the DW interactive imagery is just anywhere but where it should be. It does not worry me particularly as I do my work mostly in the editor and all is well in the major browsers.

If I am in the interactive environment and I save the file from there, then the display also changes and I get what I expect from nn4 and that is a degraded display that basically follow the content with links, images etc, none of the visual formatting. That is fine by me, I got tired of trying to fix problems with a browser that should be on the scrap heap, i just serve up the content.

I understand what you say about preferences in DW, but I am not sure it will do what I require.

jeremy

3:04 am on May 8, 2003 (gmt 0)

10+ Year Member



Thanks smilesalot,
I opened a file just to be sure and DW did not alter it. It only alters things when I save them, regardless of whether I am in the editor or design mode. I am in the editor 99% of the time.
I tend not to make too many errors like unclosed or extra tags, I just want things to look good without having to go to format code all the time.
Maybe it has something to do with the fact the pages are initially generated from templates, and the templates need attending to. I doubt it, but I will check.
Thanks for the prettyhtml link. I will check it out.

I did find a useful plug-in for IE, for antone that is interested. [adew.co.uk...]
I have no connection to this, I just found it when surfing for a solution to this.