Topic on Extension talk:TemplateData

קיפודנחש (talkcontribs)

it is very disappointing, and IMO should be considered a bug, that templatedata does not support scribunto. there should be an established scribunto library that let me consume "templatedata" of a given template from my lua module (return nil or empty table if template does not exist or does not have TD).

scribunto is used mainly with templates, and the ability to consume templatedata should be considered elementary. User:Anomie explains that it is in the responsibility of each extension to generate the linkage library. see phab:T107119 - open since 2015.

currently, we plug this deficiency by executing the following abomination ("docSubPage" is predefined, to the "ducumentation" convention name of the specific wiki):

local function _readTemplateData( templateName ) 
	local title = mw.title.makeTitle( 0, templateName )  
	local templateContent = title and title.exists and title:getContent() ''-- template's raw content''
	local capture =  templateContent and mw.ustring.match( templateContent, '<templatedata%s*>(.*)</templatedata%s*>' ) ''-- templatedata as text''
''--	capture = capture and mw.ustring.gsub( capture, '"(%d+)"', tonumber ) -- convert "1": {} to 1: {}. frame.args uses numerical indexes for order-based params.''
	if capture then return pcall( mw.text.jsonDecode, capture ) end
	return false
end
local function readTemplateData( templateName )
	if type( templateName ) == 'string' then 
		templateName = { templateName, templateName .. '/' .. docSubPage }
	end
	if type( templateName ) == "table" then
		for _, name in ipairs( templateName ) do
			local td, result = _readTemplateData( name ) 
			if td then return result end
		end
	end
	return nil
end

please follow the instructions (here), and be done with it.


peace.

Whatamidoing (WMF) (talkcontribs)

Realistically, the priority level on that patch means that the team will cheerfully accept patches written by others. If you are waiting for the team to do this themselves, then I don't think this will happen any time soon.

קיפודנחש (talkcontribs)

i responded on phabricator back when.

the priority level of this ticket is grossly wrong. you guys need to jack up this priority. see, e.g., how many people subscribe to the ticket (look at the dupes also!) this is elementary - every extension that adds to the API, where it makes sense, should make it accessible to scribunto. it's hard to think of anything _more_ relevant to scribunto than templatedata.

peace.

Whatamidoing (WMF) (talkcontribs)

The priority level is meant to accurately communicate the team's actual intentions. In this case, AFAICT they don't mean to work on it during at least the next year. Reasonable people might disagree with their decision, of course, but the level marked in the ticket is meant to communicate that decision.

I'll ask the product manager to re-consider. To be candid, I don't have much hope for a change. The team is not focused on adding new features to TemplateData. Realistically, I expect they'll say that if the Scribunto people want to use TemplateData, then the Scribunto people need to write the patch.

קיפודנחש (talkcontribs)

in view of this comment, you can interpret my comment about "the priority level of this ticket is grossly wrong" to mean "the team's intention is grossly misguided"...

we are not talking here about "adding new features". twisi, it's about fixing a bug.

the thorn here touches the question who are those "scribunto people". the simplest interpretation is that "the scribunto people" are the community members writing modules in lua, in the different wikis, and often share/import those modules from one wiki to another.

these are decidedly different group of people from the group who create the mw libraries _available_ to those modules.

for instance, the wikidata team created an interface library enabling lua modules access to wikidata database, which proved to be very very successful. the people who created this interface library _are not_ generally thought of as "the scribunto people" - they are "wikidata people", but thanks to this interface' "the scribunto people" can now write modules that utilizes wikidata.

in a similar fashion, "the templatedata people" should write the interface library betwixt their stuff and scribunto.

tagging User:Anomie, hope to hear his take on which people should do what.

peace.

Anomie (talkcontribs)
tagging User:Anomie, hope to hear his take on which people should do what.

As was mentioned, anyone who wants to could submit a patch. The problem is finding someone who wants to, and has the necessary skills, and has the time to do it.

You're welcome to try to convince a WMF team to take it on, but if they say no then you may have to accept that answer. You're also welcome to work out how to do it yourself and submit a patch, or to convince a third party developer to write and submit a patch to your specifications.

Reply to "scribunto"