jenkins-bot has submitted this change and it was merged. Change subject: Handle identifier properly ......................................................................
Handle identifier properly It needs to be considered whether we can live with going over all statements twice- once in the StatementListRenderer and once in the identifierListRenderer Bug: T118694 Change-Id: I599703dfe897ee64965b6daaa2f3b195c72604f5 --- D includes/Lua/Identifier.lua M includes/Lua/mw.ext.articlePlaceholder.entityRenderer.lua 2 files changed, 2 insertions(+), 9 deletions(-) Approvals: Thiemo Mättig (WMDE): Looks good to me, approved jenkins-bot: Verified diff --git a/includes/Lua/Identifier.lua b/includes/Lua/Identifier.lua deleted file mode 100644 index 7be7163..0000000 --- a/includes/Lua/Identifier.lua +++ /dev/null @@ -1,6 +0,0 @@ --- All the identifier properties in one table --- As in http://tinyurl.com/wikidata-identifier on 21.11.2015 --- created using https://github.com/frimelle/identifier-to-lua - -local table = {["P212"] = true, ["P213"] = true, ["P214"] = true, ["P218"] = true, ["P219"] = true, ["P220"] = true, ["P221"] = true, ["P227"] = true, ["P229"] = true, ["P230"] = true, ["P232"] = true, ["P233"] = true, ["P236"] = true, ["P238"] = true, ["P239"] = true, ["P243"] = true, ["P244"] = true, ["P245"] = true, ["P247"] = true, ["P267"] = true, ["P268"] = true, ["P269"] = true, ["P270"] = true, ["P271"] = true, ["P278"] = true, ["P303"] = true, ["P305"] = true, ["P345"] = true, ["P349"] = true, ["P350"] = true, ["P351"] = true, ["P356"] = true, ["P359"] = true, ["P380"] = true, ["P381"] = true, ["P396"] = true, ["P409"] = true, ["P424"] = true, ["P426"] = true, ["P434"] = true, ["P435"] = true, ["P436"] = true, ["P454"] = true, ["P455"] = true, ["P474"] = true, ["P477"] = true, ["P480"] = true, ["P481"] = true, ["P492"] = true, ["P496"] = true, ["P497"] = true, ["P498"] = true, ["P502"] = true, ["P508"] = true, ["P535"] = true, ["P536"] = true, ["P549"] = true, ["P586"] = true, ["P592"] = true, ["P593"] = true, ["P594"] = true, ["P595"] = true, ["P597"] = true, ["P599"] = true, ["P604"] = true, ["P605"] = true, ["P617"] = true, ["P627"] = true, ["P632"] = true, ["P633"] = true, ["P635"] = true, ["P638"] = true, ["P640"] = true, ["P646"] = true, ["P648"] = true, ["P649"] = true, ["P650"] = true, ["P651"] = true, ["P661"] = true, ["P677"] = true, ["P679"] = true, ["P685"] = true, ["P686"] = true, ["P687"] = true, ["P691"] = true, ["P701"] = true, ["P704"] = true, ["P705"] = true, ["P709"] = true, ["P717"] = true, ["P718"] = true, ["P721"] = true, ["P722"] = true, ["P723"] = true, ["P727"] = true, ["P745"] = true, ["P757"] = true, ["P759"] = true, ["P760"] = true, ["P761"] = true, ["P762"] = true, ["P763"] = true, ["P764"] = true, ["P781"] = true, ["P791"] = true, ["P809"] = true, ["P815"] = true, ["P818"] = true, ["P819"] = true, ["P827"] = true, ["P829"] = true, ["P830"] = true, ["P836"] = true, ["P839"] = true, ["P842"] = true, ["P843"] = true, ["P844"] = true, ["P845"] = true, ["P846"] = true, ["P850"] = true, ["P858"] = true, ["P860"] = true, ["P861"] = true, ["P863"] = true, ["P864"] = true, ["P865"] = true, ["P866"] = true, ["P867"] = true, ["P882"] = true, ["P889"] = true, ["P893"] = true, ["P894"] = true, ["P897"] = true, ["P902"] = true, ["P905"] = true, ["P906"] = true, ["P907"] = true, ["P909"] = true, ["P911"] = true, ["P932"] = true, ["P933"] = true, ["P938"] = true, ["P939"] = true, ["P946"] = true, ["P947"] = true, ["P949"] = true, ["P950"] = true, ["P951"] = true, ["P954"] = true, ["P957"] = true, ["P959"] = true, ["P960"] = true, ["P961"] = true, ["P962"] = true, ["P966"] = true, ["P980"] = true, ["P998"] = true, ["P999"] = true, ["P1003"] = true, ["P1004"] = true, ["P1005"] = true, ["P1006"] = true, ["P1007"] = true, ["P1014"] = true, ["P1015"] = true, ["P1017"] = true, ["P1022"] = true, ["P1025"] = true, ["P1042"] = true, ["P1045"] = true, ["P1047"] = true, ["P1048"] = true, ["P1051"] = true, ["P1053"] = true, ["P1055"] = true, ["P1058"] = true, ["P1067"] = true, ["P1070"] = true, ["P1077"] = true, ["P1084"] = true, ["P1085"] = true, ["P1133"] = true, ["P1138"] = true, ["P1146"] = true, ["P1150"] = true, ["P1153"] = true, ["P1157"] = true, ["P1159"] = true, ["P1183"] = true, ["P1185"] = true, ["P1186"] = true, ["P1187"] = true, ["P1188"] = true, ["P1203"] = true, ["P1207"] = true, ["P1208"] = true, ["P1212"] = true, ["P1213"] = true, ["P1214"] = true, ["P1222"] = true, ["P1223"] = true, ["P1224"] = true, ["P1225"] = true, ["P1226"] = true, ["P1229"] = true, ["P1230"] = true, ["P1232"] = true, ["P1233"] = true, ["P1236"] = true, ["P1237"] = true, ["P1238"] = true, ["P1241"] = true, ["P1242"] = true, ["P1243"] = true, ["P1245"] = true, ["P1248"] = true, ["P1251"] = true, ["P1252"] = true, ["P1253"] = true, ["P1258"] = true, ["P1260"] = true, ["P1263"] = true, ["P1265"] = true, ["P1266"] = true, ["P1267"] = true, ["P1271"] = true, ["P1273"] = true, ["P1275"] = true, ["P1277"] = true, ["P1280"] = true, ["P1284"] = true, ["P1285"] = true, ["P1286"] = true, ["P1287"] = true, ["P1288"] = true, ["P1293"] = true, ["P1296"] = true, ["P1297"] = true, ["P1307"] = true, ["P1309"] = true, ["P1311"] = true, ["P1315"] = true, ["P1320"] = true, ["P1330"] = true, ["P1331"] = true, ["P1338"] = true, ["P1341"] = true, ["P1364"] = true, ["P1367"] = true, ["P1368"] = true, ["P1369"] = true, ["P1375"] = true, ["P1391"] = true, ["P1394"] = true, ["P1396"] = true, ["P1407"] = true, ["P1409"] = true, ["P1413"] = true, ["P1415"] = true, ["P1417"] = true, ["P1421"] = true, ["P1422"] = true, ["P1428"] = true, ["P1430"] = true, ["P1438"] = true, ["P1439"] = true, ["P1440"] = true, ["P1447"] = true, ["P1459"] = true, ["P1461"] = true, ["P1463"] = true, ["P1466"] = true, ["P1467"] = true, ["P1468"] = true, ["P1469"] = true, ["P1473"] = true, ["P1474"] = true, ["P1483"] = true, ["P1529"] = true, ["P1541"] = true, ["P1551"] = true, ["P1553"] = true, ["P1555"] = true, ["P1556"] = true, ["P1562"] = true, ["P1563"] = true, ["P1564"] = true, ["P1565"] = true, ["P1566"] = true, ["P1567"] = true, ["P1573"] = true, ["P1580"] = true, ["P1583"] = true, ["P1584"] = true, ["P1601"] = true, ["P1602"] = true, ["P1607"] = true, ["P1608"] = true, ["P1609"] = true, ["P1610"] = true, ["P1614"] = true, ["P1616"] = true, ["P1627"] = true, ["P1644"] = true, ["P1648"] = true, ["P1649"] = true, ["P1650"] = true, ["P1651"] = true, ["P1662"] = true, ["P1663"] = true, ["P1665"] = true, ["P1666"] = true, ["P1667"] = true, ["P1669"] = true, ["P1670"] = true, ["P1679"] = true, ["P1695"] = true, ["P1700"] = true, ["P1702"] = true, ["P1707"] = true, ["P1708"] = true, ["P1710"] = true, ["P1711"] = true, ["P1712"] = true, ["P1714"] = true, ["P1715"] = true, ["P1717"] = true, ["P1726"] = true, ["P1727"] = true, ["P1728"] = true, ["P1729"] = true, ["P1730"] = true, ["P1732"] = true, ["P1733"] = true, ["P1738"] = true, ["P1741"] = true, ["P1745"] = true, ["P1749"] = true, ["P1751"] = true, ["P1761"] = true, ["P1763"] = true, ["P1769"] = true, ["P1770"] = true, ["P1771"] = true, ["P1772"] = true, ["P1788"] = true, ["P1794"] = true, ["P1795"] = true, ["P1798"] = true, ["P1799"] = true, ["P1800"] = true, ["P1802"] = true, ["P1804"] = true, ["P1807"] = true, ["P1808"] = true, ["P1816"] = true, ["P1818"] = true, ["P1819"] = true, ["P1822"] = true, ["P1825"] = true, ["P1826"] = true, ["P1828"] = true, ["P1832"] = true, ["P1837"] = true, ["P1838"] = true, ["P1839"] = true, ["P1842"] = true, ["P1847"] = true, ["P1848"] = true, ["P1850"] = true, ["P1866"] = true, ["P1869"] = true, ["P1871"] = true, ["P1874"] = true, ["P1882"] = true, ["P1890"] = true, ["P1895"] = true, ["P1933"] = true, ["P1934"] = true, ["P1935"] = true, ["P1938"] = true, ["P1939"] = true, ["P1940"] = true, ["P1946"] = true, ["P1947"] = true, ["P1948"] = true, ["P1953"] = true, ["P1954"] = true, ["P1969"] = true, ["P1970"] = true, ["P1982"] = true, ["P1983"] = true, ["P1984"] = true, ["P1985"] = true, ["P1986"] = true, ["P1992"] = true, ["P1994"] = true, ["P2002"] = true, ["P2003"] = true, ["P2005"] = true, ["P2013"] = true, ["P2014"] = true, ["P2019"] = true, ["P2020"] = true, ["P2041"] = true, ["P2042"] = true, ["P2070"] = true, ["P2074"] = true, ["P2080"] = true, ["P2081"] = true, ["P2108"] = true, ["P2161"] = true, ["P2163"] = true, ["P2167"] = true, ["P2168"] = true, ["P2174"] = true, ["P2180"] = true, ["P2181"] = true, ["P2182"] = true, ["P2187"] = true, ["P2188"] = true, ["P2189"] = true, ["P2191"] = true, ["P2192"] = true, ["P2193"] = true, ["P2194"] = true, ["P2195"] = true, ["P2206"] = true, ["P2242"] = true, ["P2252"] = true, ["P2272"] = true, ["P2273"] = true, ["P2323"] = true, ["P2327"] = true, ["P2328"] = true, ["P2330"] = true, ["P2331"] = true, } - return table diff --git a/includes/Lua/mw.ext.articlePlaceholder.entityRenderer.lua b/includes/Lua/mw.ext.articlePlaceholder.entityRenderer.lua index b934ca4..7b11332 100644 --- a/includes/Lua/mw.ext.articlePlaceholder.entityRenderer.lua +++ b/includes/Lua/mw.ext.articlePlaceholder.entityRenderer.lua @@ -9,7 +9,6 @@ local php = mw_interface entityrenderer.imageProperty = php.getImageProperty() -local identifierProperties = require( 'Identifier' ) local hasReferences = false @@ -169,7 +168,7 @@ local identifierList = '' if properties ~= nil then for _, propertyId in pairs( properties ) do - if identifierProperties[propertyId] then + if getDatatype( propertyId ) == "external-id" then identifierList = identifierList .. '<div class="articleplaceholder-identifier">' .. '<h2>' .. labelRenderer( propertyId ) .. '</h2>' identifierList = identifierList .. identifierRenderer( entity, propertyId ) .. '</div>' end @@ -191,7 +190,7 @@ local properties = statementSorter( entity ) if properties ~= nil then for _, propertyId in pairs( properties ) do - if propertyId ~= entityrenderer.imageProperty and not identifierProperties[propertyId] then + if propertyId ~= entityrenderer.imageProperty and getDatatype( propertyId ) ~= "external-id" then result = result .. '<div class="articleplaceholder-statement">' result = result .. '<h2>' .. labelRenderer( propertyId ) .. '</h2>' result = result .. bestStatementRenderer( entity, propertyId ) -- To view, visit https://gerrit.wikimedia.org/r/281048 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I599703dfe897ee64965b6daaa2f3b195c72604f5 Gerrit-PatchSet: 3 Gerrit-Project: mediawiki/extensions/ArticlePlaceholder Gerrit-Branch: master Gerrit-Owner: Lucie Kaffee <[email protected]> Gerrit-Reviewer: Daniel Kinzler <[email protected]> Gerrit-Reviewer: Hoo man <[email protected]> Gerrit-Reviewer: Jackmcbarn <[email protected]> Gerrit-Reviewer: Thiemo Mättig (WMDE) <[email protected]> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
