Reference Documentation: PDF Publishing with GNU Troff
リビジョン | ba8c36f7081870ed49aaafd95f5ea4c8bf14c346 (tree) |
---|---|
日時 | 2023-04-12 02:10:57 |
作者 | ![]() |
コミッター | Keith Marshall |
Handle hyphenation special characters in PDF outlines.
* tmac/sanitize.tmac (sanitize): Interpret "\%" specially.
(sanitize:esc-(, sanitize:esc-(hy): New macros; they add generic
support for "\(xx", and specialization for "\(hy", respectively.
@@ -58,7 +58,18 @@ | ||
58 | 58 | . \" is found, we prepare to skip an escape sequence. |
59 | 59 | . \" |
60 | 60 | . ec ! |
61 | -. if '!*[sanitize:scan.char]'\\' .nr sanitize:skip.count 1 | |
61 | +. ie '!*[sanitize:scan.char]'\\' .nr sanitize:skip.count 1 | |
62 | +. el .if '!*[sanitize:scan.char]'!%' !{! | |
63 | +. \" The "\%" escape requires special handling; assuming | |
64 | +. \" that it will never be used to introduce a hyphen into | |
65 | +. \" a PDF outline entry, it may simply be discarded, by | |
66 | +. \" the expedient of handling it as if it is equivalent | |
67 | +. \" to an artificial "\F%" escape sequence. | |
68 | +. \" | |
69 | +. ds sanitize:residual F%!*[sanitize:residual] | |
70 | +. nr sanitize:residual.length +2 | |
71 | +. nr sanitize:skip.count 1 | |
72 | +. !} | |
62 | 73 | . ec |
63 | 74 | . ie \\n[sanitize:skip.count] \{\ |
64 | 75 | . \" When a possible escape sequence has been detected, we back it |
@@ -142,6 +153,28 @@ | ||
142 | 153 | . el .nr sanitize:skip.count 0 |
143 | 154 | . \} |
144 | 155 | .. |
156 | +.de sanitize:esc-( | |
157 | +.\" Usage (internal): .sanitize:esc-( | |
158 | +.\" | |
159 | +.\" Handler for interpretation special character escape sequences, | |
160 | +.\" which are expressed in the form "\(xx". | |
161 | +.\" | |
162 | +. ds sanitize:look-ahead \\*[sanitize:residual] | |
163 | +. substring sanitize:look-ahead 0 1 | |
164 | +. if d \\$0\\*[sanitize:look-ahead] .\\$0\\*[sanitize:look-ahead] | |
165 | +. rm sanitize:look-ahead | |
166 | +.. | |
167 | +.de sanitize:esc-(hy | |
168 | +.\" Usage (internal): .sanitize:esc-(hy | |
169 | +.\" | |
170 | +.\" Handler for translation of "\(hy" special character escapes | |
171 | +.\" within sanitized PDF outline entries; each is replaced by an | |
172 | +.\" (approximately) equivalent ASCII "-" character. | |
173 | +.\" | |
174 | +. substring sanitize:residual 2 | |
175 | +. ds sanitize:residual -\\*[sanitize:residual] | |
176 | +. nr sanitize:residual.length -1 | |
177 | +.. | |
145 | 178 | .de sanitize:esc-generic |
146 | 179 | .\" Usage (internal): .sanitize:esc-X |
147 | 180 | .\" |