Page.GetLinks
is a useful function for fetching all links to other articles in that Wiki. However, it has certain flaws. Namely, the flaw that it extracts links to pages.
What I mean is that, if you want to find all links in one page to a particular section of a page, you're basically out of luck (or rather, you have to write it yourself). By contrast, if the page were a redirect, you get the full page+section link of the redirect when you call Page.RedirectsTo
.
This is because Page.GetLinks
returns a PageList
, not a List<string>
. Since a Page
only can refer to a page rather than a page+section link, this is not useful in many cases.
Page.GetAllLinks
returns links by text, and it also provides page+section links. The problem is that it gets all links. If you're just looking for intra-wiki page+section links, you now have to parse through the results, culling out all the various kinds of links you're not interested in.
There should be a function that operates on the same list of links that Page.GetLinks
does, but by returning the text page+section, rather than a PageList
.
I'll think about it. But it seems fairly easy to select required links from what Page.GetAllLinks() function returns. Like that: