Template:Uses from: Difference between revisions

From Rosetta Code
Content added Content deleted
(Removed usage of version.)
(Yanked version code for the time being. Rewrote description.)
Line 1: Line 1:
<div class="examplemeta libheader">'''Uses:''' [[SMW::off]]<!--
<div class="examplemeta libheader">'''Uses:''' [[SMW::off]]<!--


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

Removed usage of 'version'
{{#if: {{{version|}}}|

[[SMW::on]]{{#set:Uses {{{1}}} version={{{version}}}}}[[SMW::off]]

Ending #if
}}


-->[[Category:{{{1}}}]]<!--
-->[[Category:{{{1}}}]]<!--
Line 37: Line 29:


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

(Removed use of 'version' for now.)
{{#if: {{{version|}}}

{#set:Uses Library/{{{1}}} version={{{version}}} component={{{component$n$}}}}}
{{#set:Uses {{{1}}} component={{{component$n$}}} version={{{version}}}}}

|}}


Ending #foreach
Ending #foreach
Line 62: Line 46:
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}}:
* Use {{{1}}} as the library name.
* Associates the page with the library:
** Semantically, as <tt><nowiki>[[Uses library::{{{1}}}]</nowiki></tt>
** As part of <tt>[[:Category:{{{1}}}]]</tt> (though this may eventually change)
** By linking to <tt>[[Library/{{{1}}}]]</tt>.
* 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
** By linking to <tt><nowiki>[[Library/{{{1}}}/{{{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 library 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 <tt>'''uses::{{{1}}}'''</tt>
* Accept an undefined number of additional ''named'' arguments as components of that library. (var name might be '''componentN''') Add a semantic property to the page indicating that it uses {{{1}}}.
** <tt>uses '''{{{1}}}''' component::'''{{{component1}}}''', '''{{{component2}}}''', etc...</tt>
* Accept library version as a single named argument. (var name might be '''version''') Tag the transcluding page as using that version of library {{{1}}}.
** <tt>uses '''{{{1}}}''' version:'''{{{version}}}'''</tt>.
* For each {{{componentN}}} supplied, if any, apply
** <tt>uses '''{{{1}}}''' version '''{{{version}}}''' component::'''{{{componentN}}}'''</tt>.
** <tt>uses '''{{{1}}}''' component '''{{{componentN}}}''' version::'''{{{version}}}'''</tt>.

We can probably define a componentNver parameter, and use per-component properties of:
* <tt>uses '''{{{1}}}''' version '''{{{version}}}''' component::'''{{{componentN}}}'''</tt>.
* <tt>uses '''{{{1}}}''' component '''{{{componentN}}}''' version::'''{{{componenNver}}}'''</tt>.
* <tt>uses '''{{{1}}}''' version '''{{{version}}}''' component '''{{{componentN}}}''' version::'''{{{componenNver}}}'''</tt>.


===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.
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>

Revision as of 02:47, 20 November 2010

Uses: {{{1}}}Property "Uses library" (as page type) with input value "Library/{{{1}}}" contains invalid characters or is incomplete and therefore can cause unexpected results during a query or annotation process.[[Category:{{{1}}}]]{{#if: | (Components:)

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: {{uses from|library|component}}. 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).

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 library:
    • Semantically, as [[Uses library::{{{1}}}]
    • As part of [[:Category:{{{1}}}]] (though this may eventually change)
    • By linking to [[Library/{{{1}}}]].
  • Associates the page with each component specified
    • Semantically, as [[Uses library::{{{1}}}/{{{componentN}}}]] (Placing the component as a subpage of the library
    • By linking to [[Library/{{{1}}}/{{{componentN}}}]].

What it needs to do (eventually)

  • Associate library 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.