יחידה:דיווח מצב – הבדלי גרסאות
יצירת דף עם התוכן "--[[ To generate the statusOrder list, I: 1. copied the list from under "suggested values" in the templatedata at the bottom of תבנית:מצב/צבע/קבוצות 2. Moved the "suggestion" category options to be after the first list item ("new"), and moved the "under discussion" option to be after the "suggestion" options 3. Ran the invertTable function (below) and copied its output back here 4...." |
אין תקציר עריכה |
||
| שורה 30: | שורה 30: | ||
local statusTextNone = "ללא תבנית מצב" | local statusTextNone = "ללא תבנית מצב" | ||
local statusOrder = { | local statusOrder = { | ||
[statusTextAll] = -1, | [statusTextAll] = -1, | ||
[statusTextNone] = 0, | [statusTextNone] = 0, | ||
["חדש"] = 1, | ["חדש"] = 1, | ||
["בעבודה"] = 2, | ["בעבודה"] = 2, | ||
["הצעה"] = 3, | ["הצעה"] = 3, | ||
["הצעות"] = 4, | ["הצעות"] = 4, | ||
["הצעה לשיפור"] = 5, | ["הצעה לשיפור"] = 5, | ||
["הצעות לשיפור"] = 6, | ["הצעות לשיפור"] = 6, | ||
["הצעת שיפור"] = 7, | ["הצעת שיפור"] = 7, | ||
["הצעות שיפור"] = 8, | ["הצעות שיפור"] = 8, | ||
["בדיון"] = 9, | ["בדיון"] = 9, | ||
["בטיפול"] = 10, | ["בטיפול"] = 10, | ||
["הוכלל בדף השיחה"] = 11, | ["הוכלל בדף השיחה"] = 11, | ||
["בדף השיחה"] = 12, | ["בדף השיחה"] = 12, | ||
["במעקב"] = 13, | ["במעקב"] = 13, | ||
["דיון פתוח"] = 14, | ["דיון פתוח"] = 14, | ||
["טופל"] = 15, | ["טופל"] = 15, | ||
["תוקן"] = 16, | ["תוקן"] = 16, | ||
[" | ["{{תוקן}}"] = 17, | ||
["נפתר"] = 18, | ["נפתר"] = 18, | ||
["בוצע"] = 19, | ["בוצע"] = 19, | ||
["{{בוצע}}"] = 20, | ["{{בוצע}}"] = 20, | ||
["הועבר"] = 21, | ["הועבר"] = 21, | ||
["נענה"] = 22, | ["נענה"] = 22, | ||
["דיווח שגוי"] = 23, | ["דיווח שגוי"] = 23, | ||
["שגוי"] = 24, | ["שגוי"] = 24, | ||
["לא טעות"] = 25, | ["לא טעות"] = 25, | ||
["לא שגיאה"] = 26, | ["לא שגיאה"] = 26, | ||
["מופיע בערך"] = 27, | ["מופיע בערך"] = 27, | ||
["כבר מופיע בערך"] = 28, | ["כבר מופיע בערך"] = 28, | ||
["לא תקלה"] = 29, | ["לא תקלה"] = 29, | ||
["לא בוצע"] = 30, | ["לא בוצע"] = 30, | ||
["{{לא בוצע}}"] = 31, | ["{{לא בוצע}}"] = 31, | ||
["שם שגוי"] = 32, | ["שם שגוי"] = 32, | ||
["מגבלה טכנית"] = 33, | ["מגבלה טכנית"] = 33, | ||
["לא יבוצע"] = 34, | ["לא יבוצע"] = 34, | ||
["לא ערך"] = 35, | ["לא ערך"] = 35, | ||
["פרסום"] = 36, | ["פרסום"] = 36, | ||
["פרסומי"] = 37, | ["פרסומי"] = 37, | ||
["פרסומת"] = 38, | ["פרסומת"] = 38, | ||
["לא יקרה"] = 39, | ["לא יקרה"] = 39, | ||
["לא הועבר"] = 40, | ["לא הועבר"] = 40, | ||
["נמחק"] = 41, | ["נמחק"] = 41, | ||
["לא יועבר"] = 42, | ["לא יועבר"] = 42, | ||
["כבר דווח"] = 43, | ["כבר דווח"] = 43, | ||
["כבר נענה"] = 44, | ["כבר נענה"] = 44, | ||
["בקשה חוזרת"] = 45, | ["בקשה חוזרת"] = 45, | ||
["כפילות"] = 46, | ["כפילות"] = 46, | ||
["כפל"] = 47, | ["כפל"] = 47, | ||
["ישן"] = 48, | ["ישן"] = 48, | ||
["לא נענה"] = 49, | ["לא נענה"] = 49, | ||
["לא טופל"] = 50, | ["לא טופל"] = 50, | ||
["ישן, לא נענה"] = 51, | ["ישן, לא נענה"] = 51, | ||
["דיווח חוזר"] = 52, | ["דיווח חוזר"] = 52, | ||
["ישן, לא טופל"] = 53, | ["ישן, לא טופל"] = 53, | ||
["לא ניתן לטפל"] = 54, | ["לא ניתן לטפל"] = 54, | ||
["ללא תוכן"] = 55, | ["ללא תוכן"] = 55, | ||
["ללא מענה"] = 56, | ["ללא מענה"] = 56, | ||
["בלי תוכן"] = 57, | ["בלי תוכן"] = 57, | ||
["דרוש מקור"] = 58, | ["דרוש מקור"] = 58, | ||
["{{מקור}}"] = 59, | ["{{מקור}}"] = 59, | ||
["אין מקור"] = 60, | ["אין מקור"] = 60, | ||
["לא ברור"] = 61, | ["לא ברור"] = 61, | ||
["{{הבהרה}}"] = 62, | ["{{הבהרה}}"] = 62, | ||
["לא בשל"] = 63, | ["לא בשל"] = 63, | ||
["לא מוכן"] = 64, | ["לא מוכן"] = 64, | ||
["חסר מידע"] = 65, | ["חסר מידע"] = 65, | ||
["אחר"] = 66, | ["אחר"] = 66, | ||
["דיון סגור"] = 67, | ["דיון סגור"] = 67, | ||
["דיון להעברה"] = 68, | ["דיון להעברה"] = 68, | ||
["להעברה"] = 69 | ["להעברה"] = 69 | ||
} | } | ||
| שורה 168: | שורה 168: | ||
end | end | ||
function processSectionName ( sectionName ) | function processSectionName ( sectionName, titleText ) | ||
local tav = ' *תב *' | local tav = ' *תב *' | ||
local tavnit = ' *תבנית *' | local tavnit = ' *תבנית *' | ||
| שורה 181: | שורה 181: | ||
local sectionName8 = string.gsub( sectionName7, '%[%[[^]|]*|([^]|]*)%]%]', '%1') -- wikilinks with display text: keep only the display text | local sectionName8 = string.gsub( sectionName7, '%[%[[^]|]*|([^]|]*)%]%]', '%1') -- wikilinks with display text: keep only the display text | ||
local sectionName9 = string.gsub( sectionName8, '%[%[:?([^]]*)%]%]', '%1') -- wikilinks with display text: keep the content, dropping the brackets and optionally also a leading colon | local sectionName9 = string.gsub( sectionName8, '%[%[:?([^]]*)%]%]', '%1') -- wikilinks with display text: keep the content, dropping the brackets and optionally also a leading colon | ||
local sectionName10= "[[#" .. sectionName9 .. "|" .. sectionName9 .. "]]" | local sectionName10= "[[" .. titleText .. "#" .. sectionName9 .. "|" .. sectionName9 .. "]]" | ||
return sectionName10 | return sectionName10 | ||
end | end | ||
function getSections ( wikiText ) | function getSections ( wikiText, titleText ) | ||
local sectionHeaderPattern = ' | local sectionHeaderPattern = '%c==([^=][^%c=]*)==' | ||
local sectionTable = {} | local sectionTable = {} | ||
local offset | local offset | ||
| שורה 198: | שורה 198: | ||
while sectionName do | while sectionName do | ||
offsetStartPrev = offsetStart | offsetStartPrev = offsetStart | ||
sectionNamePrev = processSectionName(sectionName) -- remove leading and trailing whitespace and interlinks, convert into a link to the header | sectionNamePrev = processSectionName(sectionName, titleText) -- remove leading and trailing whitespace and interlinks, convert into a link to the header | ||
offsetStart, offset, sectionName = string.find( wikiText, sectionHeaderPattern, offset ) | offsetStart, offset, sectionName = string.find( wikiText, sectionHeaderPattern, offset ) | ||
if sectionName then | if sectionName then | ||
| שורה 211: | שורה 211: | ||
function statusSort (s1, s2) | function statusSort (s1, s2) | ||
return statusOrder[s1[1]] < statusOrder[s2[1]] | return (statusOrder[s1[1]] or 999) < (statusOrder[s2[1]] or 999) | ||
end | end | ||
| שורה 223: | שורה 223: | ||
statusTable = {} | statusTable = {} | ||
for i, section in ipairs(sectionTable) do | for i, section in ipairs(sectionTable) do | ||
statusTemplateArguments = string.match(section[2], fullPattern) | statusTemplateArguments = string.match (section[2], fullPattern) | ||
if not statusTemplateArguments then | if not statusTemplateArguments then | ||
statusType = statusTextNone | statusType = statusTextNone | ||
user = nil | user = nil | ||
else | else | ||
argsMatcher = string.gmatch(statusTemplateArguments, "([^|}]*) *[|}]") | argsMatcher = string.gmatch (statusTemplateArguments, "([^|}]*) *[|}]") | ||
argList = {} | argList = {} | ||
for arg in argsMatcher do | for arg in argsMatcher do | ||
| שורה 259: | שורה 259: | ||
function getStatusReport ( title, showPercent, showLinks, showEditors ) | function getStatusReport ( title, showPercent, showLinks, showEditors ) | ||
local wikiText = title:getContent() | local wikiText = title:getContent() | ||
local sectionTable = getSections(wikiText) -- the page title text is used to convert the section header into a link | local sectionTable = getSections(wikiText, title.prefixedText) -- the page title text is used to convert the section header into a link | ||
if not sectionTable then | |||
return '' | |||
end | |||
local statusList = sectionTableToStatusTable(sectionTable, showEditors) | local statusList = sectionTableToStatusTable(sectionTable, showEditors) | ||
return formatTable (statusList, showPercent, showLinks) | return formatTable (statusList, showPercent, showLinks) | ||