Home | Index

r3 User Guide

Promoting Templates

The reverse operation of specialization is called promotion. In r3, you promote templates using the r3 promote template command. Using the sample structure we've created so for, suppose you decided to specialize the navigation template from the French Canadian wine product, but then realized you could use it for all Canadian products. That is, suppose you first did this:

$ r3 template specialize wine/ca/index.html navigation.ros 0
Template specialised from generic_product/generic_intl/index.html to wine/ca/index.html
  0         wine/ca/index.html               navigation.ros
  1         wine/ca/generic
  2         wine/us/index.html
  3         wine/us/generic
  4         wine/generic_intl/index.html
  5         wine/generic_intl/generic
  6         cookery/ca/index.html
  7         cookery/ca/generic
  8         cookery/us/index.html
  9         cookery/us/generic
  10        cookery/generic_intl/index.html
  11        cookery/generic_intl/generic
  12        generic_product/ca/index.html
  13        generic_product/ca/generic
  14        generic_product/us/index.html
  15        generic_product/us/generic
  16        generic_product/generic_intl/index.html    navigation.ros
  17        generic_product/generic_intl/generic

To push it back up the inheritance chain, then you might do this:

$ r3 template promote wine/ca/index.html navigation.ros 13
Template promoted from wine/ca/index.html to generic_product/ca/generic
  0         wine/ca/index.html
  1         wine/ca/generic
  2         wine/us/index.html
  3         wine/us/generic
  4         wine/generic_intl/index.html
  5         wine/generic_intl/generic
  6         cookery/ca/index.html
  7         cookery/ca/generic
  8         cookery/us/index.html
  9         cookery/us/generic
  10        cookery/generic_intl/index.html
  11        cookery/generic_intl/generic
  12        generic_product/ca/index.html
  13        generic_product/ca/generic       navigation.ros
  14        generic_product/us/index.html
  15        generic_product/us/generic
  16        generic_product/generic_intl/index.html    navigation.ros
  17        generic_product/generic_intl/generic

Unlike the template specialize command, the template promote command is a move operation.