Add route table guide and formatting tweaks
[ric-plt/lib/rmr.git] / doc / src / library / setup.im
1 .if false
2 ==================================================================================
3         Copyright (c) 2019-2020 Nokia
4         Copyright (c) 2018-2020 AT&T Intellectual Property.
5
6    Licensed under the Apache License, Version 2.0 (the "License");
7    you may not use this file except in compliance with the License.
8    You may obtain a copy of the License at
9
10        http://www.apache.org/licenses/LICENSE-2.0
11
12    Unless required by applicable law or agreed to in writing, software
13    distributed under the License is distributed on an "AS IS" BASIS,
14    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15    See the License for the specific language governing permissions and
16    limitations under the License.
17 ==================================================================================
18 .fi
19
20 .if false
21         Mnemonic:       setup.im
22         Abstract:       Look at environment variables and pull in the correct setup prep
23                                 imbed file based on the desired output type (when running tfm).
24
25                                 This also sets up the front junk (table of contents, copyright page
26                                 and page numbering) when generating postscript. For non-postscript
27                                 output a licence/caution are added if the output type supports
28                                 comments.  Document title is also added.
29
30                                 These variables are expected to be defined:
31                                         pass (current parsing pass over the source)
32
33                                 See front_junk.im for the list of variables it expects.
34
35         Date:           29 July 2019
36 .fi
37
38
39 .if ! _setup_im
40
41 .gv e LIB lib
42 .if ! lib
43         .dv lib ..
44 .fi
45
46 .if ! ot
47         .gv e OUTPUT_TYPE ot
48 .fi
49
50 .** sane default for everything except rst and markdown which override later
51 .dv col_width 6.5i
52 .dv col_indent .75i
53 .dv indent_size .5i
54 .dv line_size 6i
55 .hn off
56 .dv col_width 7i
57
58
59 .** for everything except rst backslants don't need to be escaped
60 .dv backslant \
61
62 .dv ditext Helvetica-bold
63 .if pfm
64         .im &{lib}/generic_ps.im
65         .dv lic1 n
66         .dv lic2 m
67 .ei
68         .dv lic1 *
69         .dv lic2 +
70
71         .gv e OUTPUT_TYPE ot
72
73         .** CAUTION:  xfm comparisons are reverse polish so  "a b ="  is true if a == b.
74         .if "&ot" "txt" =
75                 .im &{lib}/txt.im
76         .fi
77         .if "&ot" "rst" =
78                 .dv backslant \\
79                 .if &reverse_titles 1 =
80                         .** for some RST output reversing disambiguates the generated document list
81                         .dv _hold &doc_title
82                         .dv doc_title &doc_subtitle
83                         .dv doc_subtitle &_hold
84                 .fi
85
86                 .dv col_indent 0i
87                 .dv indent_size 0i
88                 .im &{lib}/rst.im
89         .fi
90         .if "&ot" "markdown" =
91                 .dv col_indent 0i
92                 .dv indent_size 0i
93                 .im &{lib}/markdown.im
94         .fi
95         .if "&ot" "troff" =
96                 .im &{lib}/roff.im
97         .fi
98         .if "&ot" "html" =
99                 .im &{lib}/html.im
100         .fi
101 .fi
102
103 .** do not force header level 1s to all upper case
104 .dh 1 u=off
105
106 .cd 1 &col_width i=&col_indent
107 .in &indent_size
108 .ll &line_size
109
110 .** set up for an index when using pfm and snare file is defined
111 .if pfm
112         .if index_snare_file
113                 .ix space .sp 1 .cc 5 %c .ln  ^: .sp 0
114                 .ix term .br %s  `^`   ^`` %d
115                 .ix groupb .sp .5 %s .br .ll -.25i .in +.25i
116                 .ix groupe .sp .1 .in -.25i .ll +.25i
117                 .if ! index_cols
118                         .dv index_cols 2
119                 .fi
120
121                 .dv index_col_width [ 6.5 &index_cols / .25 &index_cols 1 - * - ]
122                 .dv index_here  .pa .ju off .st &textsize .cd 1 i=1i w=7 ^: .h1 INDEX ^: .pn off .lw 0 .sp 0 .tt ^: .cd &index_cols i=1i w=&{index_col_width}i  g=.25i ^: .in -i .ll &{index_col_width}i .ix insert
123                 .im &index_snare_file
124         .fi
125 .fi
126
127 .if &pass 2 =
128         .** two pass mode -- pull in variables captured during pass 1 for forward references
129         .im p1var_setup.ca
130 .ei
131         .** clear the capture file if it was there (end must be in col 0)
132         .ca start p1var_setup.ca
133 .ca end
134 .fi
135
136 .gv e GEN_TITLE gen_title
137 .if "&gen_title" "1" =
138         .im ../rtd/gen_title.im
139 .fi
140
141
142 .** func allows us to force an index entry for the function without having to
143 .** define function names in the capture file. func is a bit odd; if punct
144 .** needs to be added, it must be supplied as the second .** parm because
145 .** we add () to the first. E.g. &func(foo_bar:.) will add a full stop.
146 .**
147 .if pfm
148         .dv func .ix force ${1} ^:  ^&cw(${1}()$2 )
149 .ei
150         .dv func ^&cw(${1}()$2)
151 .fi
152
153 .** license/copyright, table of contents, title page, start index capture
154 .im front_junk.im
155
156 .if pfm
157         .** page numbering
158         .pn on noline center f=%d 0
159 .fi
160
161 .** work around bug until change made (RouxWare issue #4)
162 .if tfm
163         .in 7p
164 .fi
165
166 .dv _setup_im