Re: Tex-Edit, select only HTML lines?
Re: Tex-Edit, select only HTML lines?
- Subject: Re: Tex-Edit, select only HTML lines?
- From: Rachel <email@hidden>
- Date: Mon, 03 Sep 2001 08:45:05 -0600
Thanks, Timothy for explaining what greps is (I thought it was something a
baby did).
Just goofing around I made this discovery:
script: Color Label text
tell window 1 of application "Tex-Edit Plus"
repeat with i from 1 to (count lines)
if line i starts with "<A" then
select (characters 60 thru end of line i)
replace selection looking for ">^*<" replacing with "^*"
replacing with styles {color:blue}
end if
end repeat
repeat with i from 1 to (count lines)
if line i starts with "<A" then
select (characters 60 thru end of line i)
replace selection looking for ">" replacing with ">" replacing
with styles {color:black}
end if
end repeat
repeat with i from 1 to (count lines)
if line i starts with "<A" then
select (characters 60 thru end of line i)
replace selection looking for "<" replacing with "<" replacing
with styles {color:black}
end if
end repeat
end tell
You see I had to separate the 3 replace statements into each loop, I guess
three's a crowd. Possibly someone can tell me why and also how to squeeze
this into one loop..
Rachel
http://www.gnarlodious.com/
Entity Timothy Bates spoke thus:
>
On 9/2/01 11:30 PM, "Rachel" <email@hidden> wrote:
>
> I said: "replace selection looking for ">^*<" replacing with "^*"
>
> replacing with styles {color:blue}"
>
> however I do not want to color the ">" and "<" characters. How do I select
>
> only the text between them?
>
tex-edit is pretty hopeless at this because it does not support grep - so
>
you can't pull out parts of a find
>
>
In grep you would say (<)([^>]*)(>) and get these three things separately.
>
Of course grep is not very understanding of styled text :-)
>
>
So, don't use the find replace metaphor (even though it is way quick).
>
Instead, you can work through the text as a string of objects. BUT, if your
>
goal is to colorize html, I recommend using Pepper (a text editor which does
>
this instantly as a matter of course (as well as genuine state-machine based
>
syntax highlighting in almost any ocmptuer language).
>
>
www.hekkelman.com
>
>
Or, if you want to stay with Tex-Edit (which a fantastic app across the
>
board) then check out the example colorize script that comes with Tex-Edit:
>
it solves your "things inside angle brackets> needs.