fbpx
วิกิพีเดีย

มอดูล:British regnal year

คู่มือการใช้งานมอดูล[สร้าง]
-- This module implements {{British regnal year}}. It converts a year in the Gregorian -- calendar to the equivalent English or British regnal year.  local data = mw.loadData( 'Module:British regnal year/data' )  local p = {}  function p.main( frame )  -- If we are being called from #invoke, then the year is the first positional  -- argument. If not, it is the frame parameter.  local inputYear  if frame == mw.getCurrentFrame() then  inputYear = frame:getParent().args[ 1 ]  local frameArgsYear = frame.args[ 1 ]  if frameArgsYear then  inputYear = frameArgsYear  end  else  inputYear = frame  end   -- Convert the input to an integer if possible. Return "N/A" if the input could  -- not be converted, or if the converted input is too big or too small.  if type( inputYear ) ~= 'number' then  inputYear = tonumber( inputYear )  end  if not inputYear then  return "''N/A''"  end  local currentYear = tonumber( mw.language.getContentLanguage():formatDate( 'Y' ) )  if inputYear < 1066 or inputYear > currentYear then  return "''N/A''"  end   -- Find the year in the data page and display the output.  for _, t in ipairs( data ) do  local dataYear = t.year  if inputYear >= dataYear then  -- Get data values from the data page.  local startYear = t.startYear  local currentRegnalYear = inputYear - dataYear + startYear  local linkCurrent = t.linkCurrent  local prevEndYear = t.prevEndYear  local linkPrev = t.linkPrev  local note = t.note   if inputYear > dataYear then  -- Years with the same monarch.  return mw.ustring.format(  '%d&nbsp;%s&nbsp;–&nbsp;%d&nbsp;%s%s',  currentRegnalYear - 1, linkCurrent, currentRegnalYear, linkCurrent, note or ''  )  elseif inputYear == dataYear and prevEndYear and linkPrev then  -- Years with a different monarch.  return mw.ustring.format(  '%d&nbsp;%s&nbsp;–&nbsp;%d&nbsp;%s%s',  prevEndYear, linkPrev, currentRegnalYear, linkCurrent, note or ''  )  else  -- This should only match the year 1066.  return mw.ustring.format(  '%d&nbsp;%s%s',  currentRegnalYear, linkCurrent, note or ''  )  end  end  end end  return p 

มอด, british, regnal, year, อการใช, งานมอด, สร, าง, ณอาจจะต, องการสร, างค, อการใช, งานของมอด, ลน, เข, ยนสามารถทำการทดลองได, กระบะทราย, สร, าง, ดลอก, และช, ดทดสอบ, สร, าง, ของมอด, ลน, โปรดเพ, มหมวดหม, ไปท, หน, าย, อย, หน, าย, อยของมอด, ลน, this, module, impleme. khumuxkarichnganmxdul srang khunxaccatxngkarsrangkhumuxkarichngankhxngmxdulniphuekhiynsamarththakarthdlxngidthikrabathray srang khdlxk aelachudthdsxb srang khxngmxdulnioprdephimhmwdhmuipthihnayxy doc hnayxykhxngmxdulni This module implements British regnal year It converts a year in the Gregorian calendar to the equivalent English or British regnal year local data mw loadData Module British regnal year data local p function p main frame If we are being called from invoke then the year is the first positional argument If not it is the frame parameter local inputYear if frame mw getCurrentFrame then inputYear frame getParent args 1 local frameArgsYear frame args 1 if frameArgsYear then inputYear frameArgsYear end else inputYear frame end Convert the input to an integer if possible Return N A if the input could not be converted or if the converted input is too big or too small if type inputYear number then inputYear tonumber inputYear end if not inputYear then return N A end local currentYear tonumber mw language getContentLanguage formatDate Y if inputYear lt 1066 or inputYear gt currentYear then return N A end Find the year in the data page and display the output for t in ipairs data do local dataYear t year if inputYear gt dataYear then Get data values from the data page local startYear t startYear local currentRegnalYear inputYear dataYear startYear local linkCurrent t linkCurrent local prevEndYear t prevEndYear local linkPrev t linkPrev local note t note if inputYear gt dataYear then Years with the same monarch return mw ustring format d amp nbsp s amp nbsp amp nbsp d amp nbsp s s currentRegnalYear 1 linkCurrent currentRegnalYear linkCurrent note or elseif inputYear dataYear and prevEndYear and linkPrev then Years with a different monarch return mw ustring format d amp nbsp s amp nbsp amp nbsp d amp nbsp s s prevEndYear linkPrev currentRegnalYear linkCurrent note or else This should only match the year 1066 return mw ustring format d amp nbsp s s currentRegnalYear linkCurrent note or end end end end return p ekhathungcak https th wikipedia org w index php title mxdul British regnal year amp oldid 5474811, wikipedia, วิกิ หนังสือ, หนังสือ, ห้องสมุด,

บทความ

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