VOOZH about

URL: https://minecraft.wiki/w/Module:Featured

⇱ Module:Featured – Minecraft Wiki


Module:Featured

From Minecraft Wiki
Jump to navigation Jump to search
Documentation[create] [purge]
This module has no documentation. If you know how to use this module, please create it.
localp={}
functionp.isFeatured(frame)
localcurrent_page_title=frame.args[1]ormw.title.getCurrentTitle().prefixedText
localcurrent_year=tonumber(frame:preprocess("{{#time:o}}"))
localcurrent_week=tonumber(frame:preprocess("{{CURRENTWEEK}}"))
localquery=bucket("featured_article")
.select("type","year","week")
.where("title",current_page_title)
.run()
ifnotqueryor#query==0then
return""
end
for_,rowinipairs(query)do
localarticle_type=row.type
localentry_year=tonumber(row.year)
localentry_week=tonumber(row.week)
localcadence=(article_type=="Minecraft")and1or2
localactive_week=current_week
ifcadence==2then
ifcurrent_year>2025oractive_week>=14then
active_week=active_week-(active_week%2)
end
end
ifentry_year==current_yearandentry_week==active_weekthen
returntrue
end
end
return""
end
localfunctiongetFeaturedDateRangeVariables(frame)
localcurrent_page_title=frame.args[1]ormw.title.getCurrentTitle().prefixedText
localquery=bucket("featured_article")
.select("type","year","week")
.where("title",current_page_title)
.run()
ifnotqueryor#query==0then
return""
end
localrow=query[1]
localarticle_type=row.type
localyear=tonumber(row.year)
localweek=tonumber(row.week)
localcadence=(article_type=="Minecraft")and1or2
localdays_to_add=(cadence*7)-1
localstart_time_str=string.format("%04d-W%02d-1",year,week)
localend_time_str=string.format("%04d-W%02d-1 + %d days",year,week,days_to_add)
locallang=mw.getContentLanguage()
localstart_iso=lang:formatDate("c",start_time_str)
localend_iso=lang:formatDate("c",end_time_str)
localstart_fallback=lang:formatDate("F j, Y",start_time_str)
localend_fallback=lang:formatDate("F j, Y",end_time_str)
returnstart_iso,end_iso,start_fallback,end_fallback
end
functionp.getFeaturedDateRangeUTC(frame)
localstart_iso,end_iso,start_fallback,end_fallback=getFeaturedDateRangeVariables(frame)
ifnotstart_fallbackthen
return""
end
returnstring.format(
'%s – %s',
start_fallback,end_fallback
)
end
functionp.getFeaturedDateRangeLocalTime(frame)
localstart_iso,end_iso,start_fallback,end_fallback=getFeaturedDateRangeVariables(frame)
ifnotstart_fallbackthen
return""
end
returnstring.format(
'<time datetime="%s" class="localized-time" data-year-format="numeric" data-month-format="long" data-day-format="numeric">%s</time> &ndash; <time datetime="%s" class="localized-time" data-year-format="numeric" data-month-format="long" data-day-format="numeric">%s</time>',
start_iso,start_fallback,end_iso,end_fallback
)
end
returnp
Retrieved from "https://minecraft.wiki/w/Module:Featured?oldid=3479276"

Navigation menu