Sync-to-go: update copyright for 2015
[s-roff.git] / contrib / pdfmark / spdf.tmac
blobbbe2519765b31d8f50d6d0ad4c79274dd3a8bc34
1 .ig
2 @ spdf.tmac
4 Copyright (c) 2014 - 2015 Steffen (Daode) Nurpmeso <sdaoden@users.sf.net>.
6 Copyright (C) 2004
7   Free Software Foundation, Inc.
8      Written by Keith Marshall (keith.d.marshall@ntlworld.com)
10 This is free software; you can redistribute it and/or modify it under
11 the terms of the GNU General Public License as published by the Free
12 Software Foundation; either version 2, or (at your option) any later
13 version.
15 This is distributed in the hope that it will be useful, but WITHOUT ANY
16 WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
18 for more details.
20 You should have received a copy of the GNU General Public License along
21 with groff; see the file COPYING.  If not, write to the Free Software
22 Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA.
24 .\"
25 .if !rOPMODE .nr OPMODE 1
26 .\"
27 .mso s.tmac
28 .mso pdfmark.tmac
29 .\"
30 .\" Omitted Sections
31 .\" ================
32 .\"
33 .\" Define section markers, for special document sections,
34 .\" which are to be omitted from regular document processing.
35 .\"
36 .de OMIT OMIT
37 .de \\$1
38 .omit@begin \\$1 \\$2
40 .de \\$2
41 .omit@end \\$1 \\$2
43 .OMIT CS CE    \" front cover text, processed independently
44 .OMIT MS ME    \" menu definitions, for info documents only
45 .\"
46 .de omit@begin
47 .ds omit@section \\$1
48 .ig \\$2
50 .de omit@end
51 .if !'\\*[omit@section]'\\$1' .@error \\$2 without \\$1
52 .rm omit@section
54 .de XM
55 .\"
56 .pdfhref M -X \\$@
58 .de XR
59 .if \\n(.$ \{\
60 .   if \\n[OPMODE] \{\
61 .      ds spdf!opts -D "\\$1"
62 .      if \\n(.$>1 .as spdf!opts " -A "\\$2"
63 .      if \\n(.$>2 .as spdf!opts " -P "\\$3"
64 .      pdfhref L \\*[spdf!opts]
65 .      rm spdf!opts
66 .      \}
67 .   \}
69 .\"
70 .\" Document Outlines, Section Headings and Table of Contents
71 .\" =========================================================
72 .\"
73 .de XN
74 .\" Use AFTER .NH n, to define the text of the numbered heading,
75 .\" automatically generating a matching formatted TOC entry, and
76 .\" a PDF document outline entry.
77 .\"
78 .\" String registers XNVS1, XNVS2 and XNVS3 establish additional leading,
79 .\" prior to top level headings, preceding each level of indented subheading,
80 .\" and following each nested level of subheading, respectively
81 .\" (strings are used, rather than numeric registers, so that these
82 .\"  additional spacing parameters may be set relative to the current
83 .\"  document line spacing, as set by \n[VS]).
84 .\"
85 .rm xn*ref
86 .while dopt*XN\\$1 \{\
87 .   opt*XN\\$1 \\$*
88 .   shift \\n[xn*argc]
89 .   \}
90 .rr xn*argc
91 .if '\\$1'--' .shift
92 .if dxn*ref .XM -N \\*[xn*ref] -- \\$@
93 .rm xn*ref
94 .pdfhref O \\n[nh*hl] "\\*(SN \\$*"
95 .XS
96 .if rtc*hl \{\
97 .   if !dXNVS1 .ds XNVS1 1.0v  \" default leading for top level
98 .   if !dXNVS2 .ds XNVS2 0.3v  \" default leading at nesting increment
99 .   if !dXNVS3 .ds XNVS3 0.6v  \" default leading following nested group
100 .   if \\n[nh*hl]==1 \{\
101 .      sp \\*[XNVS1]
102 .      nr tc*hl-max 1
103 .      \}
104 .   ie \\n[nh*hl]<\\n[tc*hl] .if \\n[nh*hl]>1 .sp \\*[XNVS3]
105 .   el \{\
106 .      ie \\n[nh*hl]>\\n[tc*hl] .sp \\*[XNVS2]
107 .      el \{\
108 .         if !r tc*hl-max .nr tc*hl-max 1
109 .         ie \\n[tc*hl-max]>\\n[nh*hl] .sp \\*[XNVS3]
110 .         el .nr tc*hl-max \\n[nh*hl]
111 .         \}
112 .      \}
113 .   \}
114 .nr tc*hl \\n[nh*hl]
115 \h'\\n[nh*hl]-1m'\c
116 \&\\*(SN\h'1n'\\$*
117 .\".pdfhref L -D \\*[PDFBOOKMARK.NAME] -- \&\\*(SN\h'1n'\\$*
119 \&\\$*
121 .de opt*XN-N
122 .nr xn*argc 2
123 .ds xn*ref \\$2
125 .de opt*XN-X
126 .nr xn*argc 1
127 .if !dxn*ref .ds xn*ref \\\\$1
129 .de LU
131 The content for this section is not yet available.
133 .de AN
134 .ie \\n(.$ .@AN \\$*
135 .el .@AN Note
137 .de @AN
139 \\$*
142 .nr PDF-TOC-ONLY  1
143 .nr PDF-BODY-TEXT 2
144 .de OP
145 .ie rPHASE \{\
146 .   ie \\n(.$ \{\
147 .      nr op:request 0
148 .      while \\n(.$ \{\
149 .         if \\$1=\\n[PHASE] .nr op:request 1
150 .         shift
151 .         \}
152 .      \}
153 .   el .nr op:request 1
154 .   if !\\n[op:request]=\\n[OPMODE] \{\
155 .      nr OPMODE \\n[op:request]
156 .      nop \O[\\n[OPMODE]]\c
157 .      \}
158 .   \}
159 .el .nr OPMODE 1
161 .nr SAME-PAGE 0
162 .de NN
163 .if !\\n[SAME-PAGE] .bp
164 .nr SAME-PAGE 0
165 .NH \\$1
166 .nn*setname \\$2
167 .shift 2
168 .XN -N \\*[nn*name] -- \\$@
169 .rm nn*name
171 .de nn*setname
172 .ds nn*name \\$1
173 .shift
174 .while \\n(.$ \{\
175 .   as nn*name -\\$1
176 .   shift
177 .   \}
179 .de PXREF
180 .nn*setname \\$2
181 .XR \\*[nn*name] )\\$1 (
182 .rm nn*name
184 .de IS
186 .nr LL \\n(LL-\\n(PI
188 .de IE
190 .nr LL \\n(LL+\\n(PI
192 .\" Override the standard ms macro,
193 .\" to ensure the document outline cache is flushed
194 .\" BEFORE emitting the table of contents.
195 .de TC
196 .pdfsync O
198 .OP \n[PDF-TOC-ONLY]
199 .pg@begin 1 i
200 .if \\n[OPMODE] .pdf@toc
201 .PX \\$1
203 .de pdf@toc
204 .pdfhref O -T T 1 "\\*[TOC]"
205 .pdfsync O
207 .de pdf@exit
208 .if \\n[OPMODE] .pdfsync
209 .pg@end-text
211 .em pdf@exit
212 .OP \n[PDF-BODY-TEXT]
214 .\" groff "ms" provides the "pg@bottom" macro, which has already
215 .\" been installed as a page transition trap.  To ensure proper
216 .\" mapping of "pdfhref" links which overflow the bottom of any
217 .\" page, we need to install the "pdfhref" page transition hook,
218 .\" as an addendum to this macro.
220 .pdfhref I -PT pg@bottom
222 .\" s-tr-mode