Background
Looking to understand the definitive relationship between projects, products, environments, and components.
Minimum Working Example
Here's the directory structure showing the problem:
project
├── project/novel
│ ├── project/novel/component.tex
│ ├── project/novel/contents.tex
│ ├── project/novel/prd_para.tex
│ └── project/novel/product.tex
├── project/prj_para.tex
└── project/project.tex
./project/project.tex
\startproject project
\environment prj_para
\product product
\stopproject
./project/prj_para.tex
\startenvironment prj_para
\define\bookname{Project Name}
\stopenvironment
./project/novel/prd_para.tex
% Does not override \bookname from prj_para.tex?
\startenvironment prd_para
\define\bookname{Product Name}
\stopenvironment
./project/novel/component.tex
\startcomponent component
\project project
\bookname
\input contents
\stopcomponent
./project/novel/contents.tex
Pride and Prejudice
Jane Austen
\section[title={chapter-1},reference={chapter-1}]
It is a truth universally acknowledged, that a single man in possession of a good fortune, must be in want of a wife.
./project/novel/product.tex
\startproduct
\project project
\environment prd_para
\component component
\stopproduct
Building
The project is built from within the project
directory:
context novel/product --path=novel
Setup
The following setup is what I'd like to achieve:
Every product "inherits" its environment settings from a global project. Each product can override specific settings. For example, the project could define Arial as the base font for all products, but one product could redefine it as Helvetica.
Problem
Ideally, the setups in the project-level prj_para.tex
(i.e., "project-wide" as per the project structure diagram) could be changed in the product-level prd_para.tex
.
However, the value for \bookname
is always Project Name
, rather than Product Name
. Here is how the output appears:
Question
Using environments, projects, products, and components, how can setups in the project-wide environments be changed by the product-specific environments?
In short, how can "Product Name" be output instead?
References
Various documentation sources seem to contradict each other, for example startcomponent shows:
\startcomponent *
\project projectname
While Project structure shows:
\startcomponent c_editorial
\product prd_year2004-01 % but you can use it in other products anyway
Neither Magazine #1101, July 2011 nor Magazine #1101, September 2016 explicitly state how \startcomponent
/\stopcomponent
is codified in relation to either projects or products.
The mailing list has numerous questions with specific answers, but nothing broad in scope. A Python Script generates files and directories, but without understanding how those files and directories relate, it offers little insight.
The wiki states:
- a project links one or more products to their environment
- a product contains several components
- an environment defines the common layout (etc.) of a project
In addition, there are numerous answers on TeX.SE, but few show a tree with all files and directories:
\startproduct
which results in the wrong output. I suggest to also use the\input
in you component file and move either the content in this file or make the content itself in a component (components can be nested).