Difference between revisions of "Vorlage:BrowseByAskQueryPreviousNext"

From FloraWiki - das Wiki zur Schweizer Flora
Jump to: navigation, search
m (#var: propertyPageName translated)
m (fix docu)
 
(One intermediate revision by the same user not shown)
Line 3: Line 3:
 
-->{{#vardefine: propertyPageName|{{#switch:{{CONTENTLANGUAGE}}
 
-->{{#vardefine: propertyPageName|{{#switch:{{CONTENTLANGUAGE}}
 
|de|de-formal=Seitenname
 
|de|de-formal=Seitenname
|en=Pagename
+
|en=pagename
|fr=Nom de la page
+
|fr=Nom de page
 
|it=Nome pagina
 
|it=Nome pagina
|#default=Pagename
+
|#default=pagename
 
}}}}<!--
 
}}}}<!--
 
-->[[{{#var: propertyPageName}}::{{PAGENAME}}| ]]<!--
 
-->[[{{#var: propertyPageName}}::{{PAGENAME}}| ]]<!--
Line 122: Line 122:
  
 
   ## show cases output/HTML ##
 
   ## show cases output/HTML ##
-->{{#switch: {{#explode: {{{show|}}} |.|-1}}<!-- (e.g. "show = 20.images") -->
+
  -->{{#switch: {{#explode: {{{show|}}} |.|-1}}<!-- (e.g. "show = 20.images")  
| images = <!-- images
+
  -->| images = <!-- images
  --><div style='border:2px inset gray;width:99%;'  class="noprint"><!--
+
    --><div style='border:2px inset gray;width:99%;'  class="noprint"><!--
  --><table id=toc style="width: 100%;background-color:white;"><tr><!--
+
    --><table id=toc style="width: 100%;background-color:white;"><tr><!--
    --><td style="text-align: left; width: 9em;">[[:{{#explode: {{#var: pagesbefore}}|<sep>|-1}} |&larr; {{Multilingual switch| de = rückwärts | en = backward}}]]</td><!--
+
      --><td style="text-align: left; width: 9em;">[[:{{#explode: {{#var: pagesbefore}}|<sep>|-1}} |&larr; {{Multilingual switch| de = rückwärts | en = backward}}]]</td><!--
    --><td style="text-align: center; width: auto;"><!--
+
      --><td style="text-align: center; width: auto;"><!--
      -->{{Multilingual switch<!--
+
        -->{{Multilingual switch<!--
        -->|de=Bilder in alphabetischer Reihenfolge vor und nach „{{{compare with|{{PAGENAME}} }}}“<!--
+
          -->|de=Bilder in alphabetischer Reihenfolge vor und nach „{{{compare with|{{PAGENAME}} }}}“<!--
        -->|en=Browse images in alphabetical order before and after “{{{compare with|{{PAGENAME}} }}}”}}</td><!--
+
          -->|en=Browse images in alphabetical order before and after “{{{compare with|{{PAGENAME}} }}}”}}</td><!--
    --><td style="text-align: right; width: 9em;">[[:{{#explode: {{#var: pagesafter}}|<sep>|-1}}|{{Multilingual switch| de = vorwärts | en = forward}} &rarr;]]</td><!--
+
      --><td style="text-align: right; width: 9em;">[[:{{#explode: {{#var: pagesafter}}|<sep>|-1}}|{{Multilingual switch| de = vorwärts | en = forward}} &rarr;]]</td><!--
  --></tr></table><!--
+
    --></tr></table><!--
  --><div style='overflow-x:auto;height:210px;background-color:black;'><!--
+
    --><div style='overflow-x:auto;height:210px;background-color:black;'><!--
  --><table style='background-color:black;'><!--
+
    --><table style='background-color:black;'><!--
  --><!--
+
      --><tr><!--
  --><tr><!--
+
        pages before: is page10, page9, page8 ...
      pages before: is page10, page9, page8 ...
+
      -->{{#vardefine: temp|}}<!--
    -->{{#vardefine: temp|}}<!--
+
          compose a ascending order of page10, page9, page8 by saving a page temporarily
        compose a ascending order of page10, page9, page8 by saving a page temporarily
+
      -->{{#arraymap: {{#var: pagesbefore}}
    -->{{#arraymap: {{#var: pagesbefore}}
+
          |<sep>|§
        |<sep>|§
+
          |{{#vardefine: temp| <td style="width:120px;vertical align:center;"><!--
        |{{#vardefine: temp| <td style="width:120px;vertical align:center;"><!--
+
          -->[[§|{{#explode: §|{{ns:file}}:|1}}|thumb|middle|center|120x120px]]</td> {{#var: temp}} }}
        -->[[§|{{#explode: §|{{ns:file}}:|1}}|thumb|middle|center|120x120px]]</td> {{#var: temp}} }}
+
          |
        |
+
          }}<!--
        }}<!--
+
      -->{{#var: temp}}<!--
    -->{{#var: temp}}<!--
+
  
      current page itself
+
        current page itself
      --><td style="width:120px;vertical align:center;background-color:gray;border:1px #774422 solid;"><!--
+
        --><td style="width:120px;vertical align:center;background-color:gray;border:1px #774422 solid;"><!--
        -->[[{{{compare with|{{FULLPAGENAME}}}}}|<!--
+
          -->[[{{{compare with|{{FULLPAGENAME}}}}}|<!--
        add 'File:' if necessary
+
          add 'File:' if necessary
      -->{{#switch:  {{#explode: {{{compare with|{{PAGENAME}}}}}|:|0}}<!--
+
        -->{{#switch:  {{#explode: {{{compare with|{{PAGENAME}}}}}|:|0}}<!--
      -->| Datei | File = File:{{{compare with|{{PAGENAME}}}}}<!--
+
        -->| Datei | File = File:{{{compare with|{{PAGENAME}}}}}<!--
      -->| #default = {{{compare with|{{PAGENAME}}}}}<!--
+
        -->| #default = {{{compare with|{{PAGENAME}}}}}<!--
      -->}}|thumb|middle|center|120x120px]]</td><!--
+
        -->}}|thumb|middle|center|120x120px]]</td><!--
  
      pages after
+
        pages after
    -->{{#arraymap: {{#var: pagesafter}}<!--
+
      -->{{#arraymap: {{#var: pagesafter}}<!--
    -->|<sep>|§|<td style="width:120px;vertical align:center;"><!--
+
      -->|<sep>|§|<td style="width:120px;vertical align:center;"><!--
        -->[[§|{{#explode: §|{{ns:file}}:|1}}|thumb|middle|center|120x120px]]</td>|<!--
+
          -->[[§|{{#explode: §|{{ns:file}}:|1}}|thumb|middle|center|120x120px]]</td>|<!--
    -->}}<!--
+
      -->}}<!--
  --></tr></table><!--
+
    --></tr></table><!--
  --></div><!--
+
    --></div><!--
  --></div>
+
    --></div><!--
 
+
  -->| text = «&nbsp;[[{{#var: pagebefore}}|{{#var: pagebeforeNoNs}}]]&nbsp;{{!}}&nbsp;[[{{#var: pageafter}}|{{#var: pageafterNoNs}}]]&nbsp;»<!--
| text = «&nbsp;[[{{#var: pagebefore}}|{{#var: pagebeforeNoNs}}]]&nbsp;{{!}}&nbsp;[[{{#var: pageafter}}|{{#var: pageafterNoNs}}]]&nbsp;»
+
  -->| books-left-right-floating = <!--
| books-left-right-floating = <!--
+
      --><div style="float:left;margin-right:1em;margin-bottom:0.5ex;" class="noprint">[[File:Farm-Fresh book previous.png|link={{#var: pagebefore}}|{{#var: pagebeforeNoNs}}]]</div><!--
    --><div style="float:left;margin-right:1em;margin-bottom:0.5ex;" class="noprint">[[File:Farm-Fresh book previous.png|link={{#var: pagebefore}}|{{#var: pagebeforeNoNs}}]]</div><!--
+
      --><div style="float:right;margin-left:1em;margin-bottom:0.5ex;" class="noprint">[[File:Farm-Fresh book next.png|link={{#var: pageafter}}|{{#var: pageafterNoNs}}]]</div><!--
    --><div style="float:right;margin-left:1em;margin-bottom:0.5ex;" class="noprint">[[File:Farm-Fresh book next.png|link={{#var: pageafter}}|{{#var: pageafterNoNs}}]]</div>
+
  -->| navigation long = {{Navigation
| navigation long = {{Navigation
+
        | style = {{{style|}}}
    | style = {{{style|}}}
+
        | backlink = {{#ifeq: {{#var: pagebefore}}|{{PAGENAME}}|<!-- nothing -->|{{#ifeq: {{#var: pagebefore}}|{{#var: pageafter}}|<!-- nothing -->|{{#var: pagebefore}} }} }}
    | backlink = {{#ifeq: {{#var: pagebefore}}|{{PAGENAME}}|<!-- nothing -->|{{#ifeq: {{#var: pagebefore}}|{{#var: pageafter}}|<!-- nothing -->|{{#var: pagebefore}} }} }}
+
        | backtext = <!--
    | backtext = <!--
+
        -->{{#ifeq: {{#var: pagebeforeNoNs}} | {{PAGENAME}}<!--
    -->{{#ifeq: {{#var: pagebeforeNoNs}} | {{PAGENAME}}<!--
+
        then-->|<!-- nothing
    then-->|<!-- nothing
+
        else-->|{{#ifeq: {{#var: pagebeforeNoNs}} | {{#var: pageafterNoNs}}<!--
    else-->|{{#ifeq: {{#var: pagebeforeNoNs}} | {{#var: pageafterNoNs}}<!--
+
      then-->|<!-- nothing
+
      else-->|{{#var: pagebeforeNoNs}}
+
            }}
+
      }}
+
    | uplink  = {{{link up|}}}
+
    | uptext  = {{{link up text|}}}
+
    | forwardlink    = {{#ifeq: {{#var: pagebefore}}|{{PAGENAME}}|<!-- nothing -->|{{#ifeq: {{#var: pageafter}}|{{PAGENAME}}|<!-- nothing -->|{{#var: pageafter}} }} }}
+
    | forwardtext    = <!--
+
      -->{{#ifeq: {{#var: pageafterNoNs}} | {{PAGENAME}}<!--
+
 
           then-->|<!-- nothing
 
           then-->|<!-- nothing
           else-->|{{#var: pageafterNoNs}}<!--
+
           else-->|{{#var: pagebeforeNoNs}}
      -->}}
+
                }}
  }}
+
          }}
| #default =<!--
+
        | uplink  = {{{link up|}}}
  --><span style="white-space:nowrap"><!--
+
        | uptext  = {{{link up text|}}}
    -->[[File:Go-previous.svg|24px|link=<!--
+
        | forwardlink    = {{#ifeq: {{#var: pagebefore}}|{{PAGENAME}}|<!-- nothing -->|{{#ifeq: {{#var: pageafter}}|{{PAGENAME}}|<!-- nothing -->|{{#var: pageafter}} }} }}
        avoid ":File:example.jpg" → "File:example.jpg"
+
        | forwardtext    = <!--
      -->{{#if: {{#explode: {{#var: pagebefore}}|:|0}}<!--
+
          -->{{#ifeq: {{#var: pageafterNoNs}} | {{PAGENAME}}<!--
      then-->|{{#var: pagebefore}} <!--
+
              then-->|<!-- nothing
      else-->|{{#sub: {{#var: pagebefore}} | 1 }} }}]]<!--
+
              else-->|{{#var: pageafterNoNs}}<!--
  -->{{!}}[[File:Go-next.svg|24px|link=<!--
+
          -->}}
        avoid ":File:example.jpg" → "File:example.jpg"
+
      }}<!--
      -->{{#if: {{#explode: {{#var: pageafter}}|:|0}}<!--
+
  -->| #default =<!--
      then-->|{{#var: pageafter}} <!--
+
    --><span style="white-space:nowrap"><!--
      else-->|{{#sub: {{#var: pageafter}} | 1 }} }}]]<!--
+
      -->[[File:Go-previous.svg|24px|link=<!--
  --></span>
+
          avoid ":File:example.jpg" → "File:example.jpg"
  }}<!--
+
        -->{{#if: {{#explode: {{#var: pagebefore}}|:|0}}<!--
 +
        then-->|{{#var: pagebefore}} <!--
 +
        else-->|{{#sub: {{#var: pagebefore}} | 1 }} }}]]<!--
 +
    -->{{!}}[[File:Go-next.svg|24px|link=<!--
 +
          avoid ":File:example.jpg" → "File:example.jpg"
 +
        -->{{#if: {{#explode: {{#var: pageafter}}|:|0}}<!--
 +
        then-->|{{#var: pageafter}} <!--
 +
        else-->|{{#sub: {{#var: pageafter}} | 1 }} }}]]<!--
 +
    --></span>
 +
    }}<!--
  
ELSE -->|{{Vorlagenfehler | Text = <!--
+
ELSE -->|{{TemplateError
    (3) Beispiele einfügen -->
+
| text ={{#switch:{{CONTENTLANGUAGE}}<!--
 +
  switch CONTENTLANGUAGE:de
 +
-->|de|de-formal=<!--
 +
  (3) Beispiele einfügen -->
 
Erzeugt eine automatische Navigation innerhalb eine Kategorie oder für eine Semantic Mediawiki Suchabfrage. Vorgabe-Layout ist platzsparend als Pfeile, jedoch kann mit dem Parameter <code>show=…</code> Linktext (<code>show=text</code>), eine lange Navigation (<code>show=navigation long</code>) sowie Bilder (<code>show=images</code>) statt Pfeilen ausgegeben werden. Falls der aktuelle Seitenname nicht mit in der Kategorie geführt wird, kann ein abweichender „Vergleichs“-Seitenname mit <code>compare with</code> vergeben werden.
 
Erzeugt eine automatische Navigation innerhalb eine Kategorie oder für eine Semantic Mediawiki Suchabfrage. Vorgabe-Layout ist platzsparend als Pfeile, jedoch kann mit dem Parameter <code>show=…</code> Linktext (<code>show=text</code>), eine lange Navigation (<code>show=navigation long</code>) sowie Bilder (<code>show=images</code>) statt Pfeilen ausgegeben werden. Falls der aktuelle Seitenname nicht mit in der Kategorie geführt wird, kann ein abweichender „Vergleichs“-Seitenname mit <code>compare with</code> vergeben werden.
  
Line 216: Line 217:
 
       | 1= {{Logo | Tip | 15px}} Beispiele:  <code><nowiki>{{BrowseByAskQueryPreviousNext | [[Kategorie:Literatur]]}}</nowiki></code>
 
       | 1= {{Logo | Tip | 15px}} Beispiele:  <code><nowiki>{{BrowseByAskQueryPreviousNext | [[Kategorie:Literatur]]}}</nowiki></code>
 
       | 2=
 
       | 2=
<source lang="html4strict">
+
<syntaxhighlight lang="html4strict">
 
{{BrowseByAskQueryPreviousNext | [[Kategorie:Literatur]]}}
 
{{BrowseByAskQueryPreviousNext | [[Kategorie:Literatur]]}}
 
<!-- 1 oder query == #ask-Abfrage-->
 
<!-- 1 oder query == #ask-Abfrage-->
Line 223: Line 224:
 
<!-- compare with == falls abweichend von Seitenname (=Vorgabe)  -->
 
<!-- compare with == falls abweichend von Seitenname (=Vorgabe)  -->
 
{{BrowseByAskQueryPreviousNext | query = [[Kategorie:Literatur]] | compare with = Weymar 1988b}}
 
{{BrowseByAskQueryPreviousNext | query = [[Kategorie:Literatur]] | compare with = Weymar 1988b}}
</source><!--
+
</syntaxhighlight><!--
 
     -->}}<!-- Hidden::end -->
 
     -->}}<!-- Hidden::end -->
  
Line 246: Line 247:
 
       | 1= {{Logo | Tip | 15px}} Beispiel: <code>show = navigation long</code>
 
       | 1= {{Logo | Tip | 15px}} Beispiel: <code>show = navigation long</code>
 
       | 2=
 
       | 2=
<source lang="html4strict">
+
<syntaxhighlight lang="html4strict">
 
{{BrowseByAskQueryPreviousNext
 
{{BrowseByAskQueryPreviousNext
 
   | query = [[Kategorie:Bombus]] [[Kategorie:Artbeschreibungen]]
 
   | query = [[Kategorie:Bombus]] [[Kategorie:Artbeschreibungen]]
Line 253: Line 254:
 
   | link up text = Hummel-Schlüssel
 
   | link up text = Hummel-Schlüssel
 
}}
 
}}
</source><!--
+
</syntaxhighlight><!--
 
     -->}}
 
     -->}}
  
Line 261: Line 262:
 
(5) Mit&nbsp;<code>show=books-left-right-floating</code> werden Bücher links und rechts gezeigt. Alle Inhalte, die danach folgen, fließen um die Piktogramme herum (dieses Verhalten kann man mit <code>&lt;div style="clear:both;">&lt;/div></code> aufheben):<br/><!--
 
(5) Mit&nbsp;<code>show=books-left-right-floating</code> werden Bücher links und rechts gezeigt. Alle Inhalte, die danach folgen, fließen um die Piktogramme herum (dieses Verhalten kann man mit <code>&lt;div style="clear:both;">&lt;/div></code> aufheben):<br/><!--
 
   --><div style="float:left;margin-right:1em;margin-bottom:0.5ex;">[[File:Farm-Fresh book previous.png|link=Weymar 1976| Weymar 1976]]</div><!--
 
   --><div style="float:left;margin-right:1em;margin-bottom:0.5ex;">[[File:Farm-Fresh book previous.png|link=Weymar 1976| Weymar 1976]]</div><!--
   --><div style="float:right;margin-left:1em;margin-bottom:0.5ex;">[[File:Farm-Fresh book next.png|link=Weymar 1988b|Weymar 1988b]]</div>
+
   --><div style="float:right;margin-left:1em;margin-bottom:0.5ex;">[[File:Farm-Fresh book next.png|link=Weymar 1988b|Weymar 1988b]]</div><!--
<!--
+
 
  -->}}<!-- Vorlagenfehler Ende -->
+
  switch CONTENTLANGUAGE:en and default
 +
  -->|#default|en=Creates an automatic navigation within a given category or a ask query of a Semantic MediaWiki search. The standard layout with minimum space requirements displays arrows, but with the template parameter <code>show=…</code> different displays can be specified: link text (<code>show=text</code>), a long navigation (<code>show=navigation long</code>) and also images (<code>show=images</code>) instead of the default arrows. If the actual page name is not part of the requested category, a different compare-page name can be set as reference with <code>compare with=other page name</code>.
 +
 
 +
(1) Standard shows two arrows:<br/> [[File:Go-previous.svg|24px|link=Weymar 1976]]{{!}}[[File:Go-next.svg|24px|link=Weymar 1988b]]<!--
 +
    -->{{Hidden
 +
      | style      = border:1px dotted black;padding:0.25em;
 +
      | toggle      = left
 +
      | contentstyle= border-top:1px dotted;padding:0.25em;
 +
      | 1= {{Logo | Tip | 15px}} Examples:  <code><nowiki>{{BrowseByAskQueryPreviousNext | [[Category:Literature]]}}</nowiki></code>
 +
      | 2=
 +
<syntaxhighlight lang="html4strict">
 +
{{BrowseByAskQueryPreviousNext | [[Category:Literature]]}}
 +
<!-- 1 or query == #ask-query-->
 +
{{BrowseByAskQueryPreviousNext | 1 = [[Category:Literature]]}}
 +
{{BrowseByAskQueryPreviousNext | query = [[Category:Literature]]}}
 +
<!-- compare with == if different from (default) pagename  -->
 +
{{BrowseByAskQueryPreviousNext | query = [[Category:Literature]] | compare with = Weymar 1988b}}
 +
</syntaxhighlight><!--
 +
    -->}}<!-- Hidden::end -->
 +
 
 +
 
 +
(2) Using parameter&nbsp;<code>show=text</code> you can get:<br />
 +
«&nbsp;[[Weymar 1976]]&nbsp;{{!}}&nbsp;[[Weymar 1988b]]&nbsp;»
 +
<div style="border:1px dotted black;padding:0.25em;"><code><nowiki>{{BrowseByAskQueryPreviousNext | [[Category:Literature]] | show = text}}</nowiki></code></div>
 +
 
 +
 
 +
(3) using <code>show=navigation long</code> text with arrows i displayed of [[Template: Navigation]]:
 +
{{BrowseByAskQueryPreviousNext
 +
  | query = [[{{ns:category}}:Bombus]] [[{{ns:category}}:Species description]]
 +
  | show = navigation long
 +
  | link up = Determination key for bumblebees
 +
  | link up text = Key bumblebees
 +
  | compare with = Bombus campestris
 +
}}
 +
{{Hidden
 +
      | style      = border:1px dotted black;padding:0.25em;
 +
      | toggle      = left
 +
      | contentstyle= border-top:1px dotted;padding:0.25em;
 +
      | 1= {{Logo | Tip | 15px}} Example: <code>show = navigation long</code>
 +
      | 2=
 +
<syntaxhighlight lang="html4strict">
 +
{{BrowseByAskQueryPreviousNext
 +
  | query = [[Category:Bombus]] [[Category:Species description]]
 +
  | show  = navigation long
 +
  | link up      = Determination key for bumblebees
 +
  | link up text = Key bumblebees
 +
}}
 +
</syntaxhighlight><!--
 +
    -->}}
 +
 
 +
 
 +
(4) With&nbsp;<code>show=images</code> you can display images that are stored in the Wiki (10 = is default). <code>show=50.images</code> displays instead 50 images.
 +
 
 +
(5) With&nbsp;<code>show=books-left-right-floating</code> book-icon-links are displayed. All content that follows on the page floats around the pictograms (this can be changed by apending after BrowseByAskQueryPreviousNext <code>&lt;div style="clear:both;">&lt;/div></code> ):<br/><!--
 +
  --><div style="float:left;margin-right:1em;margin-bottom:0.5ex;">[[File:Farm-Fresh book previous.png|link=Weymar 1976| Weymar 1976]]</div><!--
 +
  --><div style="float:right;margin-left:1em;margin-bottom:0.5ex;">[[File:Farm-Fresh book next.png|link=Weymar 1988b|Weymar 1988b]]</div><!--
 +
  -->}}<!--
 +
  -->}}<!-- TemplateError End -->
 
}}<!-- if::Ende Parameter  --></onlyinclude><!--
 
}}<!-- if::Ende Parameter  --></onlyinclude><!--
  --><noinclude>'''Technische Anmerkung:''' Die Vorlage setzt das [[Attribut: {{#var: propertyPageName}}]], das nötig ist um Vorgänger und Nachfolger innerhalb einer Suchabfrage zu bestimmen.
+
  --><noinclude>{{#switch:{{CONTENTLANGUAGE}}<!--
 +
  switch CONTENTLANGUAGE:de
 +
-->|de|de-formal='''Technische Anmerkung:''' Die Vorlage setzt das [[Attribut: {{#var: propertyPageName}}]], das nötig ist um Vorgänger und Nachfolger innerhalb einer Suchabfrage zu bestimmen.
  
 +
{{todo | Bug in {{Abk.|SMW}} wenn Seiten abweichende Sortierung → Falsche #ask Ergebnisse | Semantic MediaWiki}}
 
[[Kategorie:Vorlagenprogrammierung]]
 
[[Kategorie:Vorlagenprogrammierung]]
 
[[Kategorie:Vorlagen/Templates]]
 
[[Kategorie:Vorlagen/Templates]]
 
[[Kategorie:Navigation]]
 
[[Kategorie:Navigation]]
 
[[Kategorie:Semantisches Wiki]]
 
[[Kategorie:Semantisches Wiki]]
{{SORTIERUNG: BrowseByAskQueryPreviousNext}}
+
|#default|en='''Technical note:''' the template uses [[{{ns:property}}: {{#var: propertyPageName}}]], that is needed to get the previous page and the page after within a query.
{{todo | Bug in {{Abk.|SMW}} wenn Seiten abweichende Sortierung → Falsche #ask Ergebnisse | Semantic MediaWiki}}
+
 
 +
TODO: Bug in SMW if non-default sorting of pages
 +
[[Category:Template programming]]
 +
[[Category:Templates]]
 +
[[Category:Navigation]]
 +
[[Category:Semantic Wiki]]
 +
}}
 +
{{DEFAULTSORT: BrowseByAskQueryPreviousNext}}

Latest revision as of 13:06, 27 November 2015

Technische Anmerkung: Die Vorlage setzt das Attribut: Seitenname, das nötig ist um Vorgänger und Nachfolger innerhalb einer Suchabfrage zu bestimmen.
Qsicon inArbeit-05.svg
To do: Bug in SMW wenn Seiten abweichende Sortierung → Falsche #ask Ergebnisse
See also Kategorie: Task.