tidy HOW-TO issue

General questions about using TextPad

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

Post Reply
mike_d
Posts: 17
Joined: Mon Dec 01, 2003 9:44 pm
Location: Sonora, CA

tidy HOW-TO issue

Post by mike_d »

setup tidy support per the howto at http://textpad.com/forum/viewtopic.php?t=4768

I get a "cannot jump to item under the cursor" when I doubleclick on the result in the Command Results tab after running the tidy tool to link me back to the correct spot in the source. I've confirmed that my setup is per the instruction.

any ideas, can others get this to work? per the howto sticky about not posting questions in the howto I'm dropping this in here

thanks

mike
mike_d
Posts: 17
Joined: Mon Dec 01, 2003 9:44 pm
Location: Sonora, CA

Post by mike_d »

i need to mention that I'm trying to tidy the output from a 'view source' that has been pumped into textpad, I'm wondering if that might be the problem
schnitzi
Posts: 19
Joined: Mon May 12, 2003 8:36 am

Re: tidy HOW-TO issue

Post by schnitzi »

mike_d wrote:setup tidy support per the howto at http://textpad.com/forum/viewtopic.php?t=4768

I get a "cannot jump to item under the cursor" when I doubleclick on the result in the Command Results tab after running the tidy tool to link me back to the correct spot in the source. I've confirmed that my setup is per the instruction.

any ideas, can others get this to work? per the howto sticky about not posting questions in the howto I'm dropping this in here

Haven't installed tiny, but if you post an example of the line you're trying to match, and what the "Regular expression to match output" is, I'm sure that I or any of the other countless regexp geeks here can figure out the problem. ;-)
mike_d
Posts: 17
Joined: Mon Dec 01, 2003 9:44 pm
Location: Sonora, CA

Post by mike_d »

i did a "view source" on this page, textpad is the recieving app.

when i hit ctrl-5 to launch tidy i get this in the command results output tab:

line 398 column 248 - Warning: nested emphasis <span>
line 434 column 35 - Warning: '<' + '/' + letter not allowed here
line 434 column 50 - Warning: '<' + '/' + letter not allowed here
line 434 column 151 - Warning: '<' + '/' + letter not allowed here
line 434 column 206 - Warning: '<' + '/' + letter not allowed here
line 434 column 212 - Warning: '<' + '/' + letter not allowed here

my config|tools is setup per the link in the first post, but I'll cut and paste it in here too:

command: C:\Program Files\TextPad 4\tidy\tidy.exe
params: errors -quiet $File
initial folder: $FileDir
capture output and sound alert checked on, all others off
reg exp: ^line \([0-9]+\) column \([0-9]+\) -
file: blank
line: 1
col: blank

I've played with col being both blank and 1 per some other posts i found when searching these forums but there was no operational difference. <note to self> I really need to dig in on reg exp's...

allright reg exp geeks, work your magic

edit:
C:\Program Files\TextPad 4\tidy>tidy -v
HTML Tidy for Windows released on 1st January 2004

http://tidy.sourceforge.net
User avatar
MudGuard
Posts: 1295
Joined: Sun Mar 02, 2003 10:15 pm
Location: Munich, Germany
Contact:

Post by MudGuard »

Check whether you have enabled Posix syntax for regexes

Configure - Preferences - Editor
then there is a checkbox "Use Posix Regular expression Syntax.

If that's the case, remove the \ at the ( and )
so your Regex looks like
^line ([0-9]+) column ([0-9]+)

sometimes (I don't really know under which conditions) it was necessary that the regex covers the whole line, so try adding

.*$
to the end of it.
mike_d
Posts: 17
Joined: Mon Dec 01, 2003 9:44 pm
Location: Sonora, CA

Post by mike_d »

almost a winnah! the line # parses correctly but the column in not working. tried col setting in prefs at blank, 1, 2, 3, and 4 with no luck

any suggestions?
User avatar
MudGuard
Posts: 1295
Joined: Sun Mar 02, 2003 10:15 pm
Location: Munich, Germany
Contact:

Post by MudGuard »

try adding a blank after the ) for the column
mike_d
Posts: 17
Joined: Mon Dec 01, 2003 9:44 pm
Location: Sonora, CA

Post by mike_d »

trying it with adding a space after so that it looked like this:

'^line ([0-9]+) column ([0-9]+) ' (without the ' )

as well as without the extra space at the end of the line

still doesn't match the column
schnitzi
Posts: 19
Joined: Mon May 12, 2003 8:36 am

Post by schnitzi »

mike_d wrote:trying it with adding a space after so that it looked like this:

'^line ([0-9]+) column ([0-9]+) ' (without the ' )

as well as without the extra space at the end of the line

still doesn't match the column

Hmm, it looks right. Something I always try in these situations:
copy and paste this "Regular expression to match output" into a
regular old search window, and see if the search finds these output
lines your are talking about. Remember to click "Regular expression"
on the Search popup. You can trim off pieces of the regular expression
until you see what the problem is.
schnitzi
Posts: 19
Joined: Mon May 12, 2003 8:36 am

Post by schnitzi »

schnitzi wrote: Hmm, it looks right. Something I always try in these situations:
copy and paste this "Regular expression to match output" into a
regular old search window, and see if the search finds these output
lines your are talking about. Remember to click "Regular expression"
on the Search popup. You can trim off pieces of the regular expression
until you see what the problem is.
Actually, I just tried it with the example you gave. The first
regular expression you gave seems to work correctly:

^line \([0-9]+\) column \([0-9]+\) -

The Line register should be '1' and the Column should be '2'. (These
correspond to the first part of the regexp that's between parens,
and the second.)
mike_d
Posts: 17
Joined: Mon Dec 01, 2003 9:44 pm
Location: Sonora, CA

Post by mike_d »

Thanks schnitzi and MudGuard,

Did abit of experimenting and found that the first search regexp would not match because I had configure|preferences|editor|use posix regexp checked on.

when i checked that off and reran tidy i got a match on the line, the line info ("Warning: trimming empty") passed to the status bar and it positions on the column, but the position is never correct.

for instance in the command results tab, clicking "line 439 column 47 - Warning: trimming empty <noscript>" takes me to line 439 in the source but to column 75 vs the "more correct" column 47.

Just so I'm understanding the tool setup line column logic, in the reg exp I'm giving it the since I've got line setup as 1 it uses the value that returns in the first set of parens via ^line \([0-9]+\), where the \( and \) place ( and ) in the return - is this correct?

The help section for "Regular Expressions to Match Compilation Errors" is kinda weak in explaining how the file/line/column logic works.
mike_d
Posts: 17
Joined: Mon Dec 01, 2003 9:44 pm
Location: Sonora, CA

Post by mike_d »

upgraded to 4.7.2 and it now works, thanks to all for the help
schnitzi
Posts: 19
Joined: Mon May 12, 2003 8:36 am

Post by schnitzi »

mike_d wrote: Just so I'm understanding the tool setup line column logic, in the reg exp I'm giving it the since I've got line setup as 1 it uses the value that returns in the first set of parens via ^line \([0-9]+\), where the \( and \) place ( and ) in the return - is this correct?

That is correct, and 2 would be what's in the second set of \( \) 's,
etc. Agreed, there's no good doc under the "Replacement expression"
help -- it's explained better under the general "Regular Expression"
help:

Tagged Expressions
A tagged expression is an RE that starts with the pair \( and ends with the pair \). There can be up to nine such expressions in a complete RE. Such an expression matches the same as the expression without the surrounding \( and \). The first expression defined in this way can be referenced as \1 later in the RE, and so on up to \9 for the ninth tagged expression. Each such reference matches the same string as its original tagged expression. For example \(tu\) \1 matches the string "tu tu".
Post Reply