Commit graph

6 commits

Author SHA1 Message Date
jenkins-bot 02203d171c Merge "links: show links in live previews and preserve fragments in links" 2024-10-29 15:51:23 +00:00
Ammarpad fea9546eb1 pygments.links.js: Handle empty wikilinks and pipe trick
Skip empty wikilink `[[]]` and reverse pipe trick `[[|foo]]` where valid
and correct title cannot be generated respectively.

Bug: T368166
Change-Id: I5df409c8aa104d93a62cd5c0dbd671d598b7c79e
2024-10-15 16:46:37 +01:00
Siddharth VP e1a747987f links: show links in live previews and preserve fragments in links
* Use wikipage.content hook event so that links are also applied on
content added through JS tools like live preview, real time preview,
DiscussionTools, etc. (Consider checking the diff with whitespaces
ignored.)
* Preserve fragments (anchors) in links by using mw.Title getUrl().

Bug: T368166
Change-Id: Ib3a4d03abf7401c39bc3261ca2056cce482edb13
2024-10-13 02:05:02 +05:30
Ammarpad ba35957b9b ode-link: Fix link for URLs without protocol
Prepend '//' to relative URLs to turn them to real new (root)
addresses instead of relative paths in current domain

Bug: T368166
Follow-up: I999937c1f6303ecc64adb6285e73a9ce10f67bd8
Change-Id: I2cf901c7b0454517dc93ea8113dcf69832584c08
2024-09-26 20:03:22 +01:00
Siddharth VP 341cd2bc37 Fix bugs in link generation
* Use mw.Title so that template links work for templates outside
template namespace, and so that titles are normalized.
* Use recursion instead of while loop so that both the segments before
and after the inserted link are searched for further linking
possibilities. Among other cases, this fixes the case where a template
link before a wikilink (on the same line) was not working. This also
avoids infinite iteration if mw.Title.newFromText() failed to create a
valid Title object.

Bug: T368166
Bug: T374693
Change-Id: I4d485340928b81df26ca035874422fdb5930710f
2024-09-15 11:57:26 +05:30
Siddharth VP 7fa3abe91e Enable clicking on wikilinks and external links in highlighted code
It's common practise to use [[wikilink]] syntax to mention page names
in comments of JS/CSS/Scribunto code where the links ordinarily don't
work. Using JavaScript to actually make the syntax clickable makes
navigation easier.

{{Templates links}} and external links are also supported.

Bug: T368166
Change-Id: I999937c1f6303ecc64adb6285e73a9ce10f67bd8
2024-06-22 12:35:22 +05:30