Marvel Wiki
Sin resumen de edición
Etiqueta: Revertido
Sin resumen de edición
Etiqueta: Revertido
Línea 761: Línea 761:
 
local galleryItems = {}
 
local galleryItems = {}
 
for _, issue in ipairs(issues) do
 
for _, issue in ipairs(issues) do
  +
local num = issue[ 1 ]
  +
local published = issue[ 2 ] and issue[ 2 ]:gsub( '-', '/' ) or nil
  +
local name = ( '%s %s' ):format( title, num )
  +
local displayDate = published and lang:formatDate( 'j \\d\\e F, Y', published ) or ''
  +
local title = issue[ 3 ] and ( '\'\'%s\'\'' ):format( issue[ 3 ] ) or ''
 
local imageName = name:gsub( ':', '' )
 
local imageName = name:gsub( ':', '' )
galleryItems[#galleryItems + 1] = ('%s.jpg|[[%s]]'):format(issue, issue)
+
local line = ( '%s.jpg|link=%s|[[%s]]<br />%s<br />%s' ):format( name, name, name, title, displayDate )
  +
galleryLines[ #galleryLines + 1 ] = line
 
end
 
end
 
return frame:extensionTag{
 
return frame:extensionTag{

Revisión del 13:12 1 jul 2022

La documentación para este módulo puede ser creada en Módulo:Comics/doc

local p = {}
local h = require("Module:HF")
local SC = require("Module:StaffCorrection")
local standart = require("Module:StandardizedName")
local monthData = mw.loadData( 'Module:Month/data' )
local monthAliases = monthData[1]
local monthNumbers = monthData[2]

local staff_fieldname = {"Writer", "Penciler", "Inker", "Colourist", "Letterer", "AdaptedFrom", "Editor", "CoverArtist", "Editor-in-Chief" }
local staff_singular = {"Writer", "Penciler", "Inker", "Colourist", "Letterer", "Adapted from original material by", "Editor", "Cover Artist", "Editor-in-Chief"}
local staff_plural = {"Writers", "Pencilers", "Inkers", "Colourists", "Letterers", "Adapted Stories", "Editors", "Cover Artists", "Editors-in-Chief"}

local volume_date_first = ''
local volume_date_last = ''

function p.test(frame)
    local getArgs = require('Dev:Arguments').getArgs
    local args = getArgs (frame)
    local dates = { args['Year'], args['Month'], args['Temporada'], args['Lanzado'] }
    local canceled = args['Cancelado']
    local reprint_title = {}
    local reprint_story = {}
    local storytitles = {}
    local s = ''
    local n = ''
    local page = mw.title.getCurrentTitle()

    for i = 1,80 do
        table.insert( reprint_title, standart.lua_standardized_comics_name( args['ReprintOf'..i] ) )
        table.insert( reprint_story, args['ReprintOfStory'..i] )
    end
    
    for i = 1,80 do
        if h.isempty(reprint_title[i]) == false
            then 
                n = reprint_story[i] or '1'
                s = standart.lua_standardized_comics_name(reprint_title[i])
                s = mw.title.new(s):getContent()
                if h.isempty(s) == false
                    then storytitles[i] = string.match(s, '|%s+StoryTitle'..n..'%s+=%s+(.-)\n')
                end
        end
    end
                
    return page.text
    --return p.lua_link_to_publication_category(dates[1], dates[2], dates[3])
    --return mw.text.listToText( storytitles )
    --return mw.text.listToText( reprint_title )
end


function p.appearances_needed(frame)
    local getArgs = require('Dev:Arguments').getArgs
    local args = getArgs (frame)
    local s = args['Appearing'] or ''
    s = mw.text.split(s, '\n', true)
    local output = 0
    
    local empty = { "'''Featured Characters:'''", "* <br/>", "'''Supporting Characters:'''", "* <br/>", 
                    "'''Antagonists:'''", "* <br/>", "'''Other Characters:'''", "* <br/>",
                    "'''Locations:'''", "* <br/>", "'''Items:'''", "* <br/>",
                    "'''Vehicles:'''", "* <br/>"
                  }
    if #s == 14
        then
            for i = 1, #s do
                if s[i] == empty[i]
                    then output = output + 1
                end
            end
    end
    
    if output < 14
        then output = false
        else output = true
    end
    
    return output
end


------------------------------------------------------------------------------------------------
--takes a date and formats it according to the syntax - https://www.mediawiki.org/wiki/Help:Extension:ParserFunctions##time
function p.lua_date_converter(s, t)
    local l = mw.language.new('es')
    local day
    local month
    local year
    local i = 0
    local j = 0
    
    --'To comma' = 'F j, Y', "dash" = 'M-d-Y'
    if h.isempty(t) == true 
        then t = 'Ymd'
    end
    if h.isempty(s) == true
        then s = l:formatDate(t)
        else
            i = string.find(s, '-',1,true)
            j = string.find(s, ', ',1,true)
            if i ~= nil 
                then
                    j = string.find(s, '-',i+1,true)
                    month = string.sub(s, 1, i-1)
                    month = monthNumbers[string.lower( month )] or month
                    day = string.sub(s, i+1, j-1)
                    if #day == 1 then day = "0"..day end
                    year = string.sub(s, j+1, #s)
                    s = l:formatDate(t, day.."-"..month.."-"..year)
                elseif j ~= nil then
                    year = string.sub(s, j+2, #s)
                    i = string.find(s, ' ',1,true)
                    month = string.sub(s, 1, i-1)
                    month = monthNumbers[string.lower( month )] or month
                    day = string.sub(s, i+1, j-1)
                    if #day == 1 then day = "0"..day end
                    s = l:formatDate(t, day.."-"..month.."-"..year)
                else
                    s = l:formatDate(t, s)
            end
    end
    return s
end
function p.date_converter(frame)
    return p.lua_date_converter(frame.args[1], frame.args[2])
end


--compares two dates. Return "true" if 1st date is before the 2nd date, and "false" otherwise.
function p.lua_date_comparison(d1, d2)
    d1 = p.lua_date_converter(d1, 'Ymd')
    if h.isempty(d2) == true
        then d2 = '@'..os.time() --If 2nd date is ommited, then current date is used for comparison.
    end
    d2 = p.lua_date_converter(d2, 'Ymd')

    if d1<=d2 
        then return true
        else return false
    end
end
function p.date_comparison(frame)
    return p.lua_date_comparison(frame.args[1], frame.args[2])
end


--check if comics is canceled or a solicitation
function p.lua_solicit_or_canceled(Lanzado, cancelado)
    if h.isempty(cancelado) == false or (h.isempty(Lanzado) == false and p.lua_date_comparison(Lanzado) == false)
        then return true --it is canceled or a solicitation
        else return false 
    end
end
function p.solicit_or_canceled(frame)
    if p.lua_solicit_or_canceled(frame.args[1], frame.args[2]) == true
        then return 'yes'
        else return ''
    end
end
function p.not_solicit_or_canceled(frame)
    if p.lua_solicit_or_canceled(frame.args[1], frame.args[2]) == false
        then return 'yes'
        else return 'no'
    end
end


--check if comics is recently released/published
function p.lua_recent(Lanzado, month, year, temporada, cancelado)
    local l = mw.language.new('es')
    local current = l:formatDate('Ymd') 
    local s = ''

    if h.isempty(cancelado) == true
        then 
            if h.isempty(month) == true and h.isempty(temporada) == false
                then month = temporada
            end

            if h.isempty(Lanzado) == false
                then 
                    Lanzado = p.lua_date_converter(Lanzado, 'Ymd')
                    if Lanzado>=l:formatDate('Ymd', '- 2 months') and Lanzado<=current
                        then s = true
                    end
                elseif h.isempty(year) == false and h.isempty(month) == false 
                    then
                        Lanzado = p.lua_date_converter(monthAliases[string.lower( month )]..' 1, '..year, 'Ymd')
                    if Lanzado>=l:formatDate('Ymd', '- 2 months') and Lanzado<=current
                        then s = true
                    end
            end
    end
    return s
end
function p.recent(frame)
    return p.lua_recent(frame.args[1], frame.args[2], frame.args[3], frame.args[4], frame.args[5])
end


--returns number of week
function p.lua_release_week(d, t)
    local y
    if h.isempty(t) == true
        then d = 'Semana '..p.lua_date_converter(d, 'W')..', '..p.lua_date_converter(d, 'Y')
        else 
            d = (d-1) * 7 + 1
            y = '01-01-'..p.lua_date_converter('','Y')
            d = p.lua_date_converter(y..' + '..d..' days',  'F j, Y')
    end
    return d
end


--returns release week category
function p.release_week_category(frame)
    local d = frame.args[1] or ''
    if h.isempty(d) == false
        then return '[[Category:'..p.lua_release_week(d)..']]'
        else return ''
    end
end


--returns link to release week category
function p.lua_link_to_release_week_category(d)
    local w
    
    if h.isempty(d) == false
        then
            w = p.lua_release_week(d)
            d = p.lua_date_converter(d,  'F j, Y')
            return '[[:Category:'..w..'|'..d..']]'
        else
            return ''
    end
end
function p.link_to_release_week_category(frame)
    return p.lua_link_to_release_week_category(frame.args[1])
end


--returns publication category
function p.publication_category(frame)
    local year = frame.args[1]
    local month = frame.args[2]
    local temporada = frame.args[3]
    local pagename = standart.lua_remove_the(frame.args[4])
    local s = ''

    if h.isempty(month) == true and h.isempty(temporada) == false
        then month = temporada
    end

    if h.isempty(year) == false 
        then
            if h.isempty(month) == false
                then
                    month = monthAliases[string.lower( month )]
                    s = s..'[[Category:'..year..'|'..month..pagename..']][[Category:'..year..', '..month..']]'
                else
                    s = s..'[[Category:'..year..']]'
            end
            s = s..p.lua_era(year)
    end
    
    return s
end


--returns link to date of publication category
function p.lua_link_to_publication_category(year, month, temporada)
    local s = ''
    
    if h.isempty(month) == true and h.isempty(temporada) == false
        then month = temporada
    end

    if h.isempty(year) == false
        then
            if h.isempty(month) == false
                then
                    month = monthAliases[string.lower( month )]
                    s = '[[:Category:'..year..', '..month..'|'..month..']], [[:Category:'..year..'|'..year..']]'
                else
                    s = '[[:Category:'..year..'|'..year..']]'
            end
    end
    
    return s
end
function p.link_to_publication_category(frame)
    return p.lua_link_to_publication_category(frame.args[1], frame.args[2], frame.args[3])
end


--returns era based on year
function p.lua_era(publicado, t)
    if h.isempty(publicado) == false 
        then
            if h.isempty(t) == true
                then t = ''
                else t = ' '..t
            end
            publicado = tonumber(publicado)
            
            if publicado<1955 then return '[[Category:Edad de Oro'..t..']]' end
            if publicado>=1955 and publicado<1970 then return '[[Category:Edad de Plata'..t..']]' end
            if publicado>=1970 and publicado<1983 then return '[[Category:Edad de Bronce'..t..']]' end
            if publicado>=1983 and publicado<1992 then return '[[Category:Edad de Cobre'..t..']]' end
            if publicado>=1992 then return '[[Category:Edad Moderna'..t..']]' end
        else return ''
    end
end
function p.era(frame)
    return p.lua_era(frame.args[1], frame.args[2])
end


function p.links_to_release_publication_dates(frame)
    local year = frame.args[1]
    local month = frame.args[2]
    local temporada = frame.args[3]
    local release = p.lua_link_to_release_week_category(frame.args[4])
    local canceled = frame.args[5]
    local published = p.lua_link_to_publication_category(year, month, temporada)
    local s = ''
    local s1 = ''
    local s2 = ''
    
    if h.isempty(canceled) == false
        then
            s1 = 'Fecha de Publicación Prevista'
            s2 = 'Fecha de Lanzamiento Prevista'
        else
            s1 = 'Publicado'
            s2 = 'Lanzado'
    end    

    if h.isempty(published) == false 
        then
            if h.isempty(release) == false
                then s = '<table style="width:100%; text-align: center;"><tr style="line-height:1em;"><td style="width:50%;">'..s1..'</td><td style="width:50%;">'..s2..'</td></tr><tr style=" font-size:12px;"><td>'..published..'</td><td>'..release..'</td></tr></table>'
                else s = '<table style="width:100%; text-align: center;"><tr style="line-height:1em;"><td>'..s1..'</td></tr><tr><td style=" font-size:12px;">'..published..'</td></tr></table>'
            end
        elseif h.isempty(release) == false
            then s = '<table style="width:100%; text-align: center;"><tr style="line-height:1em;"><td>'..s2..'</td></tr><tr><td style=" font-size:12px;">'..release..'</td></tr></table>'
    end
    return s
end


----------------------------------------------------------------------------------------------
--events, arcs, storylines
function p.events_and_arcs(frame)
    local eventos = mw.text.split( frame.args[1],"@@@",true )
    local nombres_eventos = mw.text.split( frame.args[2],"@@@",true )
    local arcos = mw.text.split( frame.args[3],"@@@",true )
    local nombres_arcos = mw.text.split( frame.args[4],"@@@",true )
    local storylines = mw.text.split( frame.args[5],"@@@",true )
    local storylines_names = mw.text.split( frame.args[6],"@@@",true ) 
    local i
    local j
    local e = {}
    local a = {}
    local sl = {}
    local s = ''
    
    j = 1
    for i = 1,#evento do
        if h.isempty(evento[i]) == false
            then
                if h.isempty(nombre_evento[i]) == true
                    then nombre_evento[i] = evento[i]
                end
                e[j] = '"[['..evento[i]..'|'..nombre_evento[i]..']]"'
                j = j + 1
        end
    end
    if #e > 0 
        then
            s = '<div style="text-align:center; font-size:10px; font-weight:900; line-height:1em; padding:0.5em 0pt 0.5em 0pt;">Parte de '
            if #e > 1
                then s = s..mw.text.listToText( e )..' eventos'
                else s = s..e[1]..' evento'
            end
            s = s..'</div>'
    end
    
    j = 1
    for i = 1,#arco do
        if h.isempty(arco[i]) == false
            then
                if h.isempty(nombre_arco[i]) == true
                    then nombre_arco[i] = arco[i]
                end
                a[j] = '"[['..arco[i]..'|'..nombre_arco[i]..']]"[[Category:'..arco[i]..']]'
                j = j + 1
        end
    end
    if #a > 0 
        then
            if s ~= '' then s = s..'<div style="clear:both;"></div>' end
            s = s..'<div style="text-align:center; font-size:10px; font-weight:900; line-height:1em; padding:0.5em 0pt 0.5em 0pt;">Parte del '
            if #a > 1
                then s = s..mw.text.listToText( a )..' arcos'
                else s = s..a[1]..' arco'
            end
            s = s..'</div>'
    end

    return s
end


----------------------------------------------------------------------------------------------
function p.getComicsContent(s_page)
    --s_page = standart.lua_standardized_comics_name(s_page)
    local t = mw.title.new(s_page)
    local s = t:getContent()
    local a = {}
    local r_i = {}
    local r_s = {}
    local i = 0
    local j = 1
    
    i = string.find(s,'\n')
    
    while i ~= nil do
        table.insert(a,string.sub(s,j,i-1))
        j = i+1
        i = string.find(s,'\n',j)
    end
    j = 0
    for i=1,#a do
        j = string.find(a[i],'ReprintOf')
        if j ~= nil 
            then
                j = string.find(a[i],'ReprintOfStory')
                if j ~= nil
                    then
                        s = mw.text.trim( mw.ustring.gsub(a[i],'| ReprintOfStory%d+.+=', ''), "\t\r\n\f " )
                        table.insert(r_s, s )
                    else
                        s = mw.text.trim( mw.ustring.gsub(a[i],'| ReprintOf%d+.+=', ''), "\t\r\n\f " )
                        s = standart.lua_standardized_comics_name(s)
                        table.insert(r_i, s )
                end
        end
    end
    
    s = {}
    for i = 1,#r_i do 
        table.insert(s, {r_i[i], r_s[i]})
    end
    return s
end


function p.list_r(frame)
    local l = mw.text.split( frame.args[1],"@@@",true )
    local s_issue = standart.lua_standardized_comics_name(frame.args[2])
    local s_story = frame.args[3]
    local t = {}
    local res = {}
    local i
    local j

    for i = 1,#l-1 do
        t = p.getComicsContent(l[i])
        for j = 1,#t do
            if t[j][1] == s_issue and (h.isempty(s_story) == true or t[j][2] == s_story)
                then table.insert(res, '\n*[['..l[i]..']]')
            end
        end
    end
    
    return table.concat(res)
end


--forms a list of all reprints of specified comics 
function p.list_of_reprints(frame)
    local l = mw.text.split( frame.args[1],"*",true )
    local s_page = standart.lua_standardized_comics_name(frame.args[2])
    local i
    local j
    local l2 = {}
    local s
    local s2

    for i = 1,#l do
        s = mw.text.split( l[i],"@",true )
        for j = 2,79 do
            if h.isempty(s[j]) == false 
                then table.insert(l2, {standart.lua_standardized_comics_name(s[1]), standart.lua_standardized_comics_name(s[j])})
            end
        end
    end

    s = {}
    s2 = ''
    for i = 1,#l2 do
        if l2[i][2] == s_page 
           then table.insert(s, '\n*[['..l2[i][1]..']]')
        end
    end

    return table.concat(s)
end


--display a quote from the original comics without autocategorization 
function p.reprint_quote(frame)
    local l = mw.text.split( frame.args[1],"@@@",true )
    local q = l[1] or ''
    local s = l[2] or ''
    local bq = l[3] or ''
    
    if h.isempty(bq) == false 
        then 
            bq = mw.ustring.gsub(bq, '%[%[Category:.-%]%]', '' )
            return bq
        elseif h.isempty(q) == false 
            then return frame:preprocess( '{{Cita|'..q..'|'..s..'}}' )
            else return ''
    end
end


--returns story title, story title from reprint or story number if none of them exists
function p.StoryTitle(frame)
    local number = frame.args[1]
    local st = frame.args[2] or ''
    local reprint_st = frame.args[3] or ''

    if number % 10 == 1
        then number = number..'st'
        elseif number % 10 == 2-- in (2,22,32,42,52,62,72)
            then number = number..'nd'
            elseif number % 10 == 3 --in (3,23,33,43,53,63,73)
                then number = number..'rd'
                else number = number..'th'
    end
    number = number..' story'
    
    if h.isempty(st) == true
        then st = reprint_st
    end
    
    if h.isempty(st) == false
        then 
            if string.sub(st,1,1) ~= '"'
                then st = '"'..st..'"'
            end
        else
            st = number
    end

    return st
end


-- check if main/textless cover exists
function p.lua_coverExists(s_page, s_type)
    local info = standart.lua_get_title_volume_issue(s_page)
    local cover = ''
    local output = ''

    cover = info.filename.all
    if s_type == 'Sin Texto'
        then cover = cover.." Textless.jpg"
        else cover = cover..".jpg"
    end

    if h.lua_isexists("Archivo:"..cover)
        then output = cover
    end
    
    return output
end
function p.cover(frame)
    local s_page = frame.args[1]
    local s_type = frame.args[2] or 'Sin Texto'
    
    return p.lua_coverExists(s_page, s_type)
end


--get the list of general contributors (cover artists, editors-in-chief, etc.)
function p.GeneralContributors(frame)

    local l = mw.text.split( frame.args[1],"*",true )
    local t = frame.args[2]
    local cat = frame.args["category"]
    local link_name = frame.args["link_name"]
    local needed = frame.args["needed"]
    local t2

    if t == 'Editor-in-Chief'
        then t2 = 'Editors-in-Chief'
        else t2 = t..'s'
    end
    
    if h.isempty(link_name) == true
        then link_name = '[[:Category:Marvel Staff/'..t2..'|'..t..']]'
    end
    l = p.lua_StoryContributors(l, t, cat)
    if h.isempty(l) == false
        then return frame:preprocess( '{{Infobox Line|left = '..link_name..'|right = '..l..'}}' )
        elseif cat == 'yes' and needed ~= 'no'
            then return '[[Category:'..t..' Credit Needed]]'
            else return ''
    end
end

--get the list of general contributors (cover artists, editors-in-chief, etc.)
function p.StoryContributors(frame)
    local l = mw.text.split( frame.args[1],"@",true )
    local l2 = {}
    local t = {"Writer", "Penciler", "Inker", "Colourist", "Letterer", "Adapted Stories", "Editor"}
    local t2 = {}
    local cat = frame.args["category"]
    local needed = frame.args["needed"]
    local link_name
    local i
    local j

    for i = 1,7 do
        if cat == 'yes'
            then
                l2[i] = mw.text.split(l[i],"*",true )
            else
                l[i] = l[i].."|"
                l2[i] = mw.text.split(l[i],"|",true )
        end
        for j = 1,#l2[i] do
            l2[i][j] = mw.text.trim(l2[i][j])
        end        
        l2[i] = p.lua_StoryContributors(l2[i], t[i], cat)
        if i == 6 
            then t2[i] = '[[:Category:Marvel Staff/Adapted Stories|Adapted from original material by]]'
            else t2[i] = '[[:Category:Marvel Staff/'..t[i]..'s|'..t[i]..']]'
        end
    end

    l = ''
    if h.isempty(table.concat(l2)) == true 
        then 
            return ''
        else 
            for i = 1,7 do
                if h.isempty(l2[i]) == false
                    then l = l..frame:preprocess( '{{Infobox Line|left = '..t2[i]..'|right = '..l2[i]..'}}' )
                    elseif cat == 'yes' and i ~= 6 and needed ~= 'no'
                        then l = l..'[[Category:'..t[i]..' Credit Needed]]'
                end
            end
            return l
    end        
end

--transform the list of contributors into infobox lines with or without categorization
function p.lua_StoryContributors(l, t, cat)
    local i
    local v
    local c

    i = 1
    if h.isempty(l) == true
        then return ''
        else 
            while next(l,i) ~= nil do
                v = l[i]
                c = SC.Correction(v)
                if h.isempty(v) == false then 
                    if string.lower(v) == 'uncredited' or string.lower(v) == 'n/a'
                        then l[i] = 'Uncredited'
                        else 
                            l[i] = '[['..c..'|'..v..']]'
                            if cat == "yes" 
                                then l[i] = l[i]..'[[Category:'..c..'/'..t..']]<br>'
                                else l[i] = l[i]..'<br>'
                            end
                    end
                end
                i = i + 1
            end
            return table.concat(l) 
    end
end

-- get the list of images and captions and transform them into gallery of alternate covers
function p.covers(frame)
    local l_covers = mw.text.split( frame.args[1],"@@@",true )   
    local l_captions = mw.text.split( frame.args[2],"@@@",true )
    local s_page = frame.args[3]
    local l = {}
    local c = {}
    local i
    local j
    local k = 0
    local s
    local res = {}
    
    i = 1
    j = 1
    
    s_page = string.gsub(s_page,'/',' ')
    s_page = string.gsub(s_page,':','')
    s_page = string.gsub(s_page,'&#38;','&')
    s_page = string.gsub(s_page,'&#39;',"'")
    s_page = s_page.." Textless.jpg"
    while next(l_covers,i) ~= nil do
        if h.isempty(l_covers[i]) == false 
            then 
                l[j] = l_covers[i]
                c[j] = l_captions[i]
                j = j + 1
        end
        i = i + 1
    end
    
    if l[1] == s_page
        then c[1] = 'Sin Texto'
    end    

    --if (j == 1 or l[1] ~= s_page) and mw.title.new("File:"..s_page).exists == true
    if l[1] ~= s_page and mw.title.new("Archivo:"..s_page).exists == true
        then 
            table.insert(l, 1, s_page)
            table.insert(c, 1, 'Sin Texto')
    end
    
    i = 1
    for j=1,#l do
        s = '<div style="float: left; width: 74px; margin: 2px 8px; border: 1px solid #ff0000; background: #ffc0cb; border-radius:10px; padding: 5px; text-align: center; font-size: 10px; font-weight: 900; line-height: 1.5em;">[[Archivo:'..l[j]..'|60px]]'..c[j]..'</div>'
        if i == 3
            then
                s = s..'<br clear=left>'
                i = 1
            else
                i = i + 1
        end
        table.insert(res, s)
    end
    return table.concat(res)
end

-- get the list of images and captions and transform them into gallery of alternate tpb
function p.tpb(frame)
	local args = frame:getParent().args
	local issues = {}
	local idx = 0
	while true do
		idx = idx + 1
		local issue = args['Reimpresiónde' .. idx]
		if not issue then break end
		issues[#issues + 1] = issue
	end
	local galleryItems = {}
	for _, issue in ipairs(issues) do
		local num = issue[ 1 ]
		local published = issue[ 2 ] and issue[ 2 ]:gsub( '-', '/' ) or nil
		local name = ( '%s %s' ):format( title, num )
		local displayDate = published and lang:formatDate( 'j \\d\\e F, Y', published ) or ''
		local title = issue[ 3 ] and ( '\'\'%s\'\'' ):format( issue[ 3 ] ) or ''
		local imageName = name:gsub( ':', '' )
		local line = ( '%s.jpg|link=%s|[[%s]]<br />%s<br />%s' ):format( name, name, name, title, displayDate )
		galleryLines[ #galleryLines + 1 ] = line
	end
	return frame:extensionTag{
		name = 'gallery',
		content = table.concat(galleryItems, '\n'),
		args = {
			captionalign = 'center'
		}
	}
end

-- get the list of appearances formed by dpl query from a comics issue and replace/move all tags to suppress all categoriztion.
function p.lua_reprint_appearances(l, pagename)
    local j
    local k
    local s1
    local s2
    local s3
    
    l = mw.ustring.gsub(l, '{{[Aa]|(%[%[.-%]%])}}', '%1' )
    l = mw.ustring.gsub(l, '{{[Aa]|(.-)}}', '[[%1]]' )
    l = mw.ustring.gsub(l, '{{[Aa]pn|(%[%[.-%]%]).-}}', '%1' )
    l = mw.ustring.gsub(l, '{{[Aa]pn||.-}}', '' )
    l = mw.ustring.gsub(l, '{{1stas|(%[%[.-%]%])|(.-)}}', '%1 {{g|First appearance as %2}}' )
    l = mw.ustring.gsub(l, '{{[Pp]ossessed|(%[%[.-%]%])|(.-)}}', '%1 {{g|Possessed by %2}}' )
    l = mw.ustring.gsub(l, '{{[Pp]ossessedBy|(%[%[.-%]%])|(.-)}}', '%1 {{g|Possessed by %2}}' )
    l = mw.ustring.gsub(l, '{{[Pp]ossesses|(%[%[.-%]%])|(.-)}}', '%1 {{g|Possesses %2}}' )
    l = mw.ustring.gsub(l, '{{[Ii]mpersonates|(.-)}}', '{{g|Impersonates %1}}' )
    l = mw.ustring.gsub(l, '{{[Mm]minor|||(.-)}}', '{{g|%1}}' )
    j, k = mw.ustring.find(string.lower(l), '{{minor|')
    if j ~= nil 
        then
            s1 = mw.ustring.sub( l, 1, j-1 )
            i = mw.ustring.find(l, '}}')
            s2 = mw.ustring.sub( l, k+1, i-1 )
            s3 = mw.ustring.sub( l, i+2, #l )
            j = mw.ustring.find(s2, '[[',1,true)
            k = mw.ustring.find(s2, ']]',1,true)
            if j ~= nil and k ~= nil
                then
                    s2 = '[['..mw.ustring.sub(s2, j+2, k-1 )..']]'
                else
                    s2 = mw.text.split( s2,"|",true )
                    if #s2 == 3
                        then s2 = '[['..s2[1]..'|'..s2[2]..']] {{g|'..s2[3]..'}}'
                        elseif #s2 == 2
                            then s2 = s2[1]..' {{g|'..s2[2]..'}}'
                            else s2 = s2[1]
                    end
            end
            l = s1..s2..s3
    end
    l = mw.ustring.gsub(l, '{{[Gg]|(%[%[.-%]%])|(.-)}}', '%1 {{g|%2}}' )
    l = mw.ustring.gsub(l, '{{[Gg]|(%[%[.-%]%])}}', '%1' )
    l = mw.ustring.gsub(l, '{{[Gg]reen|(%[%[.-%]%])|(.-)}}', '%1 {{g|%2}}' )    
    l = mw.ustring.gsub(l, '{{[Gg]reen|(%[%[.-%]%])}}', '%1' )
    l = mw.ustring.gsub(l, '({{.-)|(%[%[.-%]%])}}', '%2 %1}}' )
    l = mw.ustring.gsub(l, '{{[Cc]hronology}}', '{{g|[['..pagename..'#Chronology Notes|See chronology]]}}' )
    l = mw.ustring.gsub(l, '{{[Cc]hronoFB}}', '{{g|[['..pagename..'#Chronology Notes|Appears in flashback]]}}' )
    --l = mw.ustring.gsub(l, '{{g|[[#Continuity Notes|See Continuity Notes]]}}', '{{g|[['..pagename..'#Continuity Notes|See Continuity Notes]]}}' )
    j, k = mw.ustring.find(string.lower(l), '{{g|[[#Continuity Notes|See Continuity Notes]]}}',1,true)
    if j ~= nil 
        then
            s1 = string.sub( l, 1, j-1 )
            s2 = '{{g|[['..pagename..'#Continuity Notes|See Continuity Notes]]}}'
            s3 = string.sub( l, k+1, #l )
            l = s1..s2..s3
    end   
    l = mw.ustring.gsub(l, '%[%[Category:.-%]%]', '' )
    l = mw.ustring.gsub(l, '&lt;', '<' )
    l = mw.ustring.gsub(l, '&gt;', '>' )
    return l
end

function p.reprint_appearances(frame)
    local l = mw.text.unstrip( frame.args[1] )
    local pagename = frame.args[2] 
    local h = require("Module:HF")
    local j
    local k
    
    l = mw.text.split(l,'\n')
    for i = 1,#l do
        l[i] = '\n'..p.lua_reprint_appearances(l[i], pagename)
    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 getArgs = require('Dev:Arguments').getArgs
    local args = getArgs (frame)
    local l = mw.text.split(args["list"],"@@@",true)
    local parts = {}
    local above = {}
    local below = {}
    local exclude = args["exclude"]
    local part
    local a
    local b
    local s_page
    local s_imagen
    local s_title
    local i, j, k, f
    local v
    local s
    local t = {}
    local t2 = {}
    local cover
    local textless
    local info = {}
    local title_for_sorting = ''
    local publication_date = ''
    local link = ''
    local output = ''
    local tag = ''

    if h.isempty(exclude) == false
        then exclude = mw.text.split(exclude,";",true)
    end
    
    for i = 1,9 do
        table.insert(parts, tonumber(standart.lua_padded_issue(args['parte'..i])))
        table.insert(above, args['parte'..i..'_arriba'] or '')
        table.insert(below, args['parte'..i..'_abajo'] or '')
    end

    i = 1
    while next(l,i) ~= nil do
        v = mw.text.split(l[i],"*",true)
        i = i + 1
        s_page = v[1]
        s_imagen = v[2]
        s_title = v[3]
        if h.inlist(exclude, s_page) == false
            then
                publication_date = p.lua_link_to_publication_category(v[4], v[5])
        
                info = standart.lua_get_title_volume_issue(s_page)

                link = standart.lua_standardized_link(s_page, 'Comics')
                tag = mw.html.create( 'span' )
                    :css( 'font-weight', 'bold' )
                    :wikitext (link)
                    :done()
                link = tostring(tag)
                
                s = info.filename.all
                cover = s .. '.jpg'
                textless = s ..' Textless.jpg'
                if h.isempty(s_imagen) == true
                    then 
                        if h.lua_isexists('Archivo:'..cover)
                            then s_imagen = cover
                            elseif h.lua_isexists('Archivo:'..textless)
                                then s_imagen = textless
                                else s_imagen = 'No Image Cover.jpg'
                        end
                end
        
                if h.isempty(s_title) == true
                    then s_title = ''
                    else s_title = '<br />"'..s_title..'"'
                end        

                s = info.padded_issue..'@@@'..s_imagen..'{{!}}'..link..s_title..'<br>('..publication_date..')\n'
                table.insert(t,s)
        end
    end
    table.sort(t)
    
    --volume_date_first = string.match(t[1],'<br>%((.+)%)\n')
    --volume_date_last = string.match(t[#t],'<br>%((.+)%)\n')

    part = tonumber(parts[1])
    i = 1
    while i <= #t do
        v = mw.text.split(t[i],"@@@",true)
        i = i + 1
        if h.isempty(part) == true or part == 0
            then table.insert(t2, v[2])  
            else table.insert(t2, {v[1], v[2]}) 
        end
    end

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

function p.volume_dates(frame)
    return volume_date_first..'-'..volume_date_last
end

return p