#ask: syntax – "width" printout formatter

From Linux Web Expert

#ask: syntax details:
Syntax +width=
Description Property "Has description" (as page type) with input value "Defines a width for a printout column[[CiteRef::gh:smw:2677" contains invalid characters or is incomplete and therefore can cause unexpected results during a query or annotation process.
Datatype support All datatypes
Component printout
Software Semantic MediaWiki
Since version Semantic MediaWiki 3.0.0 Released on an unknown date unknown versions of MediaWiki
Keyword table format

The +width= query printout formatter for columns was introduced in Semantic MediaWiki 3.0.0Released on an unknown date unknown versions of MediaWiki.

Rationale

Allows to define a width for 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 +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"No description was provided. 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.1 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

<sandbox.semantic-mediawiki.org>: More examples for this query parameter

See also

#scite could not render a citation text for reference "gh:smw:2677" because type "pullrequest" was not assigned to a template.
#scite could not render a citation text for reference "gh:smw:2677:333343292" because type "issuecomment" was not assigned to a template.

References

  1. ^ gh:smw:2677:333343292