For faster navigation, this Iframe is preloading the Wikiwand page for Modulo:Bildgalerio.

Modulo:Bildgalerio

Dokumentado Dokumentado

Ĉi tiu ŝablono uzas la Lua-modulon ((Yesno)) por iu parametro. Vidu ankaŭ Vikipedio:Lua. Se vi volas ŝanĝi la koncernajn parametrojn, bonvolu esti tre atentema.Se vi ne estas sufiĉe sperta pri tia teknikaĵo, vi povas demandi sur la paĝo Vikipedio:Lua/Petoj.

Realigas la ŝablonon ((Bildgalerio))n

Spuradaj kategorioj

Fonto

  • En tiu ĉi artikolo estas uzita traduko de teksto el la artikolo Module:Gallery en la angla Vikipedio.


Se vi havas demandon pri ĉi tiu Lua-modulo, tiam vi povas demandi en la diskutejo pri Lua-moduloj. La Intervikiaj ligiloj estu metataj al Vikidatumoj. (Vidu Helpopaĝon pri tio.)
-- Ĉi tiu modulo realigas ((bildgalerio))n

local p = {}

local stiloj = 'Module:Bildgalerio/stiloj.css'
local jesno = require('Modulo:Yesno')

local function sen_spacoj(s)
  return mw.ustring.gsub(mw.ustring.gsub(s, '%s', ' '), '^%s*(.-)%s*$', '%1')
end

local spurado, antauxvido

local function kontrolu_argojn(k,v)
  if k and type(k) == 'string' then
    if k == 'vicigo' or k == 'stato' or k == 'stilo' or k == 'titolo' or
      k == 'larĝo' or k == 'alto' or k == 'lineoj' or k == 'blanka fono' or
      k == 'reĝimo' or k == 'piednoto' or k == 'porvico' or k == 'sen bordero' or
      k:match('^alt%d+$') or k:match('^%d+$') then
      -- valida
    elseif k == 'apudskribo-stilo' then
      if not v:match('^text%-align%s*:%s*center[;%s]*$') then
        table.insert(spurado, '[[Kategorio:Paĝoj uzantaj bildgalerion kun parametro apudskribo-stilo]]')
      end
    else
      -- nevalida
      local vlen = mw.ustring.len(k)
      k = mw.ustring.sub(k, 1, (vlen < 25) and vlen or 25) 
      k = mw.ustring.gsub(k, '[^%w\-_ ]', '?')
      table.insert(spurado, '[[Kategorio:Paĝoj uzantaj bildgalerion kun nekonataj parametroj|' .. k .. ']]')
      table.insert(antauxvido, '"' .. k .. '"')
    end
  end
end

function p.bildgalerio(kadro)
  -- Se vokata per #invoke, ĝi uzas la argumentojn pasataj ene de la alvokata ŝablono.
  -- Alie, por testadoj, ĝi supozas ke la argumentoj estu pasataj rekte ene.
  local origArgs = (type(kadro.getParent) == 'function') and kadro:getParent().args or kadro
    
    -- ParserFunctions taksas melplenajn ĉenojn kiel malvera
    local args = {}
    spurado, antauxvido = {}, {}
    for k, v in pairs(origArgs) do
      if v ~= '' then
        args[k] = v
        kontrolu_argojn(k,v)
      end
  end
  
  -- reĝimo: traduko
  if args['reĝimo'] == 'tradicia' then
  	args['reĝimo'] = 'traditional'
  elseif args['reĝimo'] == 'sen linioj' then
  	args['reĝimo'] = 'nolines'
  elseif args['reĝimo'] == 'pakita' then
  	args['reĝimo'] = 'packed'
  elseif args['reĝimo'] == 'pakita-surmeto' then
  	args['reĝimo'] = 'packed-overlay'
  elseif args['reĝimo'] == 'pakita-musumo' then
  	args['reĝimo'] = 'packed-hover'
  elseif args['reĝimo'] == 'bildoserio' then
  	args['reĝimo'] = 'slideshow'
  end
  
  --blanka fono: traduko
  if args['blanka fono']=='ne' then
	args['blanka fono'] = 'no'
  end
  
   --sen bordero: traduko
  if args['sen bordero']=='jes' then
	args['sen bordero'] = 'yes'
  end
  
  --stato: traduko
  if args['stato']=='kolapsita' then
	args['stato'] = 'collapsed'
  elseif args['stato']=='vastigita' then
  	args['stato'] = 'expanded'
  end
  
  if (args['reĝimo'] or '') == 'packed' and (args.vicigo or '') == '' then
    args.vicigo = 'center'
  elseif not args.vicigo or args.vicigo:lower() == 'maldekstre' then
  	args.vicigo = 'left'
  elseif args.vicigo:lower() == 'centre' then
  	args.vicigo = 'center'
  elseif args.vicigo:lower() == 'dekstre' then
  	args.vicigo = 'right' 
  end

  local tbl = mw.html.create('div')
  tbl:addClass('mod-gallery')
    
  if args.stato then
    tbl
      :addClass('mod-gallery-collapsible')
      :addClass('collapsible')
      :addClass(args.stato)
  end
  
  if args.stilo then
    tbl:cssText(args.stilo)
  else
    tbl:addClass('mod-gallery-default')
  end
  
  if args.vicigo then
    tbl:addClass('mod-gallery-' .. args.vicigo:lower())
  end

  if args.titolo then
    tbl:tag('div')
      :addClass('title')
        :tag('div')
          :wikitext(args.titolo)
  end
  
  local gargs = {}
  gargs['class'] = 'nochecker' .. (args['sen bordero'] and '' or ' bordered-images')
  gargs['widths'] = tonumber(args['larĝo']) or 180
  gargs['heights'] = tonumber(args.alto) or 180
  gargs['style'] = args['apudskribo-stilo']
  gargs['perrow'] = args.porvico
  gargs['mode'] = args['reĝimo']
  if jesno(args['blanka fono'] or 'yes') then
    gargs['class'] = gargs['class'] .. ' whitebg'
  end
  
  local gallery = {}
  
  local imageCount = math.ceil(#args / 2)

    for i = 1, imageCount do
    local img = sen_spacoj(args[i*2 - 1] or '')
    local caption = sen_spacoj(args[i*2] or '')
    local alt = sen_spacoj(args['alt' .. i] or '')
    if img ~= '' then
      table.insert(gallery, img .. (alt ~= '' and ('|alt=' .. alt) or '') .. '|' .. caption )
    end
  end
  
  tbl:tag('div')
    :addClass('main')
    :tag('div')
      :wikitext(
        kadro:extensionTag{ name = 'gallery', content = '\n' .. table.concat(gallery,'\n'), args = gargs}
        )
    
  if args.piednoto then
    tbl:tag('div')
      :addClass('footer')
        :tag('div')
          :wikitext(args.piednoto)
  end

  local spuradoteksto = (#spurado > 0) and table.concat(spurado, '') or ''
  if #antauxvido > 0 then
    spuradoteksto = require('Module:If preview')._warning({
      'Nekonata parametroj ' .. table.concat(antauxvido, '; ') .. '.'
    }) .. spuradoteksto
  end
  
  return kadro:extensionTag{ name = 'templatestyles', args = { src = stiloj} } .. tostring(tbl) .. spuradoteksto
end

return p
{{bottomLinkPreText}} {{bottomLinkText}}
Modulo:Bildgalerio
Listen to this article

This browser is not supported by Wikiwand :(
Wikiwand requires a browser with modern capabilities in order to provide you with the best reading experience.
Please download and use one of the following browsers:

This article was just edited, click to reload
This article has been deleted on Wikipedia (Why?)

Back to homepage

Please click Add in the dialog above
Please click Allow in the top-left corner,
then click Install Now in the dialog
Please click Open in the download dialog,
then click Install
Please click the "Downloads" icon in the Safari toolbar, open the first download in the list,
then click Install
{{::$root.activation.text}}

Install Wikiwand

Install on Chrome Install on Firefox
Don't forget to rate us

Tell your friends about Wikiwand!

Gmail Facebook Twitter Link

Enjoying Wikiwand?

Tell your friends and spread the love:
Share on Gmail Share on Facebook Share on Twitter Share on Buffer

Our magic isn't perfect

You can help our automatic cover photo selection by reporting an unsuitable photo.

This photo is visually disturbing This photo is not a good choice

Thank you for helping!


Your input will affect cover photo selection, along with input from other users.

X

Get ready for Wikiwand 2.0 🎉! the new version arrives on September 1st! Don't want to wait?