Module:3D viewer

local p = {}

local utils = require('Module:Utils') local HtmlBuilder = require('Module:HtmlBuilder')

function p.viewer(frame) local args = utils.get_args(frame) local startframe = utils.processArg(args['startframe']) local image = utils.processArg(args['image']) local image_0 = utils.processArg(args['image-0']) local fallback = utils.processArg(args['fallback']) local startframe_class if startframe ~= '' then startframe_class = mw.text.trim(startframe) else startframe_class = utils.expandWikitext('') end local output_view = HtmlBuilder.create('div') .addClass('viewer-3d') .addClass('startframe-' .. startframe_class) .wikitext(fallback) --could this be shortned to .addClass('viewer-3d startframe-' .. startframe_class) ? for i = 0,10 do       local image_n = utils.processArg(args['image-' .. i], '') if image_n ~= '' then span_image_url_n = output_view .tag('span') .addClass('viewer-3d-url-' .. i)               .wikitext(utils.expandWikitext(''))

span_image_map_n = output_view .tag('span') .addClass('viewer-3d-map-' .. i)               .wikitext(utils.expandWikitext('')) end end

local viewer_3d_frame = output_view .tag('div') .addClass('viewer-3d-frame')

local switch_to_2d = output_view .tag('div') .attr('id', 'switch-to-2d')

return tostring(output_view) end

return p