„Modul:Mainpage/Editing” változatai közötti eltérés
Innen: SCWIKI
More actions
Port from starcitizen.tools upstream (test-page staging) |
a magyarítás |
||
| 63. sor: | 63. sor: | ||
local text = head:tag('div'):addClass('home-part__text') | local text = head:tag('div'):addClass('home-part__text') | ||
text:tag('div'):addClass('home-title'):wikitext(' | text:tag('div'):addClass('home-title'):wikitext('Ez egy közösségi wiki, gyere szerkeszteni!') | ||
text:tag('div') | text:tag('div') | ||
:addClass('home-body') | :addClass('home-body') | ||
:wikitext(' | :wikitext('Javíts egy elírást, számot, vagy kezdj egy teljesen új lapot') | ||
-- A div and not a span: an inline element alone on a line is swallowed into | -- A div and not a span: an inline element alone on a line is swallowed into | ||
| 82. sor: | 82. sor: | ||
-- week: the number has to be one the software actually keeps. | -- week: the number has to be one the software actually keeps. | ||
local caption = pad:tag('div'):addClass('home-act__cap') | local caption = pad:tag('div'):addClass('home-act__cap') | ||
caption:tag('span'):addClass('home-act__caplabel'):wikitext(' | caption:tag('span'):addClass('home-act__caplabel'):wikitext('Legutóbbi változtatások') | ||
caption:tag('span'):addClass('home-act__stat'):wikitext( | caption:tag('span'):addClass('home-act__stat'):wikitext( | ||
string.format( | string.format( | ||
'<b>%s</b> | '<b>%s</b> szerkesztő(k) ebben a hónapban', | ||
mw.language.getContentLanguage():formatNum(mw.site.stats.activeUsers) | mw.language.getContentLanguage():formatNum(mw.site.stats.activeUsers) | ||
) | ) | ||
| 98. sor: | 98. sor: | ||
:wikitext(recentChanges()) | :wikitext(recentChanges()) | ||
pad:tag('div'):addClass('home-more'):wikitext('[[Special:RecentChanges| | pad:tag('div'):addClass('home-more'):wikitext('[[Special:RecentChanges|Minden változás megtekintése]]') | ||
return tostring(card) | return tostring(card) | ||
A lap 2026. szeptember 3., 13:39-kori változata
A modult a Modul:Mainpage/Editing/doc lapon tudod dokumentálni
require('strict')
--- @module Mainpage/Editing
--- The invitation to edit, backed by the ten most recent changes.
---
--- The list is the argument: the claim, the proof, and the invitation in one
--- card. Usernames are shown for editor recognition, which is what earns this
--- card the wide column rather than a narrow aside.
---
--- DPL is a parser function with no Lua interface, so its call is built as
--- wikitext and preprocessed. Two of its parameters are unforgiving:
--- * `userdateformat` is lowercased before use, so only lowercase format
--- letters survive — `c` (ISO 8601) is the one that does what is wanted here.
--- * `listseparators` needs a literal `\n` before the row markup, or the row's
--- opening `<div>` runs onto the end of the previous line.
---
--- DPL also forces a one-hour parser cache on any page that calls it, so these
--- rows are FIRST PAINT and the no-JS reading, never the freshness mechanism.
--- The gadget polls the API to keep the list live.
local buttonLua = require('Module:ButtonLua')
local ROW = '<div class="home-act__row">[[%PAGE%]]'
.. '<span class="home-act__by">%USER%</span>'
.. '<time class="home-act__when" datetime="%DATE%">%DATE%</time></div>'
local LIMIT = 10
--- The deploying account, dropped from both halves of the card. Published to
--- the gadget rather than written down twice, because the two filter by
--- different mechanisms: DPL takes a username, the API takes `rcshow=!bot`,
--- and that only excludes a row whose SAVE carried the flag — 94 of this
--- account's rows in the API's own pool did not.
local EXCLUDE_USER = 'Alistar Bot'
local p = {}
--- @return string
local function recentChanges()
local args = {
'namespace=',
'ordermethod=lastedit',
'order=descending',
'notlastmodifiedby=' .. EXCLUDE_USER,
'count=' .. LIMIT,
'addeditdate=true',
'adduser=true',
'userdateformat=c',
'mode=userformat',
'listseparators=,\\n' .. ROW .. ',,',
}
return mw.getCurrentFrame():preprocess('{{#dpl:\n|' .. table.concat(args, '\n|') .. '\n}}')
end
--- @return string
function p.render()
local card = mw.html.create('div'):addClass('t-card'):addClass('home-card--tall')
local pad = card:tag('div'):addClass('home-pad')
local head = pad:tag('div'):addClass('home-part__head')
local text = head:tag('div'):addClass('home-part__text')
text:tag('div'):addClass('home-title'):wikitext('Ez egy közösségi wiki, gyere szerkeszteni!')
text:tag('div')
:addClass('home-body')
:wikitext('Javíts egy elírást, számot, vagy kezdj egy teljesen új lapot')
-- A div and not a span: an inline element alone on a line is swallowed into
-- a paragraph by the parser, and the paragraph then owns the block box
-- instead of the button.
head:tag('div'):addClass('home-part__btn'):wikitext(buttonLua.render({
label = 'Start editing',
link = 'Star Citizen:Editing',
size = 'large',
}))
-- The caption says what the rows below are and carries a figure beside the
-- list it describes. `activeUsers` is MediaWiki's own count of accounts with
-- a logged action in the last 30 days, so the wording says month rather than
-- week: the number has to be one the software actually keeps.
local caption = pad:tag('div'):addClass('home-act__cap')
caption:tag('span'):addClass('home-act__caplabel'):wikitext('Legutóbbi változtatások')
caption:tag('span'):addClass('home-act__stat'):wikitext(
string.format(
'<b>%s</b> szerkesztő(k) ebben a hónapban',
mw.language.getContentLanguage():formatNum(mw.site.stats.activeUsers)
)
)
pad:tag('div')
:addClass('home-act__list')
:attr('data-gadget-mainpage-activity', '1')
:attr('data-gadget-mainpage-activity-limit', tostring(LIMIT))
:attr('data-gadget-mainpage-activity-namespace', '0')
:attr('data-gadget-mainpage-activity-exclude', EXCLUDE_USER)
:wikitext(recentChanges())
pad:tag('div'):addClass('home-more'):wikitext('[[Special:RecentChanges|Minden változás megtekintése]]')
return tostring(card)
end
return p