#ask: printout column alignment

From semantic-mediawiki.org
Jump to: navigation, search
#ask: syntax elements#ask: printout column alignment
Syntax
+align=
Description Defines an alignment for the content of a printout column
Datatype support All datatypes
Component printout
Software Semantic MediaWiki
First version supported Semantic MediaWiki 1.5.0 Released on 7 March 2010 and compatible with MW 1.14.x - 1.17.x.
Keyword table format

Rationale

Allows to define an alignment for the content of 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 +align= query parameter. Thus it enables different tables on the same page to be formatted with the same alignment 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 query parameter.

The value set with the +align= query parameter denotes the alignment the content of the respective result column should take. The value consists is either "right", "center" or "left" like e.g. |+align=right, |+align=center or |+align=left. Note that "left" is the default which usually does not need to be defined explicitly.

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

Examples

Syntax
{{#ask:
 [[Category: Foo]]
 |?Has text |+align=left
 |?Has number |+align=right
 |?Has date |+align=center
 |format=table
}}

or

{{#ask:
 [[Category: Foo]]
 |?Has text |+align=left
 |?Has number |+align=right
 |?Has date |+align=center
 |format=broadtable
}}
Syntax for manipulating the main result column
{{#ask:
 [[Category: Foo]]
 |? |+align=center
 |?Has text |+align=left
 |?Has number |+align=right
 |?Has date |+align=center
 |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.

See also

References

  1. ^  Semantic MediaWiki: GitHub issue comment gh:smw:2677:333343292