Forum Home
Press F1
 
Thread ID: 23152 2002-08-08 12:38:00 HTML Editors Graham Petrie (449) Press F1
Post ID Timestamp Content User
69471 2002-08-12 02:35:00 > I have started using 1st page 2000. The only thing I
> really dislike about it is the HTML tidy

Now I can help you with HTML tidy I made a batch file, you right click your HTML file and send to the batch file, it makes three files
(1) a copy of your work, with line numbers included at the start of the line,
(2) a copy with corrections
(3) a list of errors,

You can send any htm, html, file from any where on the hard drive.
but I have to send the contents of the batch file tonight as it is not on this computer.
Guest (0)
69472 2002-08-12 02:49:00 find /v /n "" %1 > %1_num.txt
copy %1 "%1_newver.htm"
tidy.exe -config config.txt -f %1_notes.txt -modify "%1_newver.htm"


Copy the above lines into a text file then call it somefile.bat
and put that batch in the same folder as tidy.exe
then include it on your send-to list
then you can right click your HTML work and send it to the batch file
Guest (0)
69473 2002-08-12 03:46:00 Great! Thanks Eric.

Now, how do you get the pogram to work with paths that have spaces in them?

eg my file is E:\Graham's Documents\Flat Website\index.htm

The find string part works fine, and a file with the line numbers is produced corretcly, but then all hell breaks loose.

The new version file is not created, and the noes file gives the following errors:
tidy.exe: can't open file "E:\Graham's"
tidy.exe: can't open file "Documents\Flat"
tidy.exe: can't open file "Website\left.htm_newver.htm"


Something to do with tidy not reading the full path. Works OK if I place the batch file in system32, and then run it from a command window from the directory, but not from send-to. This would be because the send-to makes %1 equal to the whole path and tidy cannot handle this.

I haven't had a proper look at it yet, but if I think of a solution before you, I will post it.

G P
Graham Petrie (449)
69474 2002-08-12 03:48:00 Oh, for this case the file would be left.htm, not index.htm, but I am sure you already worked that out.

G P
Graham Petrie (449)
69475 2002-08-12 04:45:00 Got it:

find /v /n "" %1 > %1_num.txt
copy %1 %1_newver.htm
tidy.exe -config config.txt -f %1_notes.txt -modify %1_newver.htm

(Missing the unneeded quote marks).

Thanks Eric, I will be using this ALOT! If only I could get the menu item in 1st page to point to the batch file! (This would be where the java version of arachnofilia would be good).

G P
Graham Petrie (449)
69476 2002-08-12 06:06:00 Graham,

Stricktly speaking, web addresses should not have spaces in them. Therefore it might be a better idea to use _ instead of space. Keeps the cogs oiled :D
Elwin Way (229)
69477 2002-08-12 06:25:00 Elwin, the path with spaces is only to the "home" directory for my site (ie where I keep it on my HD). Once in that directory, there are no spaces. I could solve the issue by making a separate folder on my HD for webpages, or I could remove the quotes and let the prompt do the rest. :-)

BTW Eric, I have created a batch file to remove all of the files your batch file creates after I have viewed them (for instance if you want to check heaps of pages in one directory, and then instead of trying to select the pages you want, and then delete them, you can open a command prompt at the location of the files and run the batch file). It gives you the option of deleting all of the files created by your batch file, or the option of deleting them one-by-one with confirmation required. It only targets files that have the naming convention you used in your batch file.

Copy the following text into a text file. Rename it remtidy.bat and place a copy in your c:\windows\system32 folder. Then open a command prompt at the location you want to use it and type remtidy [enter] to view the online help.

@echo off
cls
if "%1"=="" goto help
if "%1"=="all" goto all
if "%1"=="one" goto one
:help
echo.
echo --------------REMTIDY HELP----------------
echo.
echo To run remtidy type "remtidy" at the command line
echo followed by one of two parameters:
echo.
echo "all" deletes all files in the current folder created by tidy.
echo.
echo "one" deletes the files created by tidy one at a time
echo requiring confirmation for each file.
pause
goto fin
:all
del *.htm_*.*
goto fin
:one
del *.htm_*.* /p
:fin

Enjoy!

G P
Graham Petrie (449)
69478 2002-08-12 09:54:00 How come your batch file is having more children?
did I write the instructions wrong?

Let say I have on the D drive a folder;
D:\html-tidy in the folder is only two files we need
tidy.exe
somename.bat

Then lets say I wish to check a file on the desk top called
work.html
buy right clicking and send to somename.bat
it will make three more files on the desktop
WORK.HTM_newver.htm
WORK.HTM_notes.txt
WORK.HTM_num.txt

You do not have to work at the "desk top" folder, you can work in any folder and the three extra files will appear in that folder.
When you are finished fixing out your work (HTML file) you only have three files to delete.
E.ric (351)
69479 2002-08-12 18:54:00 Wow man, last night it took about 30 minutes to go from HOME page before I could enter my name & password to make a posting, This morning was only about 2 (as normal)

What I was going add, but last after half an hour just wanted to get it finished and it might of sliped my mind .

First: If HTML tidy fixes up your work, sometimes it will fix it up wrong, so it validates correct, it does not fix it up how you intented to make it, So I always use the error message so I can fix up the original work myself, then revalidate it until it validates correct without error messages,

Second: Even when it passes the "HTML tidy" test it still might not pass the www . w3 . org validater test . it best to do it with tidy first to reduce most errors this saves online time .
E.ric (351)
69480 2002-08-12 21:39:00 Eric,

Clarification:

Your batch didn't work with the quotation marks, so I removed tham, and it works sweet in any folder. ie just as you described above.

My new batch is for when you have "tidied" a series of documents and you wish to remove all (or some) of the files that have been created.

Thanks alot for the batch.

Sorry to have confused you.

Cheers
G P
Graham Petrie (449)
1 2 3 4