יחידה:WikidataCrossValidation: הבדלים בין גרסאות בדף

מאין תקציר עריכה
מאין תקציר עריכה
שורה 18: שורה 18:
--function CrossValidate.crossValidate( wikitext, propertyName, allowMulti, allowNA, entityId, multiSeperator, optionalQualifier, genderAware )
--function CrossValidate.crossValidate( wikitext, propertyName, allowMulti, allowNA, entityId, multiSeperator, optionalQualifier, genderAware )
function CrossValidate.crossValidate( wikitext, propertyName, entityId )
function CrossValidate.crossValidate( wikitext, propertyName, entityId )
if wikitext == nil or wikitext == '-' or #wikitext ==0 then  
if wikitext == nil or wikitext == '-' or #wikitext ==0 then  
return CrossValidate.CrossValidateResult.INVALID_WIKITEXT -- comparing to null wikitext is meaningless
return CrossValidate.CrossValidateResult.INVALID_WIKITEXT -- comparing to null wikitext is meaningless
שורה 33: שורה 34:
end
end
     local propertyVals = mw.wikibase.getBestStatements(entityId, propertyName)
     local propertyVals = mw.wikibase.getBestStatements(entityId, propertyName)
   
     if (not propertyVals) or (#propertyVals==0) then return CrossValidate.CrossValidateResult.MISSING_WIKIDATA end --no such property for this item
     if (not propertyVals) or (#propertyVals==0) then return MISSING_WIKIDATA end --no such property for this item
     local resTable = {}
     local resTable = {}
     local missingTranslation = false
     local missingTranslation = false