Editing Module:BSW/MainPage
From the only original and legitimate Battlestar Wiki: the free-as-in-beer, non-corporate, open-content encyclopedia, analytical reference, and episode guide on all things Battlestar Galactica. Accept neither subpar substitutes nor subpar clones.
More actions
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
| Latest revision | Your text | ||
| Line 28: | Line 28: | ||
-- External link via wikitext: [url label] — survives sanitizer | -- External link via wikitext: [url label] — survives sanitizer | ||
local function xlink( frame, url, label ) | local function xlink( frame, url, label ) | ||
return frame:preprocess( ' | return frame:preprocess( '[' .. url .. ' ' .. (label or url) .. ']' ) | ||
end | end | ||
| Line 63: | Line 63: | ||
end | end | ||
-- ── | -- ── hero() ──────────────────────────────────────────────────────── | ||
function p.hero( frame ) | function p.hero( frame ) | ||
local args = frame.args | local args = frame.args | ||
| Line 244: | Line 216: | ||
-- ── photolab() ──────────────────────────────────────────────────── | -- ── photolab() ──────────────────────────────────────────────────── | ||
function p.photolab( frame ) | function p.photolab( frame ) | ||
local args | local args = frame.args | ||
local content | local content = mw.text.trim( args.content or '' ) | ||
local | local prev_url = mw.text.trim( args.prev_url or '' ) | ||
local prev_lbl | local prev_lbl = mw.text.trim( args.prev_label or '‹' ) | ||
local | local next_url = mw.text.trim( args.next_url or '' ) | ||
local next_lbl | local next_lbl = mw.text.trim( args.next_label or '›' ) | ||
-- Caption: use the parent frame's raw (unexpanded) argument to avoid | |||
-- double-processing strip markers from nowiki/apostrophe markup. | |||
-- frame.args values are already expanded by MW before Lua sees them, | |||
-- which corrupts complex markup. Getting via expandTemplate on the | |||
-- raw caption transclusion gives a clean single-pass expansion. | |||
local caption_page = mw.text.trim( args.caption_page or '' ) | local caption_page = mw.text.trim( args.caption_page or '' ) | ||
local caption = '' | local caption = '' | ||
| Line 256: | Line 233: | ||
caption = frame:preprocess( '{{' .. caption_page .. '}}' ) | caption = frame:preprocess( '{{' .. caption_page .. '}}' ) | ||
else | else | ||
-- Fallback: use already-expanded value as-is (may have strip markers | |||
-- in complex captions, but simple text captions will be fine) | |||
caption = args.caption or '' | caption = args.caption or '' | ||
end | end | ||
| Line 267: | Line 246: | ||
local filename = mw.text.trim( content ) | local filename = mw.text.trim( content ) | ||
if filename ~= '' then | if filename ~= '' then | ||
rendered_content = frame:preprocess( | rendered_content = frame:preprocess( | ||
'[[File:' .. filename .. '|center|frameless| | '[[File:' .. filename .. '|center|frameless|400px]]' | ||
) | ) | ||
end | end | ||
end | end | ||
| Line 295: | Line 256: | ||
frame:preprocess( '[[BW:Potd|View project →]]' ) .. | frame:preprocess( '[[BW:Potd|View project →]]' ) .. | ||
'</div>' | '</div>' | ||
local prev_link = prev_url ~= '' and frame:preprocess( '[[' .. prev_url:gsub('^/','') .. '|' .. prev_lbl .. ']]' ) or prev_lbl | |||
local next_link = next_url ~= '' and frame:preprocess( '[[' .. next_url:gsub('^/','') .. '|' .. next_lbl .. ']]' ) or next_lbl | |||
local nav = | local nav = | ||
'<div class="bsw-photo-nav">' .. | '<div class="bsw-photo-nav">' .. | ||
prev_link .. | |||
'<span class="bsw-photo-caption">' .. caption .. '</span>' .. | '<span class="bsw-photo-caption">' .. caption .. '</span>' .. | ||
next_link .. | |||
'</div>' | '</div>' | ||
| Line 444: | Line 408: | ||
'\226\136\158 Video of the Day' .. | '\226\136\158 Video of the Day' .. | ||
'</span>' .. | '</span>' .. | ||
frame:preprocess( ' | frame:preprocess( '[https://battlestarpegasus.com battlestarpegasus.com \226\134\151]' ) .. | ||
'</div>' | '</div>' | ||