Jump to content
Wikipedia The Free Encyclopedia

Module:Sandbox/Perryprog/xlink

From Wikipedia, the free encyclopedia
Module documentation[view] [edit] [history] [purge]
This module is rated as pre-alpha. It is incomplete and may or may not be in active development. Do not use it in article namespace pages. A module remains in pre-alpha until its developer, or another editor who adopts it if it is abandoned for some time, considers the basic structure complete.

Background

[edit ]

Eventually I want the loose equivalent of a {{xsign }} for all the different special-link-templates I use (I tend to avoid the external link syntax). The end goal is to be able to say something like {{subst:xlink|URL here}}, and depending on the pattern the URL matches it would emit wikitext (assuming substitution works out well—I wouldn't be surprised if it's impossible) for either {{diff2 }}, {{diff4 }}, {{oldid }}, and others as time goes on.

Small shorter-term TODO:

  • Actually learn how substitution depth works and all that jazz. (See here , which was from substituting the #invoke call.)
  • Given [DiffURL label], emit {{diff2|id|label}}
  • Given [DiffURL#section label], emit {{diff2|id|section|label}}
  • Have a less-strict match (e.g., URL param order) for diff-urls with oldid=prev.
  • Switch to {{diff4 }} if a numerical value for oldid is present.
    • And also check if that template or its docs needs fixing, because every time I use it I get the parameters backwards...

Longer-term TODO:

  • A lot.
The above documentation is transcluded from Module:Sandbox/Perryprog/xlink/doc. (edit | history)
Editors can experiment in this module's sandbox (create | mirror) and testcases (create) pages.
Subpages of this module.

 localp={}
 localprevDiffStart="https://en%.wikipedia%.org/w/index%.php%?title=.-&diff=prev&"

 functionp.xlink(frame)
 -- https://en.wikipedia.org/w/index.php?title=User_talk:Perryprog&diff=prev&oldid=999347924&diffmode=source
 -- Should become {{diff2|999347924}}
 localmatch=string.match(frame.args[1],prevDiffStart.."oldid=(%d+)")
 returnframe:expandTemplate({title="Diff2",args={match}})
 end

 returnp

AltStyle によって変換されたページ (->オリジナル) /