Builditluc / wiki-tui

A simple and easy to use Wikipedia Text User Interface
https://wiki-tui.net/
MIT License
416 stars 14 forks source link

[FEATURE] Treat non-existent page links like regular text #184

Closed non-descriptive closed 1 year ago

non-descriptive commented 1 year ago

Some pages, especially in a smaller language sections of wikipedia and others, might have non-existent page references, which are only meant to be created. I think it's a good idea to ignore such links for now or maybe display proper error message like for external links.

Describe the solution you'd like Absent page links on wikipedia goes like '/w/index.php?title=PAGE_NAME&action=edit&redlink=1. So we could use it to skip links of that form or show message "page PAGE NAME doesn't exist yet'. Maybe even suggest to open it in browser to write it, but this would require a separate task, since it will require some advanced stuff to do.

Since wiki-tui supports not just wikipedia, but other wikis as well this thing probably should be configure in settings some way like it currently does for language support. For example fandom.com wikis edit link looks a bit different: /wiki/PAGE_NAME?veaction=edit&source=redlink

Steps to reproduce behaviour

  1. Change language to "Esperanto"
  2. Search "Usona Muzeo de Natura Historio"
  3. Select first result
  4. Navigate to the second link that goes by name "Upper West Side" and click it
Builditluc commented 1 year ago

Hey @non-descriptive! Thank you for informing me about those yet-to-be-implemented pages in Wikipedia, didn't know those existed... I think your idea with the displayed message would be really good. We can even add configuration for those "special" links (meaning you can configure them to have a special color, etc.).

Wiki-tui currently kind of supports other wikis running MediaWiki (the program Wikipedia runs on) because they share the same API. In the parser, we don't differentiate between different wikis so the support for them is basic to non-existent (Because they could have different formatting). Until that is worked out I think it would be best to just stick to Wikipedia for now but I already have some ideas on how to support other sites better.

Builditluc commented 1 year ago

Hey, @non-descriptive! I've finished implementing the feature and uploaded it onto the non-existent-pages branch. Whenever a page doesn't exist yet, the following message will be displayed:

Screenshot 2023-06-11 at 06 29 50

Can you check if the feature works on your end?

non-descriptive commented 1 year ago

Works just fine.