Sửa đổi Mô đun:Citation/Configuration
Chú ý: Bạn chưa đăng nhập và địa chỉ IP của bạn sẽ hiển thị công khai khi lưu các sửa đổi.
Bạn có thể tham gia như người biên soạn chuyên nghiệp và lâu dài ở Bách khoa Toàn thư Việt Nam, bằng cách đăng ký và đăng nhập - IP của bạn sẽ không bị công khai và có thêm nhiều lợi ích khác.
Các sửa đổi có thể được lùi lại. Xin hãy kiểm tra phần so sánh bên dưới để xác nhận lại những gì bạn muốn làm, sau đó lưu thay đổi ở dưới để hoàn tất việc lùi lại sửa đổi.
Bản hiện tại | Nội dung bạn nhập | ||
Dòng 467: | Dòng 467: | ||
end | end | ||
− | + | local df_template_patterns = { -- table of redirects to {{Use dmy dates}} and {{Use mdy dates}} | |
− | + | '{{ *[Uu]se (dmy) dates *[|}]', -- 915k -- sorted by approximate transclusion count | |
− | + | '{{ *[Uu]se *(mdy) *dates *[|}]', -- 161k | |
− | + | '{{ *[Uu]se (DMY) dates *[|}]', -- 2929 | |
− | + | '{{ *[Uu]se *(dmy) *[|}]', -- 250 + 34 | |
− | + | '{{ *([Dd]my) *[|}]', -- 272 | |
− | + | '{{ *[Uu]se (MDY) dates *[|}]', -- 173 | |
− | + | '{{ *[Uu]se *(mdy) *[|}]', -- 59 + 12 | |
− | + | '{{ *([Mm]dy) *[|}]', -- 9 | |
− | + | '{{ *[Uu]se (MDY) *[|}]', -- 3 | |
− | + | '{{ *([Dd]MY) *[|}]', -- 2 | |
− | + | '{{ *([Mm]DY) *[|}]', -- 0 | |
− | + | '{{ *(vdvmvy) *[|}]', -- 0 | |
− | + | '{{ *(dvmvy) *[|}]', -- 0 | |
− | + | -- '{{ *[Uu]se(mdy) *[|}]', | |
− | + | -- '{{ *[Uu]se(mdy)dates *[|}]', | |
− | + | -- '{{ *[Uu]se(dmy) *[|}]', | |
− | + | } | |
− | + | local function get_date_format () | |
− | + | local content = mw.title.getCurrentTitle():getContent() or ''; -- get the content of the article or ''; new pages edited w/ve do not have 'content' until saved; ve does not preview; phab:T221625 | |
− | + | for _, pattern in ipairs (df_template_patterns) do -- loop through the patterns looking for {{Use dmy dates}} or {{Use mdy dates}} or any of their redirects | |
− | + | local start, _, match = content:find(pattern); -- match is the three letters indicating desired date format | |
− | + | if match then | |
− | + | content = content:match ('%b{}', start); -- get the whole template | |
− | + | if content:match ('| *cs1%-dates *= *[lsy][sy]?') then -- look for |cs1-dates=publication date length access-/archive-date length | |
− | + | return match:lower() .. '-' .. content:match ('| *cs1%-dates *= *([lsy][sy]?)'); | |
− | + | else | |
− | + | return match:lower() .. '-all'; -- no |cs1-dates= k/v pair; return value appropriate for use in |df= | |
− | + | end | |
− | + | end | |
− | + | end | |
− | + | end | |
+ | |||
+ | local global_df = get_date_format (); | ||
− | |||
− | |||
--[[--------------------------< V O L U M E , I S S U E , P A G E S >---------------------------------------- | --[[--------------------------< V O L U M E , I S S U E , P A G E S >---------------------------------------- |