PageRenderTime 11ms CodeModel.GetById 1ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/contrib/groff/contrib/pdfmark/spdf.tmac

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