fink icon indicating copy to clipboard operation
fink copied to clipboard

Add --exclude-link-text=unavailable option?

Open gitressa opened this issue 5 years ago • 8 comments

In some cases, you need to keep a link, even though it is broken, and perhaps add "(unavailable)" to the link text, like this: link text (unavailable).

However, you don't want this known dead link to get checked, so it would be great with an option like --exclude-link=unavailable, which skips links with link texts containing this string. Is this possible?

gitressa avatar Jun 04 '20 12:06 gitressa

I think you can already use --exclude-url which accepts a regex? (e.g. I've used --exclude-url=logout to avoid clicking the logout link)

dantleech avatar Jun 04 '20 16:06 dantleech

Yes, that works fine. But I want to target the link text, not the link. Perhaps check my example again? :-)

gitressa avatar Jun 04 '20 20:06 gitressa

... or do you mean that --exclude-url can also target the link text, not just the URL?

gitressa avatar Jun 08 '20 11:06 gitressa

No, you can't target the link text currently, do that would be a prospective new feature.

dantleech avatar Jun 08 '20 11:06 dantleech

Thanks for clarifying. Do you think it would be worth considering adding such a feature? A pretty good argument and use case for it, is if you have hundreds of links, which you need to keep as reference, though the target link no longer exist. These links don't need to get checked, and in a sense give false positives.

gitressa avatar Jun 08 '20 13:06 gitressa

Possibly, but it fits into the category of filtering, could also support CSS selectors (?) or XPath to capture all scenarios.

dantleech avatar Jun 08 '20 14:06 dantleech

Also adding support CSS selectors or XPaths as filters, on top of the link text would expand the flexibility, so that would be nice as well. So something like adding both --exclude-link-text and --exclude-class options?

gitressa avatar Jun 08 '20 14:06 gitressa

Yes, you could filter on any link property with --exclude-link="contains(text(), 'Foobar')" or similar.

dantleech avatar Jun 08 '20 15:06 dantleech