HTML Tidy config set up in TextPad

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
User avatar
jlbalder
Posts: 11
Joined: Sat May 03, 2003 6:42 pm

HTML Tidy config set up in TextPad

Post by jlbalder »

I have set up HTML Tidy as per http://textpad.com/forum/viewtopic.php?t=4768 and it works fine. In other words, it reports the errors and warnings, and I can dbl-Click a Warning right to the offending line. However, I would like to use the Tidy-Config file option to use more than the default configuration. My problem is I have the file (I called it TidyCfg.txt) in place, and I set an environment variable in my NT4 machine, (HTML_TIDY=C:\Program Files\TextPad 4\Samples\TidyCfg.txt) and I activate HTML-Tidy using [Ctrl-5], but it doesn't seem to use the file, and I don't know what to change in my set up to make it pick-up the file and use it.

Has anyone else done this? Maybe a set of instructions to set up on both an NT4 and a Win98SE machine.

Thanks in advance.

JohnB

:shock:
User avatar
s_reynisson
Posts: 939
Joined: Tue May 06, 2003 1:59 pm

Post by s_reynisson »

In Parameters for the Tidy tool in TP I'm using

Code: Select all

-config C:\tidy\tconf.txt -errors -quiet $File
HTH
Then I open up and see
the person fumbling here is me
a different way to be
User avatar
jlbalder
Posts: 11
Joined: Sat May 03, 2003 6:42 pm

Parameter changed, what is command format?

Post by jlbalder »

Thanks for such a rapid response.
I changed my Parameter setting to:
-config "C:\Program Files\TextPad 4\Samples\TidyCfg.txt" -errors -quiet $File
(Note the use of quotes around the path. They were necessary to stop TextPad from dividing the path, and then reporting errors, at the spaces in the path name (e.g. in 'Program Files')).

My TidyCfg.txt file reads (in part):
wrap: 0
indent: yes
indent-spaces: 2
wrap-php: no
clean: yes

I know TextPad is now reading my TidyCfg.txt file because it does not report the errors of the spaces in the path as it did previously. But it doesn't actually follow the instructions in the file. For instance, it does not indent the requested two spaces, or clean the code. Is this the correct commands (and format) for these parameter settings? Your help is greatly appreciated.

Thanks
JohnB :)
User avatar
s_reynisson
Posts: 939
Joined: Tue May 06, 2003 1:59 pm

Post by s_reynisson »

Sorry, my tidy'ness is limited. You could try a support forum/newsgroup for Tidy, unless someone else here would like to jump in?
Then I open up and see
the person fumbling here is me
a different way to be
User avatar
jlbalder
Posts: 11
Joined: Sat May 03, 2003 6:42 pm

Thanks for your help

Post by jlbalder »

Thanks for your help.

If anyone else has any suggestions, please jump in...

Thanks
JohnB :D
User avatar
helios
Posts: 710
Joined: Sun Mar 02, 2003 5:52 pm
Location: Helios Software Solutions
Contact:

Post by helios »

You may be able to get some help from here:

http://tidy.sourceforge.net/
Helios Software Solutions
User avatar
jlbalder
Posts: 11
Joined: Sat May 03, 2003 6:42 pm

Post by jlbalder »

I hate it when a FAQ/A peters out without resolution. So, because TextPad is my absolute favorite ASCII editor, I spent some time playing with Tidy.exe, and figuring out how to make it work in TextPad, with and without an external configuration file. (Below I have used 'single quotes' to delimit Parameter settings. They, are not part of the Parameter setting.)

Configure as per http://textpad.com/forum/viewtopic.php?t=4768
Then change the Parameter setting to '-h $File', to see a short HELP blurb, OR
change the Parameter setting to '-help-config $File' to see a list of all CONFIGURATION OPTIONS, OR
change the Parameter setting to '-show-config $File' to see a list of the CURRENT CONFIGURATION SETTINGS.

If you want to use shortened command-line Parameters, you can set whatever parameter you desire in the Configure | Preferences | Tools | Tidy | Parameters: window, (e.g. Parameters= '-iq $File'). This command-line switch directs Tidy.exe to 'indent=yes, quiet=yes'. See the above Help blurbs from Tidy.exe for the complete list, (AND CORRECT USAGE), of command-line switches.

I wanted to use an external file to set my Tidy.exe switches because I forget what switch does what and etc. So, I created a file, named, "TidyCfg.txt", and placed it in the Samples subdirectory of the TextPad installation. Then I changed the Parameter setting to read, '-config "C:\Program Files\TextPad 4\Samples\TidyCfg.txt" $File'. The double quotes are necessary around the file path to avoid errors when TextPad parses the path. In the file, "TidyCfg.txt", I have:

indent: auto
write-back: yes
wrap: 0
quiet: yes
//show-errors: 0
clean: yes
//See TidyHelpShowConfig.txt

Notice the use of // to insert comments and disable commands.
Also notice the difference in the syntax from the command-line syntax.
See the HELP blurbs above from Tidy.exe to get a complete explanation for the above switches.

Thanks
JohnB 8)
User avatar
s_reynisson
Posts: 939
Joined: Tue May 06, 2003 1:59 pm

Post by s_reynisson »

I'm confused (no news here :roll: ) after reading your post. Am I right in thinking that "-config C:\tidy\tconf.txt -errors -quiet $File" is incorrect? Ie. you must either use the config file OR the parameters, not both?

Diffrent issue: I just noticed that my column settings are not working. I get the report:

Code: Select all

line 348 column 41 - Warning: plain text isn't allowed in <tr> elements
line 668 column 41 - Warning: nested emphasis <span>
line 668 column 41 - Warning: missing </span> before <table>
line 744 column 17 - Warning: discarding unexpected </span>
and when I double click a line, TP takes me to cols 56, 44, 44 and 23 in the document! I took a quick look at "tidy -h" etc and changed my parameters back to the original "-errors -quiet $File" with no effect. Changed TP's settings for number of spaces in a tab and also for Tidy using both command line parameters and a config file. Nothing happens, I'm constantly taken to the wrong column. Any ideas?
Then I open up and see
the person fumbling here is me
a different way to be
User avatar
jlbalder
Posts: 11
Joined: Sat May 03, 2003 6:42 pm

Post by jlbalder »

First, about the jumping to the wrong column; my set-up is till according to the information in:
http://textpad.com/forum/viewtopic.php?t=4768
about the settings at the bottom of the Tools pop-up; File: =BLANK, Line: =1, and Column: =2. Quiet honestly, I don't know that much about these settings.

As for the second item, command-line vs. config-file: I don't know this definitively, but I think it is an either/or situation. (Ignore my single quotes) For a command-line setting, the Parameter field should read, '-errors -quiet $File', (which can be rewritten as '-eq $File').

Then, if you want to use a config-file, '-config "C:\tidy\tconf.txt" $File', (Please notice that the double-quotes only bracket the "absolutePath\fileName.ext", (if there are no spaces, the double-quotes are apparently not needed)).

I don't know whether you can mix the two, (command-line and config-file), but, I do know that the config-file does not work unless the switches are in the form:
...
wrap: 0
indent: yes
indent-spaces: 2
...

I hope this helps.

JohnB :?
User avatar
Nick
Posts: 51
Joined: Fri Aug 22, 2003 7:12 am
Location: Newcastle under Lyme, UK
Contact:

Re: Parameter changed, what is command format?

Post by Nick »

jlbalder wrote:I know TextPad is now reading my TidyCfg.txt file because it does not report the errors of the spaces in the path as it did previously. But it doesn't actually follow the instructions in the file.)
I had this problem - when I looked closely at my config file I noticed i had somehow inadvertantly introduced space characters at the start of each line. Removing them fixed it.
User avatar
jlbalder
Posts: 11
Joined: Sat May 03, 2003 6:42 pm

Post by jlbalder »

Actually, my problem was the spaces inside file and path names, e.g. 'C:\Program Files\...]. Once I made the path a string, or literal, it worked fine.

8)
JohnB
Post Reply