לדלג לתוכן
תפריט ראשי
תפריט ראשי
העברה לסרגל הצד
הסתרה
ניווט
עמוד ראשי
ברוכים הבאים
אולם דיונים
שינויים אחרונים
ערך אקראי
דיווח על טעות
עזרה
צור קשר/תרומה
פורטלים
נשיאי חב"ד
ימי חב"ד
גאולה ומשיח
תורת החסידות
תורת הנגלה
ניגוני חב"ד
ספרות חב"ד
בית רבי
אישי חב"ד
הפצת המעיינות
קישורים
חב"ד אינפו
ארכיון גאולה ומשיח
חב"דפדיה
חיפוש
חיפוש
מראה
יצירת חשבון
כניסה לחשבון
כלים אישיים
יצירת חשבון
כניסה לחשבון
דפים לעורכים שלא נכנסו לחשבון
מידע נוסף
תרומות
שיחה
עריכת הדף "
יחידה:טווח זמנים
"
יחידה
שיחה
English
קריאה
עריכת קוד מקור
גרסאות קודמות
כלים
כלים
העברה לסרגל הצד
הסתרה
פעולות
קריאה
עריכת קוד מקור
גרסאות קודמות
כללי
דפים המקושרים לכאן
שינויים בדפים המקושרים
דפים מיוחדים
מידע על הדף
מראה
העברה לסרגל הצד
הסתרה
אזהרה:
אינכם מחוברים לחשבון. כתובת ה־IP שלכם תוצג בפומבי אם תבצעו עריכות כלשהן. אם
תיכנסו לחשבון
או
תיצרו חשבון
, העריכות שלכם תיוחסנה לשם המשתמש שלכם ותקבלו גם יתרונות אחרים.
בדיקת אנטי־ספאם.
אין
למלא שדה זה!
local Date = require('Module:תאריך') local Arguments = require("Module:Arguments") local HebrewDate = require("Module:תאריך עברי") local function convertDate(date) local success, hebrewDate = pcall(HebrewDate.fromhebrew, mw.getCurrentFrame():newChild { args = { date } }) if success then return hebrewDate else return date end end local function render(frame) local args = Arguments.getArgs(frame, { ['trim'] = true, ['removeBlanks'] = true }) local res = '' local dateFormat = '' local maintainceCategory = '' local entityId = args['qid'] if (entityId == '-' or entityId == '') then entityId = nil end local pointInTime = args['נקודת זמן'] local startDate = args['תאריך התחלה'] local endDate = args['תאריך סיום'] local tempStart = startDate local tempEnd = endDate if startDate then startDate = convertDate(startDate) end if endDate then endDate = convertDate(endDate) end local wikidataStartDate = args['תאריך התחלה-ויקינתונים'] or 'P580' local wikidataEndDate = args['תאריך סיום-ויקינתונים'] or 'P582' local wikidataEndDateLimit = args['גבול תאריך סיום-ויקינתונים'] local showEditWikidata = true -- text to show if we have only end date. Example: "Last even - %s" where %s is time. nil - will not show end date local onlyEndDateText = args['טקסט סיום'] -- text to show if we have only start date. Example: "First even - %s" where %s is time. nil - will not show end date local onlyStartDateText = args['טקסט התחלה'] local duration = args['משך'] -- P2047 -- Whether to show time diff between start and end day when applicable. Example: כן. local showTimeDiff = args['הצגת הפרשת זמנים'] local dateRangeDiffFormat = args['פורמט הצגה'] or '%s (%s)' local usingWikidata = false -- Whether the event still continues. this will show <START>-present. Example: כן local defaultOngoingEvent = args['נמשך'] == 'כן' local ongoingEvent = defaultOngoingEvent local endDateOngoingEvent = args['הווה'] local presentText = args['טקסט הווה'] local diffFormat = 'auto' -- TODO: better handling for different scales if endDate ~= nil and endDate ~= '' then if endDateOngoingEvent ~= nil then -- set default ongoingEvent as false ongoingEvent = false for v in string.gmatch(endDateOngoingEvent, "[^,]+") do if v:match('^%s*(.-)%s*$') == endDate then -- set as true if end date specific that match endDateOngoingEvent ongoingEvent = true if presentText then endDate = presentText end end end else -- explicity end date was specified, hence it is not ongoing ongoingEvent = false end end -- simple case of single point in time if pointInTime ~= nil or startDate == endDate then if pointInTime == nil and startDate == endDate then pointInTime = startDate end res = pointInTime else -- date ranges if startDate == nil and endDate ~= nil then if onlyEndDateText == nil then dateFormat = '%s–%s' if mw.ustring.match(endDate, ' ') then dateFormat = '%s – %s' end res = mw.ustring.format(dateFormat, '?', tempEnd) else res = mw.ustring.format(onlyEndDateText, tempEnd) end elseif startDate ~= nil and (endDate == nil or (ongoingEvent and endDate ~= nil)) then if onlyStartDateText then -- in corner cases where the start date is actually more complex text, avoid wrapping it if mw.ustring.match(startDate, '.+\n.+') or mw.ustring.find(startDate, '<br />') ~= nil or mw.ustring.match(startDate, '.+[•,].+') ~= nil then res = startDate else res = mw.ustring.format(onlyStartDateText, tempStart) end else if ongoingEvent then dateFormat = '%s–%s' if mw.ustring.match(startDate, ' ') or (endDate and mw.ustring.match(endDate, ' ')) then dateFormat = '%s – %s' end res = mw.ustring.format(dateFormat, startDate, endDate or 'הווה') -- try to fallback to automatic duration if duration is not available if showTimeDiff == 'כן' and duration == nil then local success, automaicDuration = pcall(Date.parseDateRange, startDate, diffFormat, true) if success then duration = automaicDuration end end res = mw.ustring.format(dateFormat, tempStart, tempEnd or 'הווה') else res = startDate end end elseif startDate ~= nil and endDate ~= nil then dateFormat = '%s–%s' if mw.ustring.match(startDate, ' ') or mw.ustring.match(endDate, ' ') then dateFormat = '%s – %s' end res = mw.ustring.format(dateFormat, startDate, endDate) if showTimeDiff == 'כן' and duration == nil then local success, automaicDuration = pcall(Date.parseDateRange, res, diffFormat, true) if success then duration = automaicDuration end end res = mw.ustring.format(dateFormat, tempStart, tempEnd) end end -- append the duration if showTimeDiff == 'כן' and duration ~= nil and duration ~= '' and res ~= nil then res = mw.ustring.format(dateRangeDiffFormat, res, duration) end if showEditWikidata and usingWikidata and res ~= nil and res ~= '' and entityId ~= nil then local link = mw.title.makeTitle(0, entityId, '', 'wikidata'):fullUrl('uselang=he') res = res .. mw.ustring .format( ' [[File:Blue pencil RTL.svg|15px|link=%s|עריכת הנתון בוויקינתונים]]', link) end if maintainceCategory ~= nil and res ~= nil then res = res .. maintainceCategory end return res end return { ['טווח זמנים'] = render }
תקציר:
לתשומת ליבך: תרומתך לאתר חב"דפדיה תפורסם לפי תנאי הרישיון GNU Free Documentation License 1.2 (אפשר לעיין בדף
חב"דפדיה:זכויות יוצרים
לפרטים נוספים). אם אינך רוצה שעבודתך תהיה זמינה לעריכה על־ידי אחרים, שתופץ לעיני כול, ושאחרים יוכלו להעתיק ממנה תוך ציון המקור – אין לפרסם אותה פה.
כמו־כן, שמירת העריכה משמעה הבטחה שכתבת את הטקסט הזה בעצמך או העתקת אותו ממקור בנחלת הכלל (שאינו מוגבל בזכויות יוצרים) או מקור חופשי דומה.
אין לשלוח חומר מוגבל בזכויות יוצרים ללא רשות!
ביטול
עזרה בעריכה
(נפתח בחלון חדש)
תבנית המופיעה בדף זה:
יחידה:טווח זמנים/תיעוד
(
עריכה
)