Re: How to get the title as text of a html file
Re: How to get the title as text of a html file
- Subject: Re: How to get the title as text of a html file
- From: has <email@hidden>
- Date: Sat, 2 Mar 2002 00:27:01 +0000
Victor Yee wrote:
>
> Below is a slightly modified version of your handler. Strictly speaking,
>
> the >title< element could appear anywhere in the head, so rather than
>
> checking an arbitrary number of tags (20)
>
>
Well, I did say "reasonable" ;)
It's html. I don't think "reason" ever came into it; at least not anywhere
between 1995 and 2000. And a lot of folks - not to mention GUI html editors
- still seem to code that way, even now. ;)
>
> it's better to keep looking to the end of the head element.
>
>
Probably better to look for the beginning of the body or frameset element. I
>
believe that it's allowable to have the head implicitly closed this way.
It's true that browsers seem to allow this. (Browsers seem designed to
allow almost any amount of lunacy.) Whether or not proper html standards do
is another question. Still, it shouldn't cause a problem even if the thing
ends up looking to end of file.
>
>I've also allowed for the possibility of the
>
> title element having attributes by using "begins with" rather than "is" for
>
> the comparison.
>
>
I'm not sure that attributes are allowed in the title element, but it's been
>
awhile since I checked the standards, so I could be wrong. Then again, the
>
standards are so often broken that it probably is best to be flexible.
I checked the attributes for HTML4 here - there's a couple attributes that
appear to be allowable for >title<
>
In any case, it looks like the original poster decided to use the offset
>
command
>
in their script instead...
That's [potentially] very risky since 'offset' is case sensitive. (Only
XHTML specifies lowercase tags; earlier standards - not to mention
non-standard html - allow tags to be either upper or lower case.) I must've
missed that post; however I'd recommend they use your handler (or my
variation), unless they're _sure_ they're only dealing with XHTML.
.
>
But I did like your changes :)
Merely a matter of refinement. But, you're welcome. :)
has
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.