Module:Comics

local p = {}

function p.test(frame) local l = mw.text.unstrip( frame.args[1] ) local j   local k    j, k = mw.ustring.find(l, '' ) --l[i] = mw.ustring.gsub(l[i], '(', '%2 %1}}' )       j, k = mw.ustring.find(l[i], '{{.-|')        if j ~= nil and string.sub( l[i], j, k ) ~= '{{g|'             then l[i] = mw.ustring.gsub(l[i], '(', '%2 %1}}' ) end l[i] = mw.ustring.gsub(l[i], '{{chronology}}', '{{g|See chronology}}' ) l[i] = mw.ustring.gsub(l[i], '{{Chronology}}', '{{g|See chronology}}' ) l[i] = mw.ustring.gsub(l[i], '{{chronoFB}}', '{{g|Appears in flashback}}' ) l[i] = mw.ustring.gsub(l[i], '{{ChronoFB}}', '{{g|Appears in flashback}}' ) l[i] = mw.ustring.gsub(l[i], '%[%[Category:.-%]%]', '' ) l[i] = mw.ustring.gsub(l[i], '&lt;(.-)&gt;(.-)&lt;/(.-)&gt;', '<%1>%2' ) l[i] = l[i]..'\n' end return frame:preprocess( table.concat(l) ) end

-- forms a gallery of comics issues in specified volume based on dpl query from vloume category function p.volume(frame) local monthData = mw.loadData( 'Module:Month/data' ) local monthAliases = monthData[1] local l = mw.text.split(frame.args["list"],"@@@",true) local parts = { frame.args["part1"], frame.args["part2"], frame.args["part3"], frame.args["part4"], frame.args["part5"], frame.args["part6"], frame.args["part7"], frame.args["part8"], frame.args["part9"]} local above = { frame.args["part1_above"], frame.args["part2_above"], frame.args["part3_above"], frame.args["part4_above"], frame.args["part5_above"], frame.args["part6_above"], frame.args["part7_above"], frame.args["part8_above"], frame.args["part9_above"] } local below = { frame.args["part1_below"], frame.args["part2_below"], frame.args["part3_below"], frame.args["part4_below"], frame.args["part5_below"], frame.args["part6_below"], frame.args["part7_below"], frame.args["part8_below"], frame.args["part9_below"] } local part local a   local b    local s_page local s_image local s_title local s_year local s_month local s_volume local s_issue local i = 1 local v   local s    local t = {} local t2 = {} local cover local textless local j   local k    local e

while next(l,i) ~= nil do       v = mw.text.split(l[i],"*",true) i = i + 1 s_page = v[1] s_image = v[2] s_title = v[3] s_year = v[4] s_month = monthAliases[string.lower( v[5] )] or v[5] s = s_page s = string.gsub(s,'/',' ') s = string.gsub(s,':',' ') cover = s..".jpg" textless = s.." Textless.jpg" if s_image == nil or s_image == "" then if mw.title.new("File:"..cover).exists == true then s_image = cover elseif mw.title.new("File:"..textless).exists == true then s_image = textless else s_image = "No Image Cover.jpg" end end if s_title == nil or s_title == "" then s_title = "" else s_title = ' "'..s_title..'"' end

e,j,k = string.find(s_page," Vol (%d+) ") s_volume = string.sub(s_page, 1, e)       s_issue = string.sub(s_page, j+1, string.len(s_page)) if tonumber(k) == 1 then s = ""..s_volume.." #"..s_issue.."" else s = ""..s_volume.." Vol "..k.." #"..s_issue.."" end j = string.find(s_issue,"-",1,true) -- -1 issues k = string.find(s_issue,".",1,true) -- point one issues if j == nil then if k ~= nil then s_issue = string.sub(s_issue,1,k-1).."9" s_issue = string.rep("0", 10-#s_issue)..s_issue else s_issue = s_issue.."0" s_issue = string.rep("0", 10-#s_issue)..s_issue end end s = s_issue..'@@@'..s_image..'{{!}}'....s_page..'{{!}}'..s....s_title..' (Category:'..s_year..', '..s_month..'{{!}}'..s_month..' ,'..s_year..')\n' table.insert(t,s) end table.sort(t) i = 1 while i <= #t do       v = mw.text.split(t[i],"@@@",true) i = i + 1 s = v[2] table.insert(t2,s) end

if tonumber(parts[1]) == nil or tonumber(parts[1]) == 0 then return frame:preprocess('{{#tag:gallery|'..table.concat(t2)..'|position=center|captionalign=center|hideaddbutton=true}}') else t = {} i = 1 while i <=#parts do               if i == 1 then j = 1 else j = parts[i-1]+1 end part = tonumber(parts[i]) if part == nil or part == 0 then break else a = above[i] b = below[i] i = i + 1 if part>#t2 then part = #t2 end table.insert(t, a..frame:preprocess('{{#tag:gallery|'..table.concat(t2,"",j,part)..'|position=center|captionalign=center|hideaddbutton=true}}')..b)               end end return table.concat(t) end end

return p