Jump to content

User talk:Polygnotus/Scripts/Piped.js

Page contents not supported in other languages.
Add topic
From Wikipedia, the free encyclopedia

The script will miss these edge cases:

    • 1. Extra whitespace:**

- ` Page ` (spaces around page name) - `Page ` (trailing space) - ` Page` (leading space) - `Page #anchor` (space before anchor)

    • 2. Underscores vs spaces:**

- If `targetPage` is "Page name", it won't match `Page_name` (though MediaWiki treats these as equivalent)

    • 3. Case sensitivity:**

- The regex uses `/i` flag for case-insensitive matching, but `insource:"${targetPage}"` is case-sensitive - If `targetPage` is "Page" it won't pre-filter `page` correctly - The regex will still match it, but the initial filter might reduce results

    • 4. Namespace variations:**

- `Page` vs `Talk:Page` - if the target has a namespace, the script handles it, but edge cases exist

    • 5. Interwiki links:**

- `en:Page` or `commons:Page` won't match

    • 6. URL encoding in anchor:**

- `Page#Section Name` might behave unexpectedly

    • Most significant issue:** The whitespace variations are common in practice. The underscores issue is less critical since MediaWiki normalizes them, but the search index might not always reflect this normalization.

To fix whitespace, you'd need a more complex regex like `/\\[\\[\\s*${escapedPage}\\s*(#[^\\]|]*)?\\]\\]/i` but CirrusSearch's regex support is limited and this might not work reliably.

Start a discussion about improving the User:Polygnotus/Scripts/Piped.js page

Start a discussion