Module:Sound

From TERMSOFSERVICE
Jump to navigation Jump to search

Documentation for this module may be created at Module:Sound/doc

local  p  =  {}
function  p . base (  f  )

	local  args  =  f
	if  f  ==  mw . getCurrentFrame ()  then 
		args  =  require (  'Module:ProcessArgs'  ). merge (  true  )
	else
		f  =  mw . getCurrentFrame ()
	end
	
	local  wikitext  =  ''

	local  span  =  mw . html . create (  'span'  )
	span  : addClass (  'sound'  )

	local  child  =  span : tag (  'span'  )
	child  : addClass (  'sound-title'  )
	child  : wikitext (  args [ 1 ]  or  ''  )

	local  audio  =  child : tag (  'span'  )
	--- if args[ 'nofallback' ] then
		audio  : css (  'display' ,  'none'  )
	--- else
	--- audio = child
	--- end

	audio  : wikitext (  '[[File:'  ..  (  args [ 2 ]  or  ''  )  ..  '|class=sound-audio]]'  )
	
	wikitext  =  tostring (  span  )

	--- For additional files without Extension:Loops --------

    for  i  =  3  ,  table . getn (  args  ),  1  do
    	span  =  mw . html . create (  'span'  )
		span  : addClass (  'sound'  )
		child  =  span : tag (  'span'  )
		child  : addClass (  'sound-title'  )
		audio  =  child : tag (  'span'  )
		audio  : css (  'display' ,  'none'  )
		audio  : wikitext (  '[[File:'  ..  (  args [ i ]  or  '' )  ..  '|class=sound-audio]]'  )
		wikitext  =  wikitext  ..  tostring (  span  )
    end

    return  wikitext

end

return  p