Difference between revisions of "Template:List all smw imports"

From TDWG Terms Wiki
Jump to: navigation, search
m (added parameter "output format=…")
m (refactored to minimise template calls (using extension:arrays))
Line 1: Line 1:
<includeonly>{{#switch: {{LC:{{{output format|table}}}}}<!--
+
<includeonly>{{#arraydefine: MediaWikiPages|{{#ask:[[MediaWiki:+]]
 +
  |?#
 +
  |mainlabel=-
 +
  |limit=1000
 +
  |format=array
 +
  }}
 +
}}<!--
 +
-->{{#arraysearcharray: MediaWikiSmw_import|MediaWikiPages|/^MediaWiki:Smw import\s.+/}}<!--
 +
-->{{#arrayreset: MediaWikiPages}}<!--
 +
 
 +
-->{{#switch: {{LC:{{{output format|table}}}}}<!--
 
  a plain list with links to the import page
 
  a plain list with links to the import page
-->|list={{#arraymap: {{#replace: {{#replace: {{#replace: <!-- remove SMW::off / SMW::on
+
-->|list={{#arrayprint: MediaWikiSmw_import|<!--sep-->,&#32;|<!--variable-->§|<!--output-->{{#explode: §| |-1}} (→&nbsp;[[§|SMW import page]])|<!--options-->print=pretty}}<!--
    -->{{#ask:[[MediaWiki:+]]
+
      |?#
+
      |mainlabel=-
+
      |limit=1000
+
      |format=template
+
      |userparam=plain text
+
      |template=Filter smw import from list
+
      }}<!--  
+
  -->|[[SMW::off]]|}}<!-- -->|,[[SMW::on]]|}}<!-- -->|MediaWiki:Smw import|}}|,|§|§ (→&nbsp;[[MediaWiki:Smw import §|SMW import page]])|,&#32;}}<!--
+
  
 
default is a table
 
default is a table
 
-->| #default = <table class="sortable wikitable">
 
-->| #default = <table class="sortable wikitable">
 
<tr><th>{{Abbr|SMW}} import page</th></tr>
 
<tr><th>{{Abbr|SMW}} import page</th></tr>
<tr><td>
+
<tr><td>{{#arrayprint: MediaWikiSmw_import|<!--sep--></td></tr><tr><td>|<!--variable-->§|<!--output-->[[§]]}}<!--  
{{#replace:<!--
+
-->{{#sub:<!--
+
    -->{{#ask:[[MediaWiki:+]]
+
      |?#
+
      |mainlabel=-
+
      |limit=1000
+
      |format=template
+
      |template=Filter smw import from list
+
      }}<!--  
+
  -->|<!--
+
    sub:from -->{{#len:[[SMW::off]]}}|<!--
+
    sub:to  -->{{#expr: {{#len: ,[[SMW::on]]}} * (-1)}}<!--
+
-->}}<!--
+
  replace: , by the following table cell
+
-->|,<!--  
+
  replace:table cell
+
-->|</td></tr><tr><td><!--  
+
  replace:end
+
-->}}<!--  
+
 
table:closing
 
table:closing
 
  --></td></tr></table><!--
 
  --></td></tr></table><!--

Revision as of 15:25, 3 February 2020

[edit] [purge] Template-info.svg Template documentation

Usage

This template lists all imported vocabulary pages in MediaWiki:Smw import <local-defined-namespace>:

{{List all smw imports}} → show a table layout
{{List all smw imports | output format=list}} → show a comma separated list
{{List all smw imports | output format=two-columns}} → 2 column layout
{{List all smw imports | output format=three-columns}} → 3 column layout

Technical documentation

Dependencies

CSS

/* 2 column Layout */
  .two-columns {
    -moz-column-count:2; /* Firefox */
    -webkit-column-count:2; /* Safari and Chrome */
    column-count:2;

    -moz-column-gap:40px; /* Firefox */
    -webkit-column-gap:40px; /* Safari and Chrome */
    column-gap:40px;

    -moz-column-rule:2px outset gray; /* Firefox */
    -webkit-column-rule:2px outset gray; /* Safari and Chrome */
    column-rule:2px outset gray;
  }
/* 3 column Layout */
  .three-columns {
    -moz-column-count:3; /* Firefox */
    -webkit-column-count:3; /* Safari and Chrome */
    column-count:3;

    -moz-column-gap:40px; /* Firefox */
    -webkit-column-gap:40px; /* Safari and Chrome */
    column-gap:40px;

    -moz-column-rule:2px outset gray; /* Firefox */
    -webkit-column-rule:2px outset gray; /* Safari and Chrome */
    column-rule:2px outset gray;
  }
  .three-columns.flat-ul ul li {
    float:left;
    margin-left:1.5em;
  }
  .three-columns.flat-ul ul {
    clear:both;
    margin:0px 0px 0.5ex 0px;
    padding:0px;
  }
  .three-columns.flat-ul p {
    margin:5px 0px 0ex 0px;
  }
  .three-columns tr {
    /* verhindere Spaltenumbruch */
    -webkit-column-break-inside: avoid; /* Chrome, Safari */
    page-break-inside: avoid;           /* Theoretically FF 20+ */
    break-inside: avoid-column;         /* IE 11 */
  }