יחידה:WikidataCrossValidation: הבדלים בין גרסאות בדף
מ מקרה נפוץ של מטר |
מ 23 גרסאות של הדף wikipedia:he:יחידה:WikidataCrossValidation יובאו |
||
| (9 גרסאות ביניים של 3 משתמשים אינן מוצגות) | |||
| שורה 31: | שורה 31: | ||
return CrossValidate.CrossValidateResult.INVALID_WIKITEXT | return CrossValidate.CrossValidateResult.INVALID_WIKITEXT | ||
end | end | ||
end | |||
-- temporary fix for option param of (e.g P1/P2) | |||
if string.find(propertyName, '/') then | |||
return CrossValidate.CrossValidateResult.INVALID_WIKITEXT | |||
end | end | ||
local propertyVals = mw.wikibase.getBestStatements(entityId, propertyName) | local propertyVals = mw.wikibase.getBestStatements(entityId, propertyName) | ||
| שורה 93: | שורה 97: | ||
local noramlizeUnit = mw.ustring.gsub(wikitext, '[%[%]]', '') | local noramlizeUnit = mw.ustring.gsub(wikitext, '[%[%]]', '') | ||
noramlizeUnit = mw.ustring.gsub(noramlizeUnit, '(.+) מטרים', '%1 מטר') | noramlizeUnit = mw.ustring.gsub(noramlizeUnit, '(.+) מטרים', '%1 מטר') | ||
noramlizeUnit = mw.ustring.gsub(noramlizeUnit, '(.+) ק"ג$', '%1 קילוגרם') | |||
if noramlizeUnit == formattedValue then | if noramlizeUnit == formattedValue then | ||
return CrossValidate.CrossValidateResult.COMPATIBLE | return CrossValidate.CrossValidateResult.COMPATIBLE | ||
| שורה 137: | שורה 142: | ||
return CrossValidate.CrossValidateResult.COMPATIBLE | return CrossValidate.CrossValidateResult.COMPATIBLE | ||
end | |||
function CrossValidate.templateCrossVal(frame) | |||
local Arguments = require( "Module:Arguments" ) | |||
local args = Arguments.getArgs(frame, { ['trim'] = true, ['removeBlanks'] = true }) | |||
local wikitext = args[1] | |||
local propertyName = args[2] | |||
local res = CrossValidate.crossValidate(wikitext, propertyName) | |||
if res then | |||
return CrossValidate.maintainceCategory(res, propertyName) | |||
end | |||
end | end | ||
return CrossValidate | return CrossValidate | ||