Mal:Columns-list/dok

Fra Slektshistoriewiki
Hopp til navigering Hopp til søk

{{#ifeq: dok | doc

 | 

{{

   #ifeq: show | show
   | {{#invoke:Message box|mbox

|image=Fil:Edit-copy green.svg |imageright= |style= |textstyle= |text=This is a documentation subpage for Mal:Columns-list.
It contains usage information, categories and other content that is not part of the original {{ #if: | {{{text2}}} | {{ #if: | {{{text1}}} | {{ #ifeq: Mal | Bruker | mal template page | {{ #if: Mal |mal page|article}}}}}}}}. |small= |smallimage= |smallimageright= |smalltext= |category= |all= |date= }}

   }}{{
   #if: 
   | 
   | {{#ifexist:Mal:Columns-list|[[Category:{{
     #switch: Mal
     | Template  = Template
     | Module  = Module
     | User      = User
     | #default  = Wikipedia
   }} documentation pages]]|}}
 }}

| }} Mal:Lua

This template is for use in a list in the body of an article, rather than in a navigation template like Template:Navbox. Based on Template:Reflist, but different in that the text to be displayed is manually created rather than a list of references.

Use

The width of each column may be specified using |{{#if:colwidth|colwidth=}} and a value in ems.

{{columns-list|colwidth=width|
Text (usually a list)
}}

Here, width specifies the width of the columns, and determines dynamically the number of columns based on screen width; more columns will be shown on wider displays.

If |{{#if:colwidth|colwidth=}} is not specified, the default width of 30em will be used.

This template uses CSS3 multiple-column layout, which is not supported by all Web browsers.

Mal:CSS3 multiple column layout

Examples

Here is an example: <syntaxhighlight lang=text>{{#if:

|{{safesubst:#invoke:Template wrapper|wrap|_template=div col|_alias-map=1:content|colwidth=30em}}}}{{#invoke:Check for unknown parameters|check|unknown=Mal:Main other|preview=Page using Template:Columns-list with unknown parameter "_VALUE_"|ignoreblank=y| 1 | class | content | colwidth | gap | rules | small | style }}</syntaxhighlight>

which would render as: Mal:Clear {{#if:

|{{safesubst:#invoke:Template wrapper|wrap|_template=div col|_alias-map=1:content|colwidth=30em}}}}{{#invoke:Check for unknown parameters|check|unknown=Mal:Main other|preview=Page using Template:Columns-list with unknown parameter "_VALUE_"|ignoreblank=y| 1 | class | content | colwidth | gap | rules | small | style }}

CSS styles can also be added with the |{{#if:style|style=}} parameter. For example:

<syntaxhighlight lang=text>{{#if:

|{{safesubst:#invoke:Template wrapper|wrap|_template=div col|_alias-map=1:content|colwidth=30em}}}}{{#invoke:Check for unknown parameters|check|unknown=Mal:Main other|preview=Page using Template:Columns-list with unknown parameter "_VALUE_"|ignoreblank=y| 1 | class | content | colwidth | gap | rules | small | style }}</syntaxhighlight>

which would render as: {{#if:

|{{safesubst:#invoke:Template wrapper|wrap|_template=div col|_alias-map=1:content|colwidth=30em}}}}{{#invoke:Check for unknown parameters|check|unknown=Mal:Main other|preview=Page using Template:Columns-list with unknown parameter "_VALUE_"|ignoreblank=y| 1 | class | content | colwidth | gap | rules | small | style }}

This template also works with numbered lists as its "text". For example:

<syntaxhighlight lang=text> {{#if:

  1. George Washington
  2. John Adams
  3. Thomas Jefferson
  4. James Madison
  5. James Monroe

|{{safesubst:#invoke:Template wrapper|wrap|_template=div col|_alias-map=1:content|colwidth=30em}}}}{{#invoke:Check for unknown parameters|check|unknown=Mal:Main other|preview=Page using Template:Columns-list with unknown parameter "_VALUE_"|ignoreblank=y| 1 | class | content | colwidth | gap | rules | small | style }} </syntaxhighlight>

{{#if:

  1. George Washington
  2. John Adams
  3. Thomas Jefferson
  4. James Madison
  5. James Monroe

|{{safesubst:#invoke:Template wrapper|wrap|_template=div col|_alias-map=1:content|colwidth=30em}}}}{{#invoke:Check for unknown parameters|check|unknown=Mal:Main other|preview=Page using Template:Columns-list with unknown parameter "_VALUE_"|ignoreblank=y| 1 | class | content | colwidth | gap | rules | small | style }}

The template, in fact, works with everything since all it does is wrap the text provided around a block to be divided into columns by CSS. Do not stop at wikitext lists – more advanced lists generated by the HTML templates will work too!

Error messages

Use of the no-longer-supported parameter |{{#if:cols|cols=}}, or use of the first unnamed parameter (aka |{{#if:1|1=}}) along with |{{#if:2|2=}} or a second unnamed parameter for the template's content, will generate a red error message. To fix this error, use |{{#if:colwidth|colwidth=}} instead of attempting to specify the number of columns.

The presence of an equals sign within the template's content can also cause display problems and red error messages. To fix this problem, add |{{#if:1|1=}} in front of the template's content.

Tracking category

  • Mal:Clc (for pages in article space only)