Template:Man/doc

From blackwiki
< Template:Man
Revision as of 15:43, 18 April 2007 by 199.172.169.17 (talk) (Other sources)
Jump to navigation Jump to search

Template:Template doc page viewed directly To be used for inserting manual page links into articles on Unix topics.

Usage

Examples

In Out
{{man|3|printf}} printf – System Interfaces Reference, The Single UNIX Specification, Issue 7 from The Open Group
{{man|3|printf|||inline}} printf
{{man|3|printf|FreeBSD}} printf(3) – FreeBSD Library Functions Manual
{{man|3|printf||formatted output conversion}} printf: formatted output conversion – System Interfaces Reference, The Single UNIX Specification, Issue 7 from The Open Group

Parameters

  1. Manual section
  2. Manual page name
  3. Source (the name of a subpage in the Template:Man namespace e.g. FreeBSD. Leave blank for the current default.)
  4. Page description
  5. Style parameter; currently inline omits the attribution.

Available sources

Please add to this table as you write new sources!

Source Example Result
die.net[1] {{man|1|man|die.net}} man(1) – Linux User Commands Manual
default[2] {{man|1|man}} man – Commands & Utilities Reference, The Single UNIX Specification, Issue 7 from The Open Group
FreeBSD {{man|1|man|FreeBSD}} man(1) – FreeBSD General Commands Manual
Linux {{man|1|man|Linux}} man(1) – Linux User's Manual – User Commands
OpenBSD {{man|1|man|OpenBSD}} man(1) – OpenBSD General Commands Manual
  1. Current default
  2. Redirects to the current default

Other sources

Occasionally you will come across manual pages for which writing a source is overkill. In this case you can use Template:man/format directly with a URL for formatting:

In Out
{{man/format|1|dbx|http://...|source-level debugging tool|[[Sun Studio]] Developer's Manual}} dbx(1): source-level debugging tool – Sun Studio Developer's Manual

The interface of Template:man/format is therefore externally visible and needs to be kept constant.

Hacking

Writing sources

A source takes three parameters:

  1. Manual section
  2. Manual page name
  3. Output selector: attrib for attribution, url for URL to page.

See Template:Man/die.net for an example; see Template:Man/FreeBSD for a demonstration of varying the attribution by manual section.

Internals

Template:man handles choosing the default source and calling it for URL and attribution; the default source is Template:man/default, which is a template redirect currently to Template:man/die.net. Template:man/format actually formats the link and descriptions into a nice-looking link+auxilia in Unix style.