#ask: syntax – "align" printout formatter

From semantic-mediawiki.org
< #ask: syntax elements
#ask: syntax elements#ask: syntax – "align" printout formatter
#ask: syntax details:
Syntax
+align=
Description Defines an alignment for the content of a printout column
Datatype support All datatypes
Component printout
Software Semantic MediaWiki
Since version Semantic MediaWiki 1.5.0 Released on 7 March 2010 and compatible with MW 1.14.x - 1.17.x.
Keyword table format

The +align= query printout formatter for columns was introduced in Semantic MediaWiki 1.5.0Released on 7 March 2010 and compatible with MW 1.14.x - 1.17.x..

Rationale[edit]

Allows to define an alignment for the content of the table column for result format "table"Outputs the results in a table (default for queries with printout statements). or result format "broadtable"Outputs the results 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[edit]

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[edit]

References

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