Difference between revisions of "Talk:Norway/Media"

From Wikispooks
Jump to navigation Jump to search
(Created page with "Where can I find a template for creating a table? I want to make one over all nationality=Norwegian nationality=Norway and constitutes=editor and constitutes=journalist const...")
 
Line 1: Line 1:
 
Where can I find a template for creating a table? I want to make one over all nationality=Norwegian nationality=Norway  and constitutes=editor and constitutes=journalist constitutes=Media owner
 
Where can I find a template for creating a table? I want to make one over all nationality=Norwegian nationality=Norway  and constitutes=editor and constitutes=journalist constitutes=Media owner
 
[[User:Terje|Terje]] ([[User talk:Terje|talk]])
 
[[User:Terje|Terje]] ([[User talk:Terje|talk]])
 +
 +
:THe first place I thought of is [[Template:SMWDocs]], since this includes a whole bunch of tables. There is for example [[Template:Nationals]]. However, these are all using [[Template:SMWDocSection]], so perhaps that is a better place to start. From the code:
 +
<code><nowiki>{{ask
 +
|format=table
 +
|limit={{{limit|}}}
 +
|sort={{{sort|}}}
 +
|order={{{order|}}}
 +
|expression={{{expression|}}}
 +
|mainlabel={{{mainlabel|}}}
 +
|properties={{{properties|}}}
 +
|headers={{{headers|}}}}}
 +
}}</nowiki></code>
 +
This is using [[Template:ask]], which I worked hard on to make flexible enough for most purposes. It has a not very widely used yet syntax of '/' as separators for the {{t|properties}} and  {{t|headers}} fields. The plain vanilla table looks like this:
 +
{{ask
 +
|format=table
 +
|limit=
 +
|sort=
 +
|order=
 +
|expression=[[Constitutes::Editor]][[Has nationality::Norway]]
 +
|mainlabel=Norwegian Editors
 +
|properties=
 +
|headers=
 +
}}
 +
The source code for that table looks like this: <code><nowiki>{{ask
 +
{{ask
 +
|format=table
 +
|limit=
 +
|sort=
 +
|order=
 +
|expression=[[Constitutes::Editor]][[Has nationality::Norway]]
 +
|mainlabel=Norwegian Editors
 +
|properties=
 +
|headers=
 +
}}</nowiki></code>
 +
 +
Note that SMW understands all words as equivalent if they redirect to the same page, so <code><nowiki>[[Has nationality::Norway OR Has nationality::Norwegian]]</nowiki></code> is unneeded. So the first start at the table you're looking for is:
 +
 +
{{ask
 +
|format=table
 +
|limit=
 +
|sort=
 +
|order=
 +
|expression=[[Constitutes::Editor]][[Has nationality::Norway]] OR [[Constitutes::Editor]][[Has nationality::Media mogul]] OR [[Constitutes::Journalist]][[Has nationality::Norway]] OR [[Constitutes::Publisher]][[Has nationality::Norway]]
 +
|mainlabel=Norwegian media players
 +
|properties=
 +
|headers=
 +
}}
 +
This has source: <code><nowiki>{{ask
 +
{{ask
 +
|format=table
 +
|limit=
 +
|sort=
 +
|order=
 +
|expression=[[Constitutes::Editor]][[Has nationality::Norway]] OR [[Constitutes::Editor]][[Has nationality::Media mogul]] OR [[Constitutes::Journalist]][[Has nationality::Norway]] OR [[Constitutes::Publisher]][[Has nationality::Norway]]
 +
|mainlabel=Norwegian media players
 +
|properties=
 +
|headers=
 +
}}</nowiki></code>
 +
 +
The next step is to decide what which columns the table should have, which is expressed as |headers and |properties. These use the '/'-separated list syntax used for <code>|key_properties</code> and <code>|key_property_headers</code>, for example at the "[[Lone nut]]" page.
 +
 +
{{ask
 +
|format=table
 +
|limit=50
 +
|sort=Description
 +
|order=Description
 +
|expression=[[Constitutes::Editor]][[Has nationality::Norway]] OR [[Constitutes::Editor]][[Has nationality::Media mogul]] OR [[Constitutes::Journalist]][[Has nationality::Norway]] OR [[Constitutes::Publisher]][[Has nationality::Norway]]
 +
|mainlabel=Norwegian media players
 +
|properties=Description
 +
|headers=Description
 +
}}
 +
 +
Hmmmm, that table does not appear to have a 'description' comunon the preview. I wonder whether it will if I save it? -- [[User:Robin|Robin]] ([[User talk:Robin|talk]]) 19:29, 4 July 2023 (UTC)

Revision as of 19:29, 4 July 2023

Where can I find a template for creating a table? I want to make one over all nationality=Norwegian nationality=Norway and constitutes=editor and constitutes=journalist constitutes=Media owner Terje (talk)

THe first place I thought of is Template:SMWDocs, since this includes a whole bunch of tables. There is for example Template:Nationals. However, these are all using Template:SMWDocSection, so perhaps that is a better place to start. From the code:

{{ask |format=table |limit={{{limit|}}} |sort={{{sort|}}} |order={{{order|}}} |expression={{{expression|}}} |mainlabel={{{mainlabel|}}} |properties={{{properties|}}} |headers={{{headers|}}}}} }} This is using Template:ask, which I worked hard on to make flexible enough for most purposes. It has a not very widely used yet syntax of '/' as separators for the properties and headers fields. The plain vanilla table looks like this:

Norwegian Editors
Kjetil Alstadheim
Trine Eilertsen
Torolf Elster
Thor Gjermund Eriksen
Einar Førde
Rolf Gerhardsen
Per Egil Hegge
Helge Seip
Hanne Skartveit
Nils Udgaard
Hans Vatne

The source code for that table looks like this: {{ask {{ask |format=table |limit= |sort= |order= |expression=[[Constitutes::Editor]][[Has nationality::Norway]] |mainlabel=Norwegian Editors |properties= |headers= }}

Note that SMW understands all words as equivalent if they redirect to the same page, so [[Has nationality::Norway OR Has nationality::Norwegian]] is unneeded. So the first start at the table you're looking for is:


Norwegian media players
Kjetil Alstadheim
Trine Eilertsen
Torolf Elster
Hans Engen
Thor Gjermund Eriksen
Einar Førde
Rolf Gerhardsen
Per Egil Hegge
Christian Michelsen
Finn Moe
Helge Seip
Hanne Skartveit
Pål Steigan
Arne Treholt
Nils Udgaard
Hans Vatne

This has source: {{ask {{ask |format=table |limit= |sort= |order= |expression=[[Constitutes::Editor]][[Has nationality::Norway]] OR [[Constitutes::Editor]][[Has nationality::Media mogul]] OR [[Constitutes::Journalist]][[Has nationality::Norway]] OR [[Constitutes::Publisher]][[Has nationality::Norway]] |mainlabel=Norwegian media players |properties= |headers= }}

The next step is to decide what which columns the table should have, which is expressed as |headers and |properties. These use the '/'-separated list syntax used for |key_properties and |key_property_headers, for example at the "Lone nut" page.


Norwegian media players
Arne Treholt
Thor Gjermund Eriksen
Einar Førde
Torolf Elster
Hanne Skartveit
Trine Eilertsen
Hans Vatne
Kjetil Alstadheim
Per Egil Hegge
Nils Udgaard
Finn Moe
Hans Engen

Hmmmm, that table does not appear to have a 'description' comunon the preview. I wonder whether it will if I save it? -- Robin (talk) 19:29, 4 July 2023 (UTC)