Module:Archives

This is an old revision of this page, as edited by Izno (talk | contribs) at 00:26, 15 August 2021 (get something saved). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
p = {}

local function talk_other(demospace, talk)
	if demospace and demospace ~= '' then return demospace end
	
	if mw.title.getCurrentTitle().isTalkPage then return talk end
	
	return nil -- just return nil rather than 'other' since we have no need
end

local function image(builder)
	
end

local function archive_list(builder)
	
end

local function make_title(builder)


end

local function search_box(frame, search, prefix, root, banner,
	search_break, width, label
	)
	if search and search == 'no' then return nil end
	
	local search_prefix = ''
	if prefix and prefix ~= '' then
		search_prefix = prefix
	elseif root and root ~= '' then
		search_prefix = root
	else
		search_prefix = mw.title.getCurrentTitle.fullText .. '/'
	end
	
	local button_label = ''
	
	local inputbox_options = {
		['bgcolor'] = 'transparent',
		['type'] = 'fulltext',
		['prefix'] = search_prefix,
		['break'] = abreak,
		['width'] = width,
		['searchbuttonlabel'] = label
	}
	
		
	local inputbox = frame:extensionTag{
		name = 'inputbox',
		content = [[
		
		
		
		
		
		]]
	}	

	local div = mw.html.create('div')
	div
		:addClass('archives-search')
		:node(inputbox)
	
	return div
end

function prep_search_options (
	search_prefix, root, search_break, search_width, search_label
	)
	
	local label = ''
	if args['search-button-label'] and args['search-button-label'] ~= '' then
		search_button_label = args['search-button-label']
	else
		search_button_label = 'Search archives'
	end
	
	
	return search, prefix, search_break, width, label
	
end

--[[
pass the frame down for a minute because we do a lot of work with a frame

]]
function p._main(args, frame)
	local frame = frame -- data continuity
	local list = args.list
	local list1 = args[1]
	local auto = args.auto
	local root = args.root
	local index = args.index
	local box_width = args['box-width']
	local image = args.image
	local image_alt = args.alt
	local image_link = args.link
	local image_size = args['image-size']
	local collapsed = args.collapsed
	local collapsible = args.collapsible
	local title = args.title
	local archive_list = args.archivelist
	local prefix = args.prefix
	local search = args.search
	
	

	
	
	
	
	
	
	local search_options = {
		
		
		['button_label'] = search_button_label
	}
	
	
	local is_banner = false
	if (args.banner and args.banner == 'yes') or (args.large and args.large == 'yes') then
		is_banner = true
	end
	
	local demospace
	if args.demospace and args.demospace ~= '' then
		demospace = args.demospace
	end
	
	root = mw.html.create()
	root
		:tag('div')
			:addClass('archives plainlinks')
			-- banner is roughly mbox, small is roughly mbox-small
			:addClass(is_banner and 'archives-banner' or 'archives-small')
			-- archives-talk has same-ish styles as tmbox tmbox-notice
			-- base styles are same-ish as ombox ombox-notice
			:addClass(talk_other(demospace, 'archives-talk'))
	
	
end

function p.main(frame)
	return p._main(require('Module:Arguments').getArgs(frame), frame)
end

return p