Home | Index

r3 User Guide

Chapter 4. Using the r3 Command Line Interface

Table of Contents

Creating Dimension Elements
Products and Intls
Targets
Generating Files
Working With Templates
Creating and Editing Templates
Specializing Templates
Specializing Completely
Specializing for Product, with Generic Intl
Specializing for Intl, Retaining Generic Product
Promoting Templates
Working With Translations
Exporting and Importing Translations

This chapter continues with the example introduced in the previous chapter and discusses the command line interface for r3. For a complete description of all r3 commands, refer to the r3 Reference Guide.

[Note] Note

The following chapter discusses r3's graphical user interface and builds on the example developed here.

Creating Dimension Elements

r3 searches dimensions for domain objects.

Products and Intls

  1. Create the products and intls. Product, intl, and pages are examples of r3 dimensions. Products and intls are created in much the same way. From the command line:

    $ r3 dimension product create generic_product
    product generic_product created

    The above command creates a product called generic_product. While not required, generic dimension elements provide a common location for templates, target specifications, and translations. However, if you do not create generic dimension elements, inheritance defaults to whichever domain being searched is located at the top of the structure..

  2. After creating generic_product, create the real products as descendants:

    $ r3 dimension product create cookery -p generic_product
    product cookery created with parent generic_product for page, template and translation domains.

    The -p flag stands for parent.

    Created the rest of the products and intls in the same way:

    $ r3 dimension product create wine -p cookery
    product wine created with parent cookery for page, template and translation domains.
    $ r3 dimension product create cars -p generic_product
    product cars created with parent generic_product for page, template and translation domains.
    $ r3 dimension intl create generic_intl
    intl generic_intl created
    $ r3 dimension intl create us -p generic_intl
    ...
    $ r3 dimension intl create ca -p us
    $ r3 dimension intl create fr -p generic_intl
    $ r3 dimension intl create jp -p generic_intl

    This is the hierarchy for product:

    This is the hierarchy for intl:

  3. Change French-speaking Canada to inherit its translations from fr.

    r3 recognizes three domains in which inheritance operates. These domains correspond to the things that r3 searches for:

    • the template domain which is searched for templates

    • the translation domain which is searched for translations

    • the page domain which is searched for target page specifications

    r3 maintains separate inheritance trees for each dimension in each domain (except for the page dimension which, again, has only one set of inheritance data). When you create a product or intl and specify its parent, the same parent relationship is set up for all domains. This is normally what you want. However, in the special case of ca inheriting its translations from fr, you must change the inheritance relationship between ca and fr only for the translation domain. To do this:

    $ r3 dimension intl parent ca set fr -d translation
    parent of intl ca changed to fr in the translation domain
  4. Change the parent of fr in the translation domain so that it doesn't inherit from generic_intl .

    $ r3 dimension intl parent fr unset -f -d translation
    intl fr set with no parent in the translation domain
    $ r3 dimension intl parent us unset -d translation
    intl us set with no parent in the translation domain
    $ r3 dimension intl parent jp unset -d translation
    intl jp set with no parent in the translation domain

    The -f flag is the "force" flag to change the parent of fr, because ca is a child of fr, and by default r3 refuses to move nodes with children.

    The intls in the template and page domains retain the previous hierarchy, but for the translation domain has following hierarchy:

    [Note] Note

    Note that generic_intl still exists in the translation domain. The existence of intls, products and pages is independent of domains, it is only the inheritance relationships between them that may differ between domains.

  5. To view the inheritance structure for a given dimension within a given domain:

    $ r3 dimension intl list -t translation
    jp
    us
    fr
        ca
    generic_intl

    The -t flag says produce a "tree" view, and therefore needs an argument domain to get the inheritance data.

Targets

After you set up inheritance, you can create targets. Use what looks like a Unix path to create a target, However, use the names of the product and intl for the target you want to create rather than directory names:

$ r3 target create generic_product/generic_intl/index.html
page created (1)

The above example created a target index.html for the generic_product and the generic_intl. This allows r3 to inherit its target specifications as well as its templates and translations. A target at this location is also a target for all intls and products that inherit from it.

r3 creates an empty template for each created target, so there should now be a $R3HOME/templates/generic_product/generic_intl/index.html.ros template that we can edit.

You can display information about the target you created using the command r3 target info. The information includes its location, template name, and searchpaths.

$ r3 target info generic_product/generic_intl/index.html

specified location -> generic_product/generic_intl/index.html
        Target name :  index.html
           Location :  generic_product/generic_intl/index.html
      Data found at :  generic_product/generic_intl/index.html
      Template name :  index.html.ros
   Path to template :  /generic_product/generic_intl/generic/index.html.ros
    Search path for : page, template, translation
                     - generic_product/generic_intl/index.html
                     - generic_product/generic_intl/generic