Template:Uses from: Difference between revisions

From Rosetta Code
Content added Content deleted
(→‎Discussion: Further thoughts.)
(Unfinished.)
Line 11: Line 11:
-->}}<!--
-->}}<!--


-->[[Category:{{{1}}}]][[SMW::on]]<!--
-->[[Category:{{{1}}}]]<!--


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.
--> <small>('''Component[s]:''' {{{2}}})<!--
-->{{#if: {{{component1}}}|<!--

--> <small>(<!--

Is there more than one component?
(Unfinished...have to head to work.)
{{#if: {{{component2}}}|

-->'''Component[s]:''' <!--


--><includeonly><!--
--><includeonly><!--


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

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


-->{{Uses {{{1}}} package::component$n$|component$n$}}<!--
-->{{Uses {{{1}}} package::component$n$|component$n$}}<!--
Line 26: Line 37:
-->{{#set:Uses {{{1}}} component=component$n$ version={{{version}}}]]<!--
-->{{#set:Uses {{{1}}} component=component$n$ version={{{version}}}]]<!--


Ending #if
Ending #if {{{version}}}
-->}}<!--
-->}}<!--


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

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



Revision as of 12:49, 17 November 2010

Uses: {{{1}}}Property "Uses library" (as page type) with input value "{{{1}}}" contains invalid characters or is incomplete and therefore can cause unexpected results during a query or annotation process.{{#if: {{{version}}}|"Uses {{{1}}} version" contains a listed "{" character as part of the property label and has therefore been classified as invalid.[[Category:{{{1}}}]]{{#if: {{{component1}}}| (Component[s]:

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

Design goals in common with {{tcllib}}, {{libheader}} and {{works with}}:

  • Use {{{1}}} as the library name.

Other ultimate goals that make its behavior variously different from current {{tcllib}}, {{libheader}} and {{works with}}:

  • Avoid using MW categories. Use semantic properties instead. (MW categories have particular behavior when used in semantic queries.)
  • Apply the semantic property uses::{{{1}}}
  • 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}}}.
    • uses {{{1}}} component::{{{component1}}}, {{{component2}}}, etc...
  • Accept library version as a single named argument. (var name might be version) Tag the transcluding page as using that version of library {{{1}}}.
    • uses {{{1}}} version:{{{version}}}.
  • For each {{{componentN}}} supplied, if any, apply
    • uses {{{1}}} version {{{version}}} component::{{{componentN}}}.
    • uses {{{1}}} component {{{componentN}}} version::{{{version}}}.

We can probably define a componentNver parameter, and use per-component properties of:

  • uses {{{1}}} version {{{version}}} component::{{{componentN}}}.
  • uses {{{1}}} component {{{componentN}}} version::{{{componenNver}}}.
  • uses {{{1}}} version {{{version}}} component {{{componentN}}} version::{{{componenNver}}}.


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



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