diff options
author | keithmarshall <keithmarshall> | 2007-04-11 22:45:11 +0000 |
---|---|---|
committer | keithmarshall <keithmarshall> | 2007-04-11 22:45:11 +0000 |
commit | 1200536c9976d0c7bbd08ed6ace9b9d16241f7be (patch) | |
tree | 68e03aede3026b5ef5ecc825d02b15aecd9d60c2 /contrib | |
parent | 588d8cd632e19eb367ed5b9f9e1cfdfa0c6b4891 (diff) | |
download | groff-1200536c9976d0c7bbd08ed6ace9b9d16241f7be.tar.gz |
Avoid stray newlines in folded pdfmark literal content.
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/pdfmark/ChangeLog | 11 | ||||
-rw-r--r-- | contrib/pdfmark/pdfmark.tmac | 26 |
2 files changed, 31 insertions, 6 deletions
diff --git a/contrib/pdfmark/ChangeLog b/contrib/pdfmark/ChangeLog index b670b28e..b1da457d 100644 --- a/contrib/pdfmark/ChangeLog +++ b/contrib/pdfmark/ChangeLog @@ -1,5 +1,16 @@ 2007-04-11 Keith Marshall <keith.d.marshall@ntlworld.com> + Avoid stray newlines in folded pdfmark literal content. + + * pdfmark.tmac (pdf*pdfmark.dispatch.wrapped): New string; define it + when accumulating long literal content; make it undefined otherwise. + (PDFMARK.FOLDWIDTH, PDFMARK.FOLDWIDTH.MAX): Reserve space for two + extra characters, to accommodate a space and an escaped newline, + while accumulating literal content, in case folding is required. + (pdf*pdfmark.dispatch) [pdf*pdfmark.dispatch.wrapped]: Add them. + +2007-04-11 Keith Marshall <keith.d.marshall@ntlworld.com> + * pdfmark.tmac (pdfbookmark): Don't evaluate within diversions; defer placement until diversion is copied out at top level. diff --git a/contrib/pdfmark/pdfmark.tmac b/contrib/pdfmark/pdfmark.tmac index 71ea5a34..174df785 100644 --- a/contrib/pdfmark/pdfmark.tmac +++ b/contrib/pdfmark/pdfmark.tmac @@ -286,20 +286,23 @@ inspiration has come from discussion on the groff mailing list .\" allowed literal token length. .\" .length pdf:length "\\*[pdf:composed.literal] \\$*\" -.ie (\\n[pdf:length] > \\n[PDFMARK.FOLDWIDTH]) \{\ +.ie (\\n[pdf:length] > (\\n[PDFMARK.FOLDWIDTH] - 2)) \{\ .\" .\" If it has grown too long, then it must be folded across two .\" physical PDFMARK output records, so check if we can accommodate .\" the portion collected so far within the current output record. .\" . pdf*length.increment "\\*[pdf:composed.literal]\" -. if (\\n[pdf:length] > \\n[PDFMARK.FOLDWIDTH.MAX]) \{\ +. if (\\n[pdf:length] > (\\n[PDFMARK.FOLDWIDTH.MAX] - 2)) \{\ . \" . \" The current output record CAN'T accommodate the currently . \" composed portion of the literal, so flush out the current -. \" record, to make way for the accumulated literal. +. \" record, to make way for the accumulated literal, and mark +. \" the dispatch mode as "wrapped", for the fragments of the +. \" folded literal string, which are to follow. . \" . pdf*pdfmark.dispatch +. ds pdf*pdfmark.dispatch.wrapped . \} . ie d pdf:composed.line \{\ . \" @@ -381,10 +384,12 @@ inspiration has come from discussion on the groff mailing list . \} . \} .\" -.\" Finally, since we have completed the accumulation of the literal, -.\" we revert to the normal "pdf*compose" action, for collection of -.\" the next token (if any). +.\" Finally, since we have completed the accumulation of the literal, we +.\" revert to the "unwrapped" mode of operation for "pdf*pdfmark.dispatch", +.\" and restore the normal "pdf*compose" action, for collection of the next +.\" token (if any). .\" +. rm pdf*pdfmark.dispatch.wrapped . als pdf*compose pdf*compose.next . \} .. @@ -406,6 +411,15 @@ inspiration has come from discussion on the groff mailing list .\" before attempting to post it; it then cleans up after posting, to .\" ensure that each collected record is posted only once. .\" +. if d pdf*pdfmark.dispatch.wrapped \{\ +. \" +. \" When dispatching an excessively long literal string, which +. \" must be wrapped over multiple records, this mode is active +. \" for all but the closing record; we must escape the newline +. \" at the end of each such unclosed literal record. +. \" +. as pdf:composed.line " \\\\\\\\\" +. \} . pdf*pdfmark.post . rm pdf:composed.line . \} |