|
|
Riga 470: |
Riga 470: |
| return queryResult | | return queryResult |
| end | | end |
| --- Generates a table of episodes with details using SMW query.
| |
| --
| |
| -- @frame Info from MW session
| |
| -- @return A table with episodes list and details
| |
| function p.EpisodesTable(frame)
| |
| local Value
| |
| local Selection
| |
| local Item = mw.wikibase.getEntity()
| |
| if not Item then
| |
| Item = mw.wikibase.getEntity('Q1')
| |
| end
| |
|
| |
| if Item.claims[P90][1] then
| |
| if Item.claims[P18][1] then
| |
| Selection = "[[Istanza::" .. "]][[Stagione::" .. "]]"
| |
| else
| |
| Selection = "[[Istanza::" .. "]]"
| |
| end
| |
| else
| |
| return "No P90"
| |
| end
| |
|
| |
|
| Value = Item['claims'][Property][1].mainsnak.datavalue['value']
| |
| local QueryResult = mw.smw.ask(Selection .. '|?Titolo italiano|?Numero di produzione|?Data di trasmissione|format=broadtable|sort=Numero di produzione|order=asc|class=sortable wikitable smwtable')
| |
| end
| |
| --- Prepares the selection for the SMW query to generate a list of episodes
| |
| -- with details using SMW query.
| |
| --
| |
| -- @frame Info from MW session
| |
| -- @return Query text
| |
| function p.EpisodesQuerySelection(frame)
| |
| local Value
| |
| local Selection
| |
| local Item = mw.wikibase.getEntity()
| |
| if not Item then
| |
| Item = mw.wikibase.getEntity('Q1')
| |
| end
| |
|
| |
| if Item.claims['P90'] then
| |
| if Item.claims['P18'] then
| |
| Selection = "[[Istanza::{{#property:P90}}]][[Stagione::{{#property:P18}}]]"
| |
| else
| |
| Selection = "[[Istanza::{{#property:P90}}]]"
| |
| end
| |
| return mw.text.nowiki(Selection)
| |
| else
| |
| return "No P90"
| |
| end
| |
| end
| |
| return p | | return p |