Module:title/getCurrentTitle
පෙනුම
- මෙම module සතුව උපදෙස් උප පිටුවක් නොපවතියි. Please නිර්මාණය කරන්න.
- ප්රයෝජනවත් සබැඳි: root page • root page’s subpages • සබැඳි • transclusions • testcases • sandbox
local get_current_title = mw.title.getCurrentTitle
--[==[
A modified version of {mw.title.getCurrentTitle}, which returns the title object for the current title. If the additional optional parameter {fragment} is given, the returned title object will have that value as the fragment, which is the part of the title that comes after {#}, referring to a specific section on the page (e.g. in {"foo#bar"}, the fragment is {"bar"}).
This is a convenience function, which is generally only useful when dealing with fragment-only links, as these resolve to other sections on the current page (e.g. [[#foo]] is a link to the section "foo" on the current page). If the {fragment} parameter is not needed, it is more efficient to simply call {mw.title.getCurrentTitle} directly.]==]
return function(fragment)
if fragment == nil then
return get_current_title()
end
local current_title = get_current_title()
current_title.fragment = fragment
return current_title
end