Template:Uses from: Difference between revisions

From Rosetta Code
Content added Content deleted
(Create template. Describe its goals. I'll need a lot of help getting it to behave to those design goals, though...)
 
(Tweak to have {{{1}}} identify whether it's a library (or implementation, or whatever).)
 
(31 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<div class="examplemeta libheader">'''Uses:''' [[SMW::off]][[:Category:{{{1}}}|{{{1}}}]][[Category:{{{1}}}]][[SMW::on]] <small>('''Component:''' {{{1}}})</small><includeonly>{{#set:Uses library={{{1}}}}}{{#set:Uses tcllib package={{{2}}}}}</includeonly></div><noinclude>
<div class="examplemeta libheader"><noinclude>'''Uses:''' (tool name) <small> ('''Component[s]:''' Component1, Component2, ComponentN )</small></noinclude><includeonly>'''Uses:''' [[SMW::off]]<!--


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

-->[[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.
-->{{#if: {{{component1|}}}|<!--

--> <small> (<!--

Is there more than one component?
-->{{#if: {{{component2}}}|<!--
Plural
-->'''Components:''' <!--
-->|<!--
Singular
-->'''Component:''' <!--
End plural/singluar #if.
-->}}<!--

-->{{#foreach: component$n$|<!--

-->[[SMW::on]]<!--

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

Ending #foreach
-->}}<!--

Ending #if componentN
-->}}<!--

Only apply </small> if we have components.
-->{{#if: {{{component1|}}}|<!--
--> )</small> <!--
-->}}<!--

Ending examplemeta div.
--></includeonly></div><!--

--><noinclude>

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==
This template is derived from {{tmpl|tcllib}}, and seeks to have a similar aim, except more generically, and as a potential eventual replacement for {{tmpl|libheader}} and {{tmpl|works with}}. (And {{tmpl|tcllib}}, if it achieves sufficient functionality.)
This template is derived from {{tmpl|tcllib}}, and seeks to have a similar aim, except more generically, and as a potential eventual replacement for {{tmpl|libheader}} and {{tmpl|works with}}. (And {{tmpl|tcllib}}, if it achieves sufficient functionality.)


===What it does===
Design goals in common with {{tmpl|tcllib}}, {{tmpl|libheader}} and {{tmpl|works with}}:
* Associates the page with the {{{1}}}:
* Use {{{1}}} as the library name.
** Semantically, as <tt><nowiki>[[Uses {{{1}}}::{{{2}}}]</nowiki></tt>
** As part of <tt>[[:Category:{{{2}}}]]</tt> (though this may eventually change)
** By linking to <tt>[[{{{1}}}/{{{2}}}]]</tt>.
* Associates the page with each component specified
** Semantically, as <tt><nowiki>[[Uses {{{1}}}::{{{2}}}/{{{componentN}}}]]</nowiki></tt> (Placing the component as a subpage of the {{{1}}}
** By linking to <tt><nowiki>[[{{{1}}}/{{{2}}}/{{{componentN}}}]]</nowiki></tt>.


===What it needs to do (eventually)===
Other ultimate goals that make its behavior variously different from current {{tmpl|tcllib}}, {{tmpl|libheader}} and {{tmpl|works with}}:
* Associate {{{1}}} version information with the page.
* Avoid using MW categories. Use semantic properties instead. (MW categories have particular behavior when used in semantic queries.)
* Associate component version information with the page.
* Apply the semantic property '''uses::{{{1}}}'''
* Accept an undefined number of additional ''named'' arguments as components of that library. (var name might be '''component''') Add a semantic property to the page indicating that it uses {{{1}}}. i.e. semantic syntax '''uses {{{1}}} component::{{{component}}}'''
* Accept library version as a single named argument. (var name might be '''version''') Tag the transcluding page as using that version of library {{{1}}}. i.e. semantic syntax '''uses {{{1}}} version:{{{version}}}'''.
** If {{{component}}} is supplied, also apply '''uses {{{1}}} version {{{version}}} component::{{{component}}}' and '''uses {{{1}}} component {{{component}}} version::{{{version}}}'''.


===What it should do===
The richer the relationships we can define, the more powerful the search options we'll have available.
* Avoid using MediaWiki categories as possible.


The richer the relationships we can define, the more powerful the search options we'll have available.
(Unless someone can figure out a better way to apply pagename/libname/component/version with the semantic properties.)


{{template}}[[Category:Example description templates]]</noinclude>
{{template}}[[Category:Example description templates]]</noinclude>

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.