Reference Documentation: PDF Publishing with GNU Troff
Revision | bc5886a88fba8a391e5fea131d04356c62b7a982 (tree) |
---|---|
Time | 2024-05-15 17:58:52 |
Author | Keith Marshall <keith@user...> |
Commiter | Keith Marshall |
Validate link destination name assignments.
* tmac/pdfmark.tmac (pdfhref): In internal-use macros...
(pdf*href-D, pdf*href.set): ...accept only destination name arguments
which are valid as groff identifiers.
@@ -1288,35 +1288,44 @@ | ||
1288 | 1288 | .\" ---------------------------------------------------------------------- |
1289 | 1289 | .pdf*href.map.init |
1290 | 1290 | .ie \\n(.$ \{\ |
1291 | -. \" | |
1292 | -. \" a marker name has been supplied ... | |
1293 | -. \" if we are formatting for immediate output, | |
1294 | -. \" emit PDFMARK code to establish the associated view | |
1291 | +. \" a destination name has been supplied ... | |
1295 | 1292 | . \" |
1296 | -. ie '\\n(.z'' \{\ | |
1297 | -. pdf:href.sety | |
1298 | -. pdfmark /Dest /\\$1 /View [\\*[PDFHREF.VIEW]] /DEST | |
1299 | -. ds PDFHREF.NAME \\$1 | |
1300 | -. rr PDFPAGE.Y | |
1293 | +. ie \A'\\$1' \{\ | |
1294 | +. \" ...and it is a valid identifier ... | |
1295 | +. \" if we are formatting for immediate output, | |
1296 | +. \" emit PDFMARK code to establish the associated view | |
1297 | +. \" | |
1298 | +. ie '\\n(.z'' \{\ | |
1299 | +. pdf:href.sety | |
1300 | +. pdfmark /Dest /\\$1 /View [\\*[PDFHREF.VIEW]] /DEST | |
1301 | +. ds PDFHREF.NAME \\$1 | |
1302 | +. rr PDFPAGE.Y | |
1303 | +. \} | |
1304 | +. \" but, when formatting a diversion ... | |
1305 | +. \" delay output of the PDFMARK code, until the diversion | |
1306 | +. \" is eventually written out | |
1307 | +. \" | |
1308 | +. el \!.\\$0 \\$@ | |
1309 | +. \" | |
1310 | +. \" check if we also need to emit cross reference data | |
1311 | +. \" (caller will do this if "pdf:href-X" is set, but it is | |
1312 | +. \" not necessary, when "pdf:href.map" already exists) | |
1313 | +. \" | |
1314 | +. if dpdf:href.map .nr pdf:href-X 0 | |
1301 | 1315 | . \} |
1302 | -. \" | |
1303 | -. \" but, when formatting a diversion ... | |
1304 | -. \" delay output of the PDFMARK code, until the diversion | |
1305 | -. \" is eventually written out | |
1306 | -. \" | |
1307 | -. el \!.\\$0 \\$@ | |
1308 | -. \" | |
1309 | -. \" check if we also need to emit cross reference data | |
1310 | -. \" (caller will do this if "pdf:href-X" is set, but it is | |
1311 | -. \" not necessary, when "pdf:href.map" already exists) | |
1312 | -. \" | |
1313 | -. if dpdf:href.map .nr pdf:href-X 0 | |
1316 | +. el \{\ | |
1317 | +. \" given destination name is invalid ... | |
1318 | +. \" diagnose; do not emit reference data | |
1319 | +. \" | |
1320 | +. pdf:error destination name "\\$1" is invalid | |
1321 | +. nr pdf:href-X 0 | |
1322 | +. \} | |
1314 | 1323 | . \} |
1315 | 1324 | .el \{\ |
1316 | -. \" marker is unnamed ... | |
1325 | +. \" no destination name was supplied ... | |
1317 | 1326 | . \" issue error message; do not emit reference data |
1318 | 1327 | . \" |
1319 | -. pdf:warn pdfhref destination marker must be named | |
1328 | +. pdf:error pdfhref destination mark must be named | |
1320 | 1329 | . nr pdf:href-X 0 |
1321 | 1330 | . \} |
1322 | 1331 | .. |
@@ -1363,7 +1372,8 @@ | ||
1363 | 1372 | . pdf:warn pdfhref defined reference requires a name |
1364 | 1373 | . \} |
1365 | 1374 | .el \{\ |
1366 | -. ds pdf:href(\\*[pdf:href-N]).info \\$* | |
1375 | +. ie \A'\\*[pdf:href-N]' .ds pdf:href(\\*[pdf:href-N]).info \\$* | |
1376 | +. el .pdf:error destination name "\\*[pdf:href-N]" is invalid | |
1367 | 1377 | . \} |
1368 | 1378 | .. |
1369 | 1379 | .\" |