#ask: printout column width

From semantic-mediawiki.org
Jump to: navigation, search
#ask: syntax elements#ask: printout column width
Syntax
+width=
Description Defines a width for a printout column1
Datatype support All datatypes
Component printout
Software Semantic MediaWiki
First version supported Semantic MediaWiki 3.0.0 Released on an unknown date and compatible with MW 1.27.0 - 1.30.x.
Keyword table format

Rationale

Allows to define a width for the table column for result format "table"Outputs the result in a table. or result format "broadtable"Outputs the result in a broad table. using the +width= query parameter. Thus it enables different tables on the same page to be formatted with the same width without relying on result format "template"Uses a specified template to format and display the results or individually defined CSS classes added via the class parameter.

The value set with the +width= query parameter denotes the width the respective result column should take. The value consists of an integer together with either "%", "px" or "em" as a unit like e.g. |+width=50%, |+width=25px or |+width=10em.

This query parameter does not allow to manipulate the main result column handled with the mainlabel query parameter.2 See the example below on how to still achieve the desired printout easily.

Examples

Syntax
{{#ask:
 [[Category: Foo]]
 |?Has text |+width=50%
 |?Has number |+width=10em
 |?Has date |+width=20px
 |format=table
}}

or

{{#ask:
 [[Category: Foo]]
 |?Has text |+width=50%
 |?Has number |+width=10em
 |?Has date |+width=20px
 |format=broadtable
}}
Syntax for manipulating the main result column
{{#ask:
 [[Category: Foo]]
 |? |+width=20%
 |?Has text |+width=50%
 |?Has number |+width=10em
 |?Has date |+width=20px
 |format=table
 |mainlabel=-
}}

What you do here is that you hide the main result column with |mainlabel=- and add it at the same time with |? which in turn allows you to apply the query parameter described on this page.

Link

See also

References

  1. ^  Semantic MediaWiki: GitHub pull request gh:smw:2677
  2. ^  Semantic MediaWiki: GitHub pull request #2677 comment