Proper syntax for URL Rewriter on Wikipedia for article sections Topic is solved

Add-ons for Pale Moon and other applications
General discussion, compatibility, contributed extensions, themes, plugins, and more.

Moderators: FranklinDM, Lootyhoof

User avatar
Mæstro
Lunatic
Lunatic
Posts: 463
Joined: 2019-08-13, 00:30
Location: Casumia

Proper syntax for URL Rewriter on Wikipedia for article sections

Unread post by Mæstro » 2023-02-12, 03:44

I use URL Rewriter. I do not know how regular expressions work, so I use the following wildcard settings:
  • Include URL *wikipedia.org/*
  • Exclude URL *wikipedia.org/*?useskin=monobook
  • Redirect To $1wikipedia.org/$2?useskin=monobook
For ordinary links, this works well. Alas, a link to an article section (noted by a hash) will redirect to the new theming: the correct syntax has the hash and its string at the end. Would anybody know how, in URL Rewriter, to mend this: a proper include/exclude pattern that would treat these and ordinary links alike as they ought?
Browser: Pale Moon (Pusser’s repository for Debian)
Operating System: Linux Mint Debian Edition 4 (amd64)
※Receiving Debian 10 LTS security upgrades
Hardware: HP Pavilion DV6-7010 (1400 MHz, 6 GB)
Formerly user TheRealMaestro: æsc is the best letter.

User avatar
jobbautista9
Keeps coming back
Keeps coming back
Posts: 782
Joined: 2020-11-03, 06:47
Location: Philippines
Contact:

Re: Proper syntax for URL Rewriter on Wikipedia for article sections

Unread post by jobbautista9 » 2023-02-12, 03:53

This wildcard should work for links that have section names in it:
  • Include URL *wikipedia.org/*#*
  • Exclude URL *wikipedia.org/*?useskin=monobook#*
  • Redirect To $1wikipedia.org/$2?useskin=monobook#$3
Image

merry mimas

XUL add-ons developer. You can find a list of add-ons I manage at http://rw.rs/~job/software.html.

Mima avatar by 絵虎. Pixiv post: https://www.pixiv.net/en/artworks/15431817

Image

User avatar
Mæstro
Lunatic
Lunatic
Posts: 463
Joined: 2019-08-13, 00:30
Location: Casumia

Re: Proper syntax for URL Rewriter on Wikipedia for article sections

Unread post by Mæstro » 2023-02-12, 04:06

What you offer redirects to the correct page with the proper skin, but for both example links, it is always to its header (as though the hash’s string were stripped away), not the intended section (example result).
Browser: Pale Moon (Pusser’s repository for Debian)
Operating System: Linux Mint Debian Edition 4 (amd64)
※Receiving Debian 10 LTS security upgrades
Hardware: HP Pavilion DV6-7010 (1400 MHz, 6 GB)
Formerly user TheRealMaestro: æsc is the best letter.

User avatar
jobbautista9
Keeps coming back
Keeps coming back
Posts: 782
Joined: 2020-11-03, 06:47
Location: Philippines
Contact:

Re: Proper syntax for URL Rewriter on Wikipedia for article sections

Unread post by jobbautista9 » 2023-02-12, 04:25

That's weird, both example links redirect correctly with my wildcard. Are we using the same URL Rewriter? (I'm using the one by papush, versioned at 2.8.4)
Image

merry mimas

XUL add-ons developer. You can find a list of add-ons I manage at http://rw.rs/~job/software.html.

Mima avatar by 絵虎. Pixiv post: https://www.pixiv.net/en/artworks/15431817

Image

User avatar
Mæstro
Lunatic
Lunatic
Posts: 463
Joined: 2019-08-13, 00:30
Location: Casumia

Re: Proper syntax for URL Rewriter on Wikipedia for article sections

Unread post by Mæstro » 2023-02-12, 05:05

Yes, we are using the same version. I am using the redirect you have given together with the one I had listed at first, for if I do not use mine, then ordinary Wikipedia articles will not redirect as wished. (What you had given works as intended in isolation.) I cannot see how to add more than one exclusion pattern to it, as I think could cure this. Semicolons fail.
Browser: Pale Moon (Pusser’s repository for Debian)
Operating System: Linux Mint Debian Edition 4 (amd64)
※Receiving Debian 10 LTS security upgrades
Hardware: HP Pavilion DV6-7010 (1400 MHz, 6 GB)
Formerly user TheRealMaestro: æsc is the best letter.

User avatar
jobbautista9
Keeps coming back
Keeps coming back
Posts: 782
Joined: 2020-11-03, 06:47
Location: Philippines
Contact:

Re: Proper syntax for URL Rewriter on Wikipedia for article sections

Unread post by jobbautista9 » 2023-02-12, 05:16

Ahh, yeah. I didn't consider both rules being used at the same time. Unfortunately I don't know how I could do multiple exclude rules with this extension, sorry. :(
Image

merry mimas

XUL add-ons developer. You can find a list of add-ons I manage at http://rw.rs/~job/software.html.

Mima avatar by 絵虎. Pixiv post: https://www.pixiv.net/en/artworks/15431817

Image

User avatar
andyprough
Astronaut
Astronaut
Posts: 699
Joined: 2020-05-31, 04:33

Re: Proper syntax for URL Rewriter on Wikipedia for article sections

Unread post by andyprough » 2023-02-12, 05:38

Mæstro wrote:
2023-02-12, 05:05
cannot see how to add more than one exclusion pattern to it, as I think could cure this. Semicolons fail.
I wrote a post awhile back about doing multiple excludes with the pipe symbol, don't know if it would help you in this case: viewtopic.php?p=226322#p226322

User avatar
Mæstro
Lunatic
Lunatic
Posts: 463
Joined: 2019-08-13, 00:30
Location: Casumia

Re: Proper syntax for URL Rewriter on Wikipedia for article sections

Unread post by Mæstro » 2023-02-12, 16:43

This works! More precisely, changing my initial exclusion pattern to *wikipedia.org/*?useskin=monobook|#* shuts out correctly framed sites, so this, working with Jobb’s pattern, directs all Wikipedia links where I would. This is the second time this thread on WebComponents had helped me. (The other was when I had had problems with the Archive and Fanbox.) I wish that I could mark you both as having solved my problem.
Browser: Pale Moon (Pusser’s repository for Debian)
Operating System: Linux Mint Debian Edition 4 (amd64)
※Receiving Debian 10 LTS security upgrades
Hardware: HP Pavilion DV6-7010 (1400 MHz, 6 GB)
Formerly user TheRealMaestro: æsc is the best letter.

User avatar
andyprough
Astronaut
Astronaut
Posts: 699
Joined: 2020-05-31, 04:33

Re: Proper syntax for URL Rewriter on Wikipedia for article sections

Unread post by andyprough » 2023-02-13, 02:25

Mæstro wrote:
2023-02-12, 16:43
This works! More precisely, changing my initial exclusion pattern to *wikipedia.org/*?useskin=monobook|#* shuts out correctly framed sites, so this, working with Jobb’s pattern, directs all Wikipedia links where I would.
Wow! I use URL Rewriter to redirect all Wikipedia links to the privacy friendly alternative Wikiless.org, and with the change in Wikipedia formatting my Wikiless pages were a big mess. Now I used your solution and edited in Wikiless and everything looks great again!

Include URL */en.wikipedia.org/*#*
Redirect To $1/wikiless.org/$2?useskin=monobook#$3

And wikiless is a mess because (I assume) of what wikipedia changed, so wikiless links are now (mostly) fixed with:

Include URL *wikiless.org/*?lang=en
Redirect To $1wikiless.org/$2?useskin=monobook

Locked