Jump to content

Module:JCW

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Galobtter (talk | contribs) at 17:23, 13 August 2018 (module). 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)

local p = {}
local mArguments = require('Module:Arguments')
local TableTools = require('Module:TableTools')

function p.main (frame)
	local n = mArguments.getArgs(frame, {parentOnly = true})
	note = n.note
	source = n.source
	local abbrev = {BJL = '[https://beallslist.weebly.com/standalone-journals.htm BJL]', BJLU='[https://beallslist.weebly.com/standalone-journals.htm BJLU]', BPL='[https://beallslist.weebly.com/ BPL]', BPLU='[https://beallslist.weebly.com/ BPLU]'}
	local index = abbrev[source]
	if abbrev[n.source] then
		source = index
	end
	local sourcenote = ''
	if note or source then
		if source and note then sep = ', ' else sep = '' end
		sourcenote = string.format(' (%s%s%s)', source, sep, note)
	end
	text = string.format ('* [[:%s]]%s', n[1], sourcenote)
	n[1] = nil --make next loop only target arguments >=2
	for i, j in ipairs(TableTools.compressSparseArray()) do
		text = text..string.format("** [[:%s]]", j)
	end
end

return p