Pathologic could optionally add a title attribute to the link tags it works with. The value will be the title of the node that the writer is linking to, if that title is found (the page they link to may not always be a node).

If the path matches "^node/(\d+)$", get the title from {node_revisions} with the nid. Otherwise, try to find the path in {url_alias}, then get the title from {node_revisions}.

If a node title is not found, maybe then Pathologic could navigate the menu tree and try to find a path that matches there…?

Issues: Pathologic should not overwrite the link tag's title attribute (or add a second one) if it already has one…

Comments

dman’s picture

A fine idea.
I'm already doing so in a private module that I built a while ago (and have been extending occasionally since) to do several jobs very similar to pathologic (I think)
I call mine pathfinder :)
I include
- removal of absolute URLs
- Checks for the existence of linked resources, and a heuristic to find moved targets
.. in pre-processing (Saved in the node source), and
- title garnishing and img alt-tag additions in filters.

Anyway. If I can ease my custom one-off regexps out of it (some of them were bulk repair jobs for site moves etc) I may try comparing with something to contribute back to this project...

Garrett Albright’s picture

The idea of un-absoluting absolute URLs struck me too (if you check out the module source code, you'll note a comment to that effect). The problem is that I can't think of a way to do it without either changing the node's source before it goes into the database (as you're doing) or adding a separate field to the node which indicates the $base_path of the site it was saved on. However, if I do either of those things, then Pathologic becomes something other than a simple input filter…

dman’s picture

Because I localize them at input time (not output time) then the problem of keeping track of the original URL-to-remove is not a problem. That doesn't even pollute my database.
... Although I'll admit I do ALSO have that facility, and a setting to that effect, because my problems only began AFTER we'd moved a site around a few times ... and let the editors loose with WYSIWYGs ;-)
That's the 'repair' jobs I was meaning.

I do appreciate that doing it on save is different from a 'simple' input filter, but the process is almost identical ... I just run the filter on nodeapi(update)
... And make sure that the things I do are really permanent, non-cumulative sort of processes :)

Garrett Albright’s picture

For those interested… I actually had this working well in a version of Pathologic. It got titles not only for nodes, but also for users, views… pretty much anything it could find a path for. However, I decided that it diluted Pathologic's purpose too much and took it out. Maybe that code will go in another module some day.

Garrett Albright’s picture

Status: Active » Closed (won't fix)
Garrett Albright’s picture

Bumping this so I remember to actually release that auto-titling module some day.