Wikibooks
siwikibooks
https://si.wikibooks.org/wiki/%E0%B6%B8%E0%B7%94%E0%B6%BD%E0%B7%8A_%E0%B6%B4%E0%B7%92%E0%B6%A7%E0%B7%94%E0%B7%80
MediaWiki 1.48.0-wmf.1
first-letter
මාධ්යය
විශේෂ
සාකච්ඡාව
පරිශීලක
පරිශීලක සාකච්ඡාව
විකිපොත්
විකිපොත් සාකච්ඡාව
ගොනුව
ගොනුව සාකච්ඡාව
මාධ්යවිකි
මාධ්යවිකි සාකච්ඡාව
සැකිල්ල
සැකිලි සාකච්ඡාව
උදවු
උදවු සාකච්ඡාව
ප්රවර්ගය
ප්රවර්ග සාකච්ඡාව
විෂයය
විෂයය සාකච්ඡාව
කණිෂ්ඨ විකි
කණිෂ්ඨ විකි සාකච්ඡාව
TimedText
TimedText talk
Module
Module talk
Event
Event talk
සැකිල්ල:ක්රියා කරවිය හැකි පැනලය/උපදෙස්
10
9728
39451
37264
2026-10-30T02:45:24Z
Lee
15
39451
wikitext
text/x-wiki
{{උපදෙස් උප පිටුව}}
{{template shortcut|CLB2|Click}}
{{lua|Module:ක්රියා කරවිය හැකි පැනලය}}
<!-- ප්රවර්ග පිටුව පහළින් ම එකතු කරන්න. එසේම අන්තර් විකි සබැඳි විකි දත්ත වෙත යොමු කරන්න. -->
This template styles a link like a button, using the mediawiki.ui.button module. This expands the clickable area and tap target for the link. It can be used in the following ways,
*'''Code: '''<code><nowiki>{{ක්රියා කරවිය හැකි පැනලය|Main Page}}</nowiki></code>
**'''Result: '''{{ක්රියා කරවිය හැකි පැනලය|Main Page}}
*'''Code: '''<code><nowiki>{{ක්රියා කරවිය හැකි පැනලය|Main Page|Cover page}}</nowiki></code>
**'''Result: '''{{ක්රියා කරවිය හැකි පැනලය|Main Page|Cover page}}
*'''Code: '''<code><nowiki>{{ක්රියා කරවිය හැකි පැනලය|Main Page|url=http://en.wikipedia.org}}</nowiki></code>
**'''Result: '''{{ක්රියා කරවිය හැකි පැනලය|Main Page|url=http://en.wikipedia.org}}
*'''Code: '''<code><nowiki>{{ක්රියා කරවිය හැකි පැනලය|Main Page|class=mw-ui-destructive}}</nowiki></code>
**'''Result: '''{{ක්රියා කරවිය හැකි පැනලය|Main Page|class=mw-ui-destructive}}
*'''Code: '''<code><nowiki>{{ක්රියා කරවිය හැකි පැනලය|Main Page|class=mw-ui-progressive}}</nowiki></code>
**'''Result: '''{{ක්රියා කරවිය හැකි පැනලය|Main Page|class=mw-ui-progressive}}
'''Note: '''After the changes outlined in Phabricator task {{Phab|T110555}} were implemented, <code><nowiki>{{ක්රියා කරවිය හැකි පැනලය|Main Page|class=mw-ui-constructive}}</nowiki></code> produces the same output as <code><nowiki>{{ක්රියා කරවිය හැකි පැනලය|Main Page|class=mw-ui-progressive}}</nowiki></code>.
=== Template data ===
<templatedata>
{
"params": {
"1": {
"required": true,
"label": "Link/Label",
"description": "Defines the page to link to, and uses that page's title as the text for the button",
"example": "Foobar",
"type": "wiki-page-name"
},
"2": {
"suggested": true,
"label": "Label",
"description": "Defines the text that appears on the button",
"default": "the page being linked to"
},
"url": {
"type": "url",
"label": "URL",
"description": "Defines a web address for the button to link to",
"example": "https://www.example.com"
},
"class": {
"type": "string",
"description": "Defines the visual type of the button",
"example": "mw-ui-progressive, mw-ui-destructive"
},
"style": {
"type": "string",
"label": "Custom CSS styling",
"description": "Allows custom CSS styling to be applied to the button",
"example": "border: 2px solid red;",
"default": "None"
},
"category": {
"type": "boolean",
"label": "Category switch",
"description": "Whether or not categories should be on",
"example": "no",
"default": "yes",
"autovalue": "0"
}
},
"description": "Styles a link like a button, using the mediawiki.ui.button module",
"format": "inline"
}
</templatedata>
=== භාවිතය ===
=== අමතර අවධානයට ===
* [[commons:Template:Clickable button]], corresponding clickable button at Commons.
* [https://design.wikimedia.org/style-guide/components/buttons.html Wikimedia design style guide advice on buttons]
{{Button templates}}
<includeonly>
<!-- මෙයට පහළින් ප්රවර්ග එකතු කරන්න. අන්තර් විකි සබැඳි විකි දත්ත වෙත යොමු කරන්න. -->
[[ප්රවර්ගය:විකිපොත් හැඩගැන්වීම් සහ කාර්ය සැකිලි]]
[[Category:Wikibooks button templates]]
</includeonly>
hcmb2vktgx6es94huyc802vcx4i9wgi
Module:CategoryRename
828
19189
39450
39444
2026-10-29T12:49:43Z
Lee
15
ජෙමිනි සහායෙන් නිර්මාණය
39450
Scribunto
text/plain
local p = {}
-- ඉංග්රීසි වචන සිංහලට හැරවීමේ සහ Regex රටා ගැළපීමේ ශ්රිතය
local function matchRegexRules(currentText)
-- දත්ත පිටුව සම්බන්ධ කර ගැනීම (Protected call මඟින් දෝෂ මඟහරවයි)
local success, rules = pcall(require, "Module:CategoryRename/Data")
if not success or not rules then
return nil
end
for _, rule in ipairs(rules) do
-- ප්රවර්ග නාමය Regex රටාවට ගැළපේදැයි බැලීම
local match = mw.ustring.match(currentText, rule.pattern)
if match then
local finalMatch = match
-- උප-දත්ත කෝෂයක් (Dictionary) පවතී නම්, අදාළ ඉංග්රීසි වචනය සිංහල කරන්න
if rule.dictionary and rule.dictionary[match] then
finalMatch = rule.dictionary[match]
end
-- අවසාන සිංහල නාමය ගොඩනැඟීම
local sName = mw.ustring.gsub(currentText, rule.pattern, rule.replacement)
sName = mw.ustring.gsub(sName, match, finalMatch) -- සිංහල කළ වචනය ආදේශය
return sName
end
end
return nil -- කිසිදු රටාවකට නොගැළපේ නම්
end
function p.renderNotice(frame)
local args = frame:getParent().args
local currentTitle = mw.title.getCurrentTitle()
local currentText = currentTitle.text
local currentPrefixedText = currentTitle.prefixedText
-- 1. පරිශීලකයා අතින් නමක් දී ඇත්නම් එය මුලින්ම ගනී
-- 2. නැතහොත් Regex මඟින් ස්වයංක්රීයව සොයාගනී
local sinhalaName = args[1] or args.sinhala or matchRegexRules(currentText)
-- සිංහල නමක් සොයාගත නොහැකි වූයේ නම් සහ පරිශීලකයාද ලබාදී නැත්නම්
if not sinhalaName or sinhalaName == "" then
return '<div class="alert alert-warning" style="border: 2px solid #f0ad4e; padding: 15px; background-color: #fcf8e3; color: #8a6d3b; border-radius: 5px;">'
.. '⚠️ <strong>දැනුම්දීමයි:</strong> මෙම ප්රවර්ගය සඳහා සිංහල නාමයක් ස්වයංක්රීයව හඳුනාගත නොහැකි විය. කරුණාකර අතින් සිංහල නාමය ඇතුළත් කරන්න. <br>උදා: <code>{{ප්රවර්ගය සිංහලට ගෙනයන්න|සිංහල නම}}</code>'
.. '</div>'
end
local targetTitle = "ප්රවර්ගය:" .. sinhalaName
-- URL එක සකස් කිරීම (Special:MovePage)
local moveUrl = mw.uri.fullUrl('Special:MovePage', {
target = currentPrefixedText,
wpNewTitle = targetTitle,
wpReason = "Regex රටා ඇසුරින් ඉංග්රීසි ප්රවර්ග නාමය සිංහල නාමයට ගෙනයාම."
})
-- HTML නිවේදන කොටුව නිර්මාණය
local html = mw.html.create('div')
html:css({
['border'] = '1px solid #a2a9b1',
['background-color'] = '#f8f9fa',
['padding'] = '12px',
['margin'] = '10px 0',
['border-radius'] = '4px',
['box-shadow'] = '0 1px 4px rgba(0,0,0,0.05)',
['display'] = 'flex',
['justify-content'] = 'space-between',
['align-items'] = 'center',
['flex-wrap'] = 'wrap'
})
-- වම්පස ඇති පණිවිඩය
local messageDiv = mw.html.create('div')
messageDiv:css({ ['flex'] = '1', ['min-width'] = '250px', ['margin-right'] = '15px' })
messageDiv:wikitext('ℹ️ <strong>ප්රවර්ග නාමය සිංහලට හැරවීම:</strong> මෙම ප්රවර්ගය <strong><span style="color: #0b2265;">' .. targetTitle .. '</span></strong> යන සිංහල නාමය වෙත ගෙනයාමට (Rename) යෝජනා කර ඇත.')
-- දකුණුපස ඇති ක්ලිකබල් බොත්තම (Button)
-- මීඩියාවිකි පද්ධතිය තුළ සබැඳිය කැඩී යාම වැළැක්වීමට plainlinks විකී-ලින්ක් ක්රමය භාවිත කර ඇත
local buttonSpan = mw.html.create('span')
buttonSpan:css({
['display'] = 'inline-block',
['background-color'] = '#36c',
['border-radius'] = '2px',
['box-shadow'] = '0 1px 1px rgba(0,0,0,0.1)',
['margin'] = '5px 0',
['white-space'] = 'nowrap'
})
-- බාහිර සබැඳි සලකුණ ඉවත් කර, අකුරු සුදු පැහැ ගන්වා බොත්තමක් ලෙස හැඩගැන්වීම
buttonSpan:wikitext('<span class="plainlinks">[' .. tostring(moveUrl) .. ' <span style="color: #ffffff; font-weight: bold; padding: 8px 16px; display: inline-block; text-decoration: none;">සිංහල නමට ගෙනයන්න</span>]</span>')
-- කොටස් එකතු කිරීම
html:node(messageDiv)
html:node(buttonSpan)
-- ප්රවර්ග පිටුවලට ස්වයංක්රීයව නඩත්තු ප්රවර්ගයක් එකතු කිරීම
local trackingCategory = ""
if currentTitle.namespace == 14 then
trackingCategory = "[[ප්රවර්ගය:සිංහල නාමයන්ට ගෙනයා යුතු ප්රවර්ග]]"
end
return tostring(html) .. trackingCategory
end
return p
08xa4wfc0g0hgwo7q516cntp4dmiezc