Help:Smwbp foundation templates

From Tetherless World Wiki

Jump to: navigation, search

Overview

Help:Smwbp foundation templates is a package of wiki templates that wrap SMW syntax to support common practices in SWM annotation

  • it automatically hides rows with empty value in Infobox templates
  • it support multi-value statement, e.g. author=Li Ding, Jie Bao.

{{#set:member=help:f.print.section}}{{#set:member=help:f.tag}}{{#set:member=help:f.print.vbar}}{{#set:member=help:f.print.formfoot}}{{#set:member=help:f.smwbp}}{{#set:member=help:f.show}}{{#set:member=help:f.print.box}} The help pages of this distribution are listed below:

Author Version Description
F.print.formfoot Li Ding 0.2 print foot note for a form
F.print.section Li Ding 0.2 Print the begin,end, row of a section in table format
F.print.vbar Li Ding 0.2 Print a vertical bar character. Typically used in the argument section of a template call.
F.show Li Ding 0.2 print a selected list of properties about a thing
F.smwbp Li Ding 0.2 Print navigation bar for wiki template pages
F.tag Li Ding 0.21 Add semantic tag (triple/triples) to a wiki page with display option
Smwbp foundation templates


Installation

prerequisite -- the following wiki extensions should be installed

install -- use either way

Tutorial

1. user can add SMW annotations as a bullet list using help:f.tag.

source code:

{{f.tag|test-property1|Test Page 1}}
{{f.tag|test-property2|Test Page 2}}

results:

  • test-property1: {{#set:test-property1=Test Page 1}}Test Page 1
  • test-property2: {{#set:test-property2=Test Page 1}}Test Page 1

2. user can smartly parse multi-value SMW annotations using help:f.tag. source code:

{{f.tag|test-property3|Test Person 1, Test Person 2}}
{{f.tag|test-property4|Test Person 1; Test Person 2}}
{{f.tag|test-property5|Test, Person 1; Test, Person 2}}

results:


3. user can quickly build an Infobox Template using help:f.tag, help:f.print.section

source code:

<!--
variable declaration: variables can be replaced by template parameters
-->{{#vardefine:value1|Test Page A}}<!--
-->{{#vardefine:value2|Test Person B,Test Person C}}<!--
-->{{#vardefine:value3|Test Image D}}<!--
-->{{#vardefine:value4|{{{1|}}}}}<!--

infobox -begin
-->{{f.print.section |mode=begin |width=20em |float=right}}<!--

infobox -section
-->{{f.print.section |text=Infobox - Software |background=#99F |format=tr}}<!--

infobox -section
-->{{f.print.section |text=Section 1 |format=tr}}<!--
-->{{f.tag|test title|{{PAGENAME}} |format=tr}}<!--

infobox -section
-->{{f.print.section |text=Section 2 |format=tr}}<!--
-->{{f.tag|test property6|{{#var:value1}}|format=tr}}<!--
-->{{f.tag|test property7|{{#var:value2}}|mode=list|format=tr}}<!--
-->{{f.tag|test property8|{{#var:value3}}|ns=Image|mode=list|format=tr}}<!--

 // this row does not show because {{{1|}}} is not assigned
-->{{f.tag|test property9|{{#var:value4}}|format=tr}}<!-- 

infobox -end
-->
{{f.print.section |mode=end }}<!--
-->

results:

Infobox - Software
Section 1
test title {{#set:test title=Smwbp foundation templates}}Smwbp foundation templates
Section 2
test property6 {{#set:test property6=Test Page A}}Test Page A
test property7 {{#set:test property7=Test Person B}}Test Person B; {{#set:test property7=Test Person C}}Test Person C
test property8 {{#set:test property8=Image:Test Image D}}Image:Test Image D

Personal tools