Template:Uses from: Difference between revisions

From Rosetta Code
Content added Content deleted
m (Whoops. Started sGML comment block incorrectly.)
(Tweak to have {{{1}}} identify whether it's a library (or implementation, or whatever).)
 
Line 1: Line 1:
<div class="examplemeta libheader"><noinclude>'''Uses:''' (library name) <small> ('''Component[s]:''' Component1, Component2, ComponentN )</small></noinclude><includeonly>'''Uses:''' [[SMW::off]]<!--
<div class="examplemeta libheader"><noinclude>'''Uses:''' (tool name) <small> ('''Component[s]:''' Component1, Component2, ComponentN )</small></noinclude><includeonly>'''Uses:''' [[SMW::off]]<!--


-->[[uses::Library/{{{1}}}|{{{1}}}]]<!--
-->[[uses::{{{1}}}/{{{2}}}|{{{2}}}]]<!--
-->{{#set:Uses library=Library/{{{1}}}}}<!--
-->{{#set:Uses {{{1}}}={{{1}}}/{{{2}}}}}<!--


-->[[Category:{{{1}}}]]<!--
-->[[Category:{{{2}}}]]<!--


There must be a component N=1, for there to be a component N>1. If there's no component N=1, then there's no reason to put any of the component list artifacts in.
There must be a component N=1, for there to be a component N>1. If there's no component N=1, then there's no reason to put any of the component list artifacts in.
Line 25: Line 25:
-->[[SMW::on]]<!--
-->[[SMW::on]]<!--


-->[[Uses library::Library/{{{1}}}/{{{component$n$}}}|{{{component$n$}}}]], <!--
-->[[Uses {{{1}}}::{{{1}}}/{{{2}}}/{{{component$n$}}}|{{{component$n$}}}]], <!--


Ending #foreach
Ending #foreach
Line 43: Line 43:
--><noinclude>
--><noinclude>


This template is intended to handle the case where a library has many components within it (examples of this include CPAN, RubyGems and Tcllib). It has two required parameters: <tt><nowiki>{{</nowiki>uses from|</tt>''library''<tt>|</tt>''component''<tt><nowiki>}}</nowiki></tt>. The ''library'' is the name of the overall library of components (which should also be the name of a category here on RC) and the ''component'' is the name of the component within it (which can be almost any string).
This template is intended to handle the case where a {{{1}}} has many components within it (examples of this include CPAN, RubyGems and Tcllib). It has two required parameters: <tt><nowiki>{{</nowiki>uses from|</tt>''{{{1}}}''<tt>|</tt>''component''<tt><nowiki>}}</nowiki></tt>. The ''{{{1}}}'' is the name of the overall {{{1}}} of components (which should also be the name of a category here on RC) and the ''component'' is the name of the component within it (which can be almost any string).


==Discussion==
==Discussion==
Line 49: Line 49:


===What it does===
===What it does===
* Associates the page with the library:
* Associates the page with the {{{1}}}:
** Semantically, as <tt><nowiki>[[Uses library::{{{1}}}]</nowiki></tt>
** Semantically, as <tt><nowiki>[[Uses {{{1}}}::{{{2}}}]</nowiki></tt>
** As part of <tt>[[:Category:{{{1}}}]]</tt> (though this may eventually change)
** As part of <tt>[[:Category:{{{2}}}]]</tt> (though this may eventually change)
** By linking to <tt>[[Library/{{{1}}}]]</tt>.
** By linking to <tt>[[{{{1}}}/{{{2}}}]]</tt>.
* Associates the page with each component specified
* Associates the page with each component specified
** Semantically, as <tt><nowiki>[[Uses library::{{{1}}}/{{{componentN}}}]]</nowiki></tt> (Placing the component as a subpage of the library
** Semantically, as <tt><nowiki>[[Uses {{{1}}}::{{{2}}}/{{{componentN}}}]]</nowiki></tt> (Placing the component as a subpage of the {{{1}}}
** By linking to <tt><nowiki>[[Library/{{{1}}}/{{{componentN}}}]]</nowiki></tt>.
** By linking to <tt><nowiki>[[{{{1}}}/{{{2}}}/{{{componentN}}}]]</nowiki></tt>.


===What it needs to do (eventually)===
===What it needs to do (eventually)===
* Associate library version information with the page.
* Associate {{{1}}} version information with the page.
* Associate component version information with the page.
* Associate component version information with the page.



Latest revision as of 17:11, 20 November 2010

Uses: (tool name) (Component[s]: Component1, Component2, ComponentN )

This template is intended to handle the case where a {{{1}}} has many components within it (examples of this include CPAN, RubyGems and Tcllib). It has two required parameters: {{uses from|{{{1}}}|component}}. The {{{1}}} is the name of the overall {{{1}}} of components (which should also be the name of a category here on RC) and the component is the name of the component within it (which can be almost any string).

Discussion

This template is derived from {{tcllib}}, and seeks to have a similar aim, except more generically, and as a potential eventual replacement for {{libheader}} and {{works with}}. (And {{tcllib}}, if it achieves sufficient functionality.)

What it does

  • Associates the page with the {{{1}}}:
    • Semantically, as [[Uses {{{1}}}::{{{2}}}]
    • As part of [[:Category:{{{2}}}]] (though this may eventually change)
    • By linking to [[{{{1}}}/{{{2}}}]].
  • Associates the page with each component specified
    • Semantically, as [[Uses {{{1}}}::{{{2}}}/{{{componentN}}}]] (Placing the component as a subpage of the {{{1}}}
    • By linking to [[{{{1}}}/{{{2}}}/{{{componentN}}}]].

What it needs to do (eventually)

  • Associate {{{1}}} version information with the page.
  • Associate component version information with the page.

What it should do

  • Avoid using MediaWiki categories as possible.

The richer the relationships we can define, the more powerful the search options we'll have available.



This is a template. There are many others. See Category:RCTemplates for a complete list of templates.