fbpx
วิกิพีเดีย

มอดูล:Episode list

คู่มือการใช้งานมอดูล[สร้าง]
local p = {}  local getArgs local yesno = require('Module:Yesno') local mm = require('Module:Math')  function p.sublist(frame)  return main(frame,true) end  function p.list(frame)  return main(frame,false) end  function main(frame, sublist)  if not getArgs then  getArgs = require('Module:Arguments').getArgs  end  local args   -- Most parameters should still display when blank, so don't remove blanks  if sublist then  args = getArgs(frame, {removeBlanks = false, wrappers = 'แม่แบบ:Episode list/sublist'})  else  args = getArgs(frame, {removeBlanks = false, wrappers = 'แม่แบบ:Episode list'})  end   local title = mw.title.getCurrentTitle()  local page_title = mw.title.getCurrentTitle().text  local mainlist = args.MainList or args['1'] or ''   -- Is this list on the same page as the page directly calling the template?  local on_main_page   -- Only sublist had anything about hiding, so only it needs to even check  if sublist then  on_main_page = mw.uri.anchorEncode(page_title) == mw.uri.anchorEncode(mainlist)  else  -- Normal lists can ALWAYS show the summary  on_main_page = false  end   -- Declare all the possible <td>/<th> tags here, and the return string  local EpisodeNumber,EpisodeNumber2,Title,Aux1,DirectedBy,WrittenBy,  DirectedBy,Aux2,Aux3,OriginalAirDate,AltDate,ProdCode,  Viewers,Aux4,return_table   -- Need just this parameter removed if blank, no others  if args.ShortSummary then  if not args.ShortSummary:find('%S') then  args.ShortSummary = nil  end  end   -- Default color to light blue  -- Hash (#) left out because it was left out in the original wikicode, so we can add it later  local line_color = args.LineColor or 'CCCCFF'   -- List of parameter names to test  -- Keep this order as is  local cell_names = {  'EpisodeNumber2',  'Title',  'Aux1',  'DirectedBy',  'WrittenBy',  'Aux2',  'Aux3',  'OriginalAirDate',  'AltDate',  'ProdCode',  'Viewers',  'Aux4'  }   -- Is there a way to call a variable by its name stored as a string? Doubt it  -- This list matches strings with the table cell variables  local td_tags = {  ['EpisodeNumber2'] = EpisodeNumber2,  ['Title'] = Title,  ['Aux1'] = Aux1,  ['DirectedBy'] = DirectedBy,  ['WrittenBy'] = WrittenBy,  ['DirectedBy'] = DirectedBy,  ['Aux2'] = Aux2,  ['Aux3'] = Aux3,  ['OriginalAirDate'] = OriginalAirDate,  ['AltDate'] = AltDate,  ['ProdCode'] = ProdCode,  ['Viewers'] = Viewers,  ['Aux4'] = Aux4,  }   local table_row = mw.html.create('tr')  :addClass('vevent')  :css('text-align','center')   local row_color = yesno(args.RowColor, false)  if args.RowColor and string.lower(args.RowColor) == 'on' then  row_color = true  end   local top_color  local epn = mm._cleanNumber(args.EpisodeNumber) or 1  if args.TopColor then  top_color = '#'..args.TopColor  elseif row_color and not on_main_page and mm._mod(epn,2) == 0 then  top_color = '#E9E9E9'  elseif not on_main_page and args.ShortSummary then  top_color = '#F2F2F2'  else  top_color = 'inherit'  end   table_row:css('background',top_color)   -- This will decide the colspan= of the summary cell  -- Start as 1 because EpisodeNumber is always created  local nonnil_params = 1   -- Created separately because it is the only <th> tag   if args.EpisodeNumber then  EpisodeNumber = mw.html.create('th')  :attr('scope','row')  :attr('id','ep'..args.EpisodeNumber)  :css('text-align','center')  :wikitext(args.EpisodeNumber)  table_row:css('background',top_color)  table_row:node(EpisodeNumber)  end   -- The wikitext in the Title cell is a little more involved than the others  local function add_title()  local title_string = ''   -- Surround the Title with quotes; no quotes if empty  if args.Title and args.Title:find('%S') then  title_string = title_string..'"'..args.Title..'"'  end   if args.RTitle then  title_string = title_string..args.RTitle  end   -- Surround the AltTitle with quotes; no quotes if empty  if args.AltTitle and args.AltTitle:find('%S') then  title_string = title_string..'<br>"'..args.AltTitle..'"'  end   if args.RAltTitle then  title_string = title_string..args.RAltTitle  end  return title_string  end   for _,v in ipairs(cell_names) do  -- Title is in the middle, so it's probably better to just switch back and again instead of doing 2 nodes  -- and then title, and then the rest in a loop  if v == 'Title' then  nonnil_params = nonnil_params + 1  local title_text = add_title()  td_tags[v] = mw.html.create('td')  td_tags[v]:wikitext(title_text)  :addClass('summary')  :css('text-align','left')  table_row:node(td_tags[v])  elseif args[v] then  nonnil_params = nonnil_params + 1  td_tags[v] = mw.html.create('td')  td_tags[v]:wikitext(args[v])  table_row:node(td_tags[v])  end  end   -- Production code also has an additional attribute, so add it separately here  if ProdCode and args.ProdCode then  ProdCode:attr('id','pc'..args.ProdCode)  end   local categories = ''   -- add these categories only in the mainspace and only if they are on the page where the template is used  if not args.LineColor and not on_main_page and title.nsText == '' then  categories = categories..'[[Category:Episode list using the default LineColor]]'  end   if args.TopColor and not on_main_page and title.nsText == '' then  categories = categories..'[[Category:Episode lists with row deviations]]'  end   -- Do not show the summary if this is being transcluded on the mainlist page  -- Do include it on all other lists  if not on_main_page and args.ShortSummary then  local bottom_wrapper = mw.html.create('tr')  local ShortSummary = mw.html.create('td')  :addClass('description')  :css('border-bottom','solid 3px #'..line_color)  :attr('colspan',nonnil_params)  :wikitext('\n'..args.ShortSummary)  bottom_wrapper:node(ShortSummary)  return tostring(table_row)..tostring(bottom_wrapper)..categories  else  return tostring(table_row)..categories  end end  return p 

มอด, episode, list, อการใช, งานมอด, สร, าง, ณอาจจะต, องการสร, างค, อการใช, งานของมอด, ลน, เข, ยนสามารถทำการทดลองได, กระบะทราย, สร, าง, ดลอก, และช, ดทดสอบ, สร, าง, ของมอด, ลน, โปรดเพ, มหมวดหม, ไปท, หน, าย, อย, หน, าย, อยของมอด, ลน, local, local, getargs, local,. khumuxkarichnganmxdul srang khunxaccatxngkarsrangkhumuxkarichngankhxngmxdulniphuekhiynsamarththakarthdlxngidthikrabathray srang khdlxk aelachudthdsxb srang khxngmxdulnioprdephimhmwdhmuipthihnayxy doc hnayxykhxngmxdulnilocal p local getArgs local yesno require Module Yesno local mm require Module Math function p sublist frame return main frame true end function p list frame return main frame false end function main frame sublist if not getArgs then getArgs require Module Arguments getArgs end local args Most parameters should still display when blank so don t remove blanks if sublist then args getArgs frame removeBlanks false wrappers aemaebb Episode list sublist else args getArgs frame removeBlanks false wrappers aemaebb Episode list end local title mw title getCurrentTitle local page title mw title getCurrentTitle text local mainlist args MainList or args 1 or Is this list on the same page as the page directly calling the template local on main page Only sublist had anything about hiding so only it needs to even check if sublist then on main page mw uri anchorEncode page title mw uri anchorEncode mainlist else Normal lists can ALWAYS show the summary on main page false end Declare all the possible lt td gt lt th gt tags here and the return string local EpisodeNumber EpisodeNumber2 Title Aux1 DirectedBy WrittenBy DirectedBy Aux2 Aux3 OriginalAirDate AltDate ProdCode Viewers Aux4 return table Need just this parameter removed if blank no others if args ShortSummary then if not args ShortSummary find S then args ShortSummary nil end end Default color to light blue Hash left out because it was left out in the original wikicode so we can add it later local line color args LineColor or CCCCFF List of parameter names to test Keep this order as is local cell names EpisodeNumber2 Title Aux1 DirectedBy WrittenBy Aux2 Aux3 OriginalAirDate AltDate ProdCode Viewers Aux4 Is there a way to call a variable by its name stored as a string Doubt it This list matches strings with the table cell variables local td tags EpisodeNumber2 EpisodeNumber2 Title Title Aux1 Aux1 DirectedBy DirectedBy WrittenBy WrittenBy DirectedBy DirectedBy Aux2 Aux2 Aux3 Aux3 OriginalAirDate OriginalAirDate AltDate AltDate ProdCode ProdCode Viewers Viewers Aux4 Aux4 local table row mw html create tr addClass vevent css text align center local row color yesno args RowColor false if args RowColor and string lower args RowColor on then row color true end local top color local epn mm cleanNumber args EpisodeNumber or 1 if args TopColor then top color args TopColor elseif row color and not on main page and mm mod epn 2 0 then top color E9E9E9 elseif not on main page and args ShortSummary then top color F2F2F2 else top color inherit end table row css background top color This will decide the colspan of the summary cell Start as 1 because EpisodeNumber is always created local nonnil params 1 Created separately because it is the only lt th gt tag if args EpisodeNumber then EpisodeNumber mw html create th attr scope row attr id ep args EpisodeNumber css text align center wikitext args EpisodeNumber table row css background top color table row node EpisodeNumber end The wikitext in the Title cell is a little more involved than the others local function add title local title string Surround the Title with quotes no quotes if empty if args Title and args Title find S then title string title string args Title end if args RTitle then title string title string args RTitle end Surround the AltTitle with quotes no quotes if empty if args AltTitle and args AltTitle find S then title string title string lt br gt args AltTitle end if args RAltTitle then title string title string args RAltTitle end return title string end for v in ipairs cell names do Title is in the middle so it s probably better to just switch back and again instead of doing 2 nodes and then title and then the rest in a loop if v Title then nonnil params nonnil params 1 local title text add title td tags v mw html create td td tags v wikitext title text addClass summary css text align left table row node td tags v elseif args v then nonnil params nonnil params 1 td tags v mw html create td td tags v wikitext args v table row node td tags v end end Production code also has an additional attribute so add it separately here if ProdCode and args ProdCode then ProdCode attr id pc args ProdCode end local categories add these categories only in the mainspace and only if they are on the page where the template is used if not args LineColor and not on main page and title nsText then categories categories Category Episode list using the default LineColor end if args TopColor and not on main page and title nsText then categories categories Category Episode lists with row deviations end Do not show the summary if this is being transcluded on the mainlist page Do include it on all other lists if not on main page and args ShortSummary then local bottom wrapper mw html create tr local ShortSummary mw html create td addClass description css border bottom solid 3px line color attr colspan nonnil params wikitext n args ShortSummary bottom wrapper node ShortSummary return tostring table row tostring bottom wrapper categories else return tostring table row categories end end return p ekhathungcak https th wikipedia org w index php title mxdul Episode list amp oldid 8427594, wikipedia, วิกิ หนังสือ, หนังสือ, ห้องสมุด,

บทความ

, อ่าน, ดาวน์โหลด, ฟรี, ดาวน์โหลดฟรี, mp3, วิดีโอ, mp4, 3gp, jpg, jpeg, gif, png, รูปภาพ, เพลง, เพลง, หนัง, หนังสือ, เกม, เกม