Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Module:Realpath: Difference between revisions

From CHIPPS
Created page with "return {realpath = function(frame) return mw.title.new(frame.args[1]).redirectTarget or frame.args[1] end}"
 
No edit summary
 
Line 1: Line 1:
return {realpath = function(frame)
function realpath(page)
     return mw.title.new(frame.args[1]).redirectTarget or frame.args[1]
  target = mw.title.new(page).redirectTarget
   end}
    if target
    then
      return target.prefixedText
    else
      return page
    end
end
 
return {
  realpath = function(frame)
     return realpath(frame.args[1])
  end,
  realpath_list = function(frame)
    consist = frame.args[1]
    realpathed_consist = string.gsub(consist, "[^ ;][^;]+", realpath)
    return realpathed_consist
   end
}

Latest revision as of 10:49, 19 September 2026

Documentation for this module may be created at Module:Realpath/doc

function realpath(page)
  target = mw.title.new(page).redirectTarget
    if target
    then
      return target.prefixedText
    else
      return page
    end
end

return {
  realpath = function(frame)
    return realpath(frame.args[1])
  end,
  realpath_list = function(frame)
    consist = frame.args[1]
    realpathed_consist = string.gsub(consist, "[^ ;][^;]+", realpath)
    return realpathed_consist
  end
}