-- the property is a Pnnn type, and therefore on Wikidata
links = findMainLinksOnWikidata(props, pagetitle, short_links)
if links == nil then
-- a nil-value indicated no wikidata-link
haswikidatalink = false
links = {}
else
checkedonwikidata = true
end
elseif (not wikivalue or wikivalue == "") and string.find(props.prop, "(SL%l+)") then
-- this is a sitelink-type (SLspecieswiki)
--mw.log("finding sitelinks..")
links = findSiteLinksOnWikidata(props, pagetitle, short_links)
if links == nil then
-- a nil-value indicated no wikidata-link
haswikidatalink = false
links = {}
else
checkedonwikidata = true
end
elseif (wikivalue and wikivalue ~= "") and string.find(props.prop, "(SL%l+)") then
-- this is a sitelink-type (SLspecieswiki)
links = findSiteLinksLocal(props, pagetitle, short_links, wikivalue)
elseif wikivalue and wikivalue ~= '' then
-- the property is of another annotation, and therefore a local construct
links = findMainLinksLocal(props, pagetitle, short_links, wikivalue)
end
--mw.log("links="..dump(links))
for _,v in ipairs(links) do
-- we'll have to check langcodes again as they may have come from wikidata
if (#req_lang==0 or req_lang[v.langcode]) then
if checkedonwikidata and not hasdatafromwikidata then
-- add a general tracking category for articles with data from wikidata
hasdatafromwikidata = true
category[#category+1] = cmodule:getMessage(contLang:getCode, 'with-data-cat')
elseif not checkedonwikidata and not hasdatafromlocal then
-- add a general tracking category for articles with data from template-calls in local articles
hasdatafromlocal = true
category[#category+1] = cmodule:getMessage(contLang:getCode, 'with-local-cat')
end
if short_links and props.short and v.text and v.text ~= '' then
-- if short links were requested, and a short definition exists for this property, let's use it
if #output==0 then
output[#output+1] = v.text
else
output[#output] = output[#output] .. cmodule:getMessage(contLang:getCode,'short-list-separator') .. v.text
end
somedataonwikidata = true
elseif not short_links and not showinline and v.text and v.text ~= '' then
-- only if short links were not requested
output[#output+1] = (#output>=1 and conf:g('msg-ul-prepend') or '') -- if this is the first link, we won't output a list-element (msg-ul-prepend)
.. (checkedonwikidata and addLinkback(v.text, props.prop) or v.text) -- if the link comes from wikidata, also output a linkback.
elseif not short_links and showinline and v.text and v.text ~= '' then
-- only if short links were not requested
output[#output+1] = v.text
end
if props.track and v.category and #v.category then
-- add category if tracking is on for this property and a category exists in the link-result.
for _,cats in ipairs( v.category ) do
category[#category+1] = cats
end
end
if links_shown>0 then
links_shown = links_shown - 1
else
break
end
end
end
if links_shown==0 then
break
end
end
end
local outtext = ""
if short_links and #output>0 then
-- if these are short links, output the whole thing with linkback to wikidata
--mw.log("somedataonwikidata="..dump(somedataonwikidata).." and output="..dump(output).." and #output="..dump(#output))
outtext = (somedataonwikidata
and addLinkback(table.concat(output,cmodule:getMessage(contLang:getCode,'short-list-separator')), nil)
or table.concat(output,cmodule:getMessage(contLang:getCode,'short-list-separator')))
elseif not short_links and not showinline and #output>0 then
outtext = table.concat(output,"\n")
elseif not short_links and showinline and #output>0 then
outtext = table.concat(output,conf:g('msg-inline-separator'))
end
if not hasdatafromwikidata then
category[#category+1] = cmodule:getMessage(contLang:getCode, 'no-data-cat')
if not hasdatafromlocal and not short_links then
outtext = cmodule:getMessage(contLang:getCode, 'no-data-text')
end
end
if not haswikidatalink then
category[#category+1] = cmodule:getMessage(contLang:getCode, 'no-wikilink-cat')
if not hasdatafromlocal and not short_links then
outtext = cmodule:getMessage(contLang:getCode, 'no-wikilink')
end
end
local nocategory = getArgument(, conf:a('arg-no-categories'))
category = #category>0 and "\n" .. table.concat(category,"\n") or ""
--mw.log("nocategory="..dump(nocategory).." and outtext="..dump(outtext).." and category="..dump(category))
outtext = outtext .. (nocategory and '' or category)
return outtext
end  
function p.getLanguageCode
local prop = getArgument(, conf:a('arg-properties'))
local output = getLanguageData(prop)
return table.concat(output, conf:a('mod-filter-separator'))
end  
return p