Help:Templatefile format

From semantic-mediawiki.org
Templatefile format
Outputs results in arbitrary file formats defined via templates.
Further Information
Provided by: Semantic MediaWiki
Added: 3.0.0
Removed: still supported
Requirements: none
Format name: templatefile
Enabled? Indicates whether the result format is enabled by default upon installation of the respective extension. yes
Authors: James Hong Kong
Categories: export · plaintext
Keywords
Table of Contents

The result format templatefile is used to produce links to file outputs in all sorts of formats defined in a template. It was introduced with Semantic MediaWiki 3.0.0Released on 11 October 2018 and compatible with MW 1.27.0 - 1.31.x..1

Parameters[edit]

General
Parameter Type Default Description
source text empty Alternative query source
limit whole number 50 The maximum number of results to return
offset whole number 0 The offset of the first result
link text all Show values as links
sort list of texts empty Property to sort the query by
order list of texts empty Order of the query sort
headers text show Display the headers/property names
mainlabel text no The label to give to the main page name
intro text empty The text to display before the query results, if there are any
outro text empty The text to display after the query results, if there are any
searchlabel text templateFile Text for continuing the search
default text empty The text to display if there are no query results
Export formats like templatefile in general will not produce an intro or outro text since they only produce a link when embedded.2
Format specific
Parameter Aliases Type Default Description
valuesep - text , The separator between results
template - text empty The name of a template with which to display the printouts
named args namedargs yes/no no Name the arguments passed to the template
userparam - text empty A value passed into each template call, if a template is used
introtemplate - text empty The name of a template to display before the query results, if there are any
outrotemplate - text empty The name of a template to display after the query results, if there are any
filename - text file.txt The name for the output file
mimetype - text text/plain The media type (MIME type) for the output file
Detailed documentation and examples
  • Parameter named args – This help page explains the usage of named arguments when using a template for the templatefile format to display the output of the query.
  • Parameter template – This help page explains the usage of a template for the templatefile format to display the output of the query.
Most parameters can be combined to create the desired display of the output to a query. Not all parameters are documented here. See also the documentation on the result format "plainlist"Outputs results in a comma separated list, with additional outputs shown in parentheses. The output does not provide class attributes to HTML elements (default for queries without printout statements).

Example[edit]

Creating a BEACON file with GND identifiers for export

GND is an international authority file for the organisation of personal names, subject headings and corporate bodies from catalogues. It is used mainly for documentation in libraries and increasingly also by archives and museums. The GND is managed by the German National Library (German: Deutsche Nationalbibliothek; DNB) in cooperation with various regional library networks.

BEACON is a data interchange format for large numbers of uniform links. The format was developed to exchange mappings between authority files and resources in cultural institutions.

See how to do it:

In Semantic MediaWiki 2.5.8Released on 7 September 2018 and compatible with MW 1.23.0 - 1.30.x. and earlier this can be achieved as explained on the BEACON help page.

See also[edit]

  • Result format "CSV"Outputs results in Windows-style Comma Separated Value format. – Allowing to create an export in the csv-format


References

  1. ^  Semantic MediaWiki: GitHub pull request gh:smw:3024
  2. ^  Semantic MediaWiki: GitHub issue gh:smw:4467