From cc9d19fbb55f505b23a4dcc7283ff4675c81b6e1 Mon Sep 17 00:00:00 2001 From: Caleb Sander <caleb.sander@gmail.com> Date: Mon, 9 Nov 2020 12:02:49 -0800 Subject: [PATCH] Add notes about special links to Wiki Game spec --- specs/wiki-game/wiki-game.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/specs/wiki-game/wiki-game.md b/specs/wiki-game/wiki-game.md index 36c227a..05d47c9 100644 --- a/specs/wiki-game/wiki-game.md +++ b/specs/wiki-game/wiki-game.md @@ -38,6 +38,18 @@ The string that comes before the next `"` character is the article being linked The full URL of an article is `https://en.wikipedia.org/wiki/ARTICLE`; for example, the URL for the Unicode article is https://en.wikipedia.org/wiki/Unicode. You can use Node.js's [`https.get()`](https://nodejs.org/api/https.html#https_https_get_options_callback) function to make the requests. +There are a few types of links that need special handling: +- Links to special Wikipedia pages, e.g. `href="/wiki/Template:Latin_alphabet_sidebar"`. + You can identify these links by the `:`. + They aren't real pages, so you should skip them. +- Links to sections on the same page, e.g. `href="#History"`. + You can identify these links by the `#` at the start of the link. + Again, since the link points to the same page, you don't need to follow it. +- Links to sections on other pages, e.g. `href="/wiki/Article_(grammar)#Indefinite_article"`. + You can identify these links by the `#` in the middle of the link. + To follow this link, remove the part starting with `#`. + In this example, that would be `/wiki/Article_(grammar)`. + ## Implementing the Wikipedia search The general idea is to start at the source article, follow each link to another Wikipedia article, and stop upon reaching the target article. -- GitLab