[NTG-context] Typesetting products and components

Hans Hagen pragma at wxs.nl
Tue Feb 15 19:47:36 CET 2005


Randall Skelton wrote:

> generated for the set of components.  Is it appropriate to want to do
> this or have I misunderstood the role of projects, products and
> components entirely.
as long as you understand the logic behind your choices it;s ok

I'll add a system mode: (put this in cont-new.tex)

\startvariables          dutch                     english
                          german                    czech
                          italian                   romanian

             environment: omgeving                  environment
                          umgebung                  prostredi
                          ambiente                  mediu
               component: onderdeel                 component
                          komponente                komponenta
                          componente                componenta
                 product: produkt                   product
                          produkt                   produkt
                          prodotto                  produs
                 project: project                   project
                          projekt                   projekt
                          progetto                  proiect

\stopvariables

\unprotect

\let\currentcomponent\v!text

\def\donextlevel#1#2#3#4#5#6#7\\%
   {\pushmacro\currentcomponent
    \let\currentcomponent#1
    \setsystemmode\currentcomponent
    \beforesplitstring#7\at.\to#2\relax
    \ifcase\filelevel\relax
      \starttext
      \def\project     ##1 {#3{##1}}%
      \def\environment ##1 {#4{##1}}%
      \def\product     ##1 {#5{##1}}%
      \def\component   ##1 {#6{##1}}%
    \fi
    \increment\filelevel\relax
    \fullexpandoneargafter\addtocommalist{#1}\loadedfiles}

\def\doprevlevel
   {\popmacro\currentcomponent
    \setsystemmode\currentcomponent
    \ifnum\filelevel=\plusone
      \expandafter\stoptext
    \else
      \decrement\filelevel\relax
      \expandafter\endinput
    \fi}

\def\startproject #1 %
   {\donextlevel\v!project\currentproject
      \donotexecutefile\doexecutefileonce
      \doexecutefileonce\doexecutefile#1\\}

\def\startproduct #1 %
   {\doateverystarttext
    \donextlevel\v!product\currentproduct
      \doexecutefileonce\doexecutefileonce
      \donotexecutefile\doexecutefile#1\\}

\def\startcomponent #1 %
   {\doateverystarttext
    \donextlevel\v!component\currentcomponent
      \doexecutefileonce\doexecutefileonce
      \donotexecutefile\doexecutefile#1\\}

\def\startenvironment #1 %
   {\donextlevel\v!environment\currentenvironment
      \donotexecutefile\doexecutefileonce
      \donotexecutefile\donotexecutefile#1\\}

\protect

\starttext

% \startproject test

%     1: \startmode[*project] project \stopmode \endgraf
%     2: \startmode[*product] product \stopmode \endgraf

% \stopproject

\startproduct test

1: \startmode[*project] project \stopmode \endgraf
2: \startmode[*product] product \stopmode \endgraf

\stopproduct

\stoptext



-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------



More information about the ntg-context mailing list