https://femiwiki.com/index.php?title=%EB%AA%A8%EB%93%88:@ko/Date2&feed=atom&action=history
모듈:@ko/Date2 - 편집 역사
2024-03-28T22:52:25Z
이 문서의 편집 역사
MediaWiki 1.41.0
https://femiwiki.com/index.php?title=%EB%AA%A8%EB%93%88:@ko/Date2&diff=176655&oldid=prev
페미위키 깃헙 가젯 봇: Github @lens0021의 https://github.com/femiwiki/remote-gadgets/commit/7b824c54
2021-04-13T01:06:58Z
<p>Github @lens0021의 https://github.com/femiwiki/remote-gadgets/commit/7b824c54</p>
<table style="background-color: #fff; color: #202122;" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="ko">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← 이전 판</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">2021년 4월 13일 (화) 10:06 판</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l22">22번째 줄:</td>
<td colspan="2" class="diff-lineno">22번째 줄:</td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>-- === Dependencies ======================</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>-- === Dependencies ======================</div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>-- =======================================</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>-- =======================================</div></td></tr>
<tr><td class="diff-marker" data-marker="−"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>--local i18n = require('Module:@ko/I18n<del style="font-weight: bold; text-decoration: none;">-</del>date') -- get localized translations of date formats</div></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>--local i18n = require('Module:@ko/I18n<ins style="font-weight: bold; text-decoration: none;">/</ins>date') -- get localized translations of date formats</div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>--local Fallback = require('Module:@ko/Fallback') -- get fallback functions</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>--local Fallback = require('Module:@ko/Fallback') -- get fallback functions</div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>local yesno = require('Module:@ko/Yesno')</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>local yesno = require('Module:@ko/Yesno')</div></td></tr>
</table>
페미위키 깃헙 가젯 봇
https://femiwiki.com/index.php?title=%EB%AA%A8%EB%93%88:@ko/Date2&diff=176574&oldid=prev
페미위키 깃헙 가젯 봇: Github @lens0021의 https://github.com/femiwiki/remote-gadgets/commit/b60cb09a
2021-04-12T12:51:21Z
<p>Github @lens0021의 https://github.com/femiwiki/remote-gadgets/commit/b60cb09a</p>
<table style="background-color: #fff; color: #202122;" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="ko">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← 이전 판</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">2021년 4월 12일 (월) 21:51 판</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l1">1번째 줄:</td>
<td colspan="2" class="diff-lineno">1번째 줄:</td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>--[[</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>--[[</div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>This module was originally on https://ko.wikipedia.org/wiki/모듈:Date2 and forked by Legunto</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>This module was originally on https://ko.wikipedia.org/wiki/모듈:Date2 and forked by Legunto</div></td></tr>
<tr><td class="diff-marker" data-marker="−"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>(https://github.com/<del style="font-weight: bold; text-decoration: none;">lens0021</del>/legunto).</div></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>(https://github.com/<ins style="font-weight: bold; text-decoration: none;">femiwiki</ins>/legunto).</div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>]]</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>]]</div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>--[[ </div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>--[[ </div></td></tr>
</table>
페미위키 깃헙 가젯 봇
https://femiwiki.com/index.php?title=%EB%AA%A8%EB%93%88:@ko/Date2&diff=167741&oldid=prev
페미위키 깃헙 가젯 봇: Github @lens0021의 https://github.com/femiwiki/remote-gadgets/commit/9a8f20bd
2020-07-22T03:18:16Z
<p>Github @lens0021의 https://github.com/femiwiki/remote-gadgets/commit/9a8f20bd</p>
<p><b>새 문서</b></p><div>--[[<br />
This module was originally on https://ko.wikipedia.org/wiki/모듈:Date2 and forked by Legunto<br />
(https://github.com/lens0021/legunto).<br />
]]<br />
--[[ <br />
<br />
This module is intended for processing of date strings.<br />
<br />
Please do not modify this code without applying the changes first at Module:Date/sandbox and testing <br />
at Module:Date/sandbox/testcases and Module talk:Date/sandbox/testcases.<br />
<br />
Authors and maintainers:<br />
* User:Parent5446 - original version of the function mimicking template:ISOdate<br />
* User:Jarekt - original version of the functions mimicking template:Date and template:ISOyear<br />
<br />
]]<br />
<br />
<br />
local p = {}<br />
<br />
-- =======================================<br />
-- === Dependencies ======================<br />
-- =======================================<br />
--local i18n = require('Module:@ko/I18n-date') -- get localized translations of date formats<br />
--local Fallback = require('Module:@ko/Fallback') -- get fallback functions<br />
local yesno = require('Module:@ko/Yesno')<br />
<br />
local i18n = {<br />
DateLang = {<br />
['ko'] = 'ko-form'<br />
},<br />
DateFormat = {<br />
['ko-form'] = {<br />
YMD ='Y년 F j일', <br />
YM ='Y년 F', <br />
Y ='Y',<br />
}<br />
}<br />
}<br />
<br />
--[[<br />
Date<br />
<br />
This function is the core part of the ISOdate template. <br />
<br />
Usage:<br />
{#invoke:Date|Date|year=|month=|day=|hour=|minute=|second=|lang=en}}<br />
<br />
Parameters:<br />
year,month,day,hour,minute,second: broken down date-time component strings<br />
lang: The language to display it in<br />
case: Language format (genitive, etc.) for some languages<br />
class: CSS class for the <time> node, use "" for no metadata at all<br />
<br />
Error Handling:<br />
<br />
]]<br />
function p.Date(frame)<br />
return p._Date( <br />
{ <br />
frame.args["year"] or '', <br />
frame.args["month"] or '',<br />
frame.args["day"] or '', <br />
},<br />
frame.args["lang"] or 'ko', -- language<br />
frame.args["trim_year"] or '100-999' -- by default pad one and 2 digit years to be 4 digit long, while keeping 3 digit years as is<br />
) <br />
end<br />
<br />
<br />
function p._Date(datevec, lang, trim_year) <br />
-- make sure inputs are in the right format<br />
if #datevec<6 then <br />
for i=#datevec,6,1 do datevec[i]='' end <br />
end<br />
if not trim_year then trim_year = '100-999' end<br />
<br />
-- if language is not provided than look up users language<br />
-- WARNING: This step should be done by the template as it does not seem to work as well here (cache issues?)<br />
if not lang or not mw.language.isValidCode( lang ) then<br />
lang = 'ko'<br />
end<br />
<br />
-- Just in case someone broke the internationalization code than fix the english defaults<br />
if i18n.DateLang['ko'] == nil then<br />
i18n.DateLang['ko'] = 'ko-form'<br />
end <br />
if i18n.DateFormat['ko-form'] == nil then<br />
i18n.DateFormat['ko-form'] = {<br />
YMD ='Y년 F j일', <br />
YM ='Y년 F', <br />
Y ='Y',<br />
}<br />
end<br />
<br />
-- create datecode based on which variables are provided and check for out of bound values<br />
local maxval = {9999, 12, 31} -- max values for year, month, ...<br />
local c = {'Y', 'M', 'D'}<br />
local datecode = '' -- a string signifying which combination of variables was provided<br />
local datenum = {} -- date-time encoded as a vector = [year, month, ... , second]<br />
for i, v in ipairs( datevec ) do<br />
if v~=nil and v~='' then<br />
datecode = datecode .. c[i]<br />
datenum[i] = tonumber(v)<br />
if datenum[i]==nil and i==2 then<br />
-- month is not a number -> check if it is a month name in English<br />
v = mw.language.new('en'):formatDate( "n", v)<br />
datenum[i] = tonumber(v)<br />
end<br />
if datenum[i]==nil or datenum[i]>maxval[i] then<br />
-- Some numbers are out of range -> abort and return the empty string<br />
return ''<br />
end<br />
end<br />
end<br />
<br />
-- create time stamp string (for example 2000-02-20 02:20:20) based on which variables were provided<br />
local timeStamp<br />
if datecode:sub(1,3)=='YMD' then<br />
timeStamp = string.format('%04i-%02i-%02i', datenum[1], datenum[2], datenum[3] )<br />
datecode = 'YMD' -- 'YMD', 'YMDHMS' and 'YMDHM' are the only supported format starting with 'YMD'. All others will be converted to 'YMD'<br />
elseif datecode == 'YM' then<br />
timeStamp = string.format('%04i-%02i', datenum[1], datenum[2] )<br />
elseif datecode:sub(1,1)=='Y' then<br />
timeStamp = string.format('%04i', datenum[1] )<br />
datecode = 'Y' <br />
else<br />
return '' -- format not supported<br />
end<br />
<br />
-- ==========================================================<br />
-- === Create Date String using in chosen language<br />
-- ==========================================================<br />
<br />
-- which form should the date take? <br />
-- Use Fallback module to handle rare languages which are more likely to use different for than default EN form<br />
local langDateForm = 'ko-form'<br />
<br />
-- Look up country specific format input to {{#time}} function<br />
local dFormat = i18n.DateFormat[langDateForm][datecode]<br />
<br />
-- Lua only date formating using {{#time}} parser function (new)<br />
-- prefered call which gives "Lua error: too many language codes requested." on the [[Module talk:Date/sandbox/testcases]] page<br />
--local datestr = mw.language.new(lang):formatDate( dFormat, timeStamp) <br />
local datestr = mw.getCurrentFrame():callParserFunction( "#time", { dFormat, timeStamp, lang } )<br />
<br />
-- If year<1000 than either keep it padded to the length of 4 digits or trim it<br />
-- decide if the year will stay padded with zeros (for years in 0-999 range)<br />
if datenum[1]~= nil and datenum[1]<1000 then<br />
local trim = yesno(trim_year,nil)<br />
if trim == nil then<br />
local YMin, YMax = trim_year:match( '(%d+)-(%d+)' )<br />
trim = (YMin~=nil and datenum[1]>=tonumber(YMin) and datenum[1]<=tonumber(YMax)) <br />
end<br />
<br />
-- If the date form isn't the Thai solar calendar, don't zero pad years in the range of 100-999. <br />
-- If at some point support for Islamic/Hebrew/Japanese years is added, they may need to be skipped as well. <br />
if trim then<br />
--local yearStr1 = mw.language.new(lang):formatDate( 'Y', timeStamp)<br />
local yearStr1 = mw.getCurrentFrame():callParserFunction( "#time", { 'Y', timeStamp, lang } )<br />
--local yearStr1 = datestr:match( '%d%d%d%d' ) -- 4 digits in a row (in any language) - that must be a year<br />
local yearStr2 = yearStr1<br />
local zeroStr = mw.ustring.sub(yearStr1,1,1)<br />
for i=1,3 do -- trim leading zeros<br />
if mw.ustring.sub(yearStr2,1,1)==zeroStr then<br />
yearStr2 = mw.ustring.sub(yearStr2, 2, 5-i)<br />
else<br />
break<br />
end<br />
end<br />
datestr = datestr:gsub( yearStr1, yearStr2 )<br />
--datestr = string.format('%s (%s, %s)', datestr, yearStr1, yearStr2 )<br />
end<br />
end<br />
<br />
return datestr<br />
end<br />
<br />
return p</div>
페미위키 깃헙 가젯 봇