• R/O
  • SSH

コミット

タグ
未設定

よく使われているワード(クリックで追加)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Reference Documentation: PDF Publishing with GNU Troff


コミットメタ情報

リビジョンecd113b7c40fcd83cb924a3fdf3ac7665f5a7d56 (tree)
日時2023-03-31 22:41:10
作者Keith Marshall <keith@user...>
コミッターKeith Marshall

ログメッセージ

Improve selectivity of pdfroff's blank-page removal feature.

* pdfroff.sh (--no-kill-null-pages): Accept an optional argument,
with permitted values of "all", "body", or "toc"; interpret to set...
(TC_FILTER, BD_FILTER): ...these new internal-use variables, which
subsequently establish the scope of operation for...
(PDFROFF_COLLATE): ...this internal filter.

* pdfroff.1.man (--no-kill-null-pages): Document argument usage.

* tmac/spdf.tmac (TC) [PHASE>1]: Make it a no-op.

変更サマリ

差分

diff -r 7fed1c1a83d2 -r ecd113b7c40f pdfroff.1.man
--- a/pdfroff.1.man Wed Mar 29 18:59:09 2023 +0100
+++ b/pdfroff.1.man Fri Mar 31 14:41:10 2023 +0100
@@ -56,7 +56,8 @@
5656 .SY pdfroff
5757 .RI [ groff-option\ \&.\|.\|.\&]
5858 .RB [ \-\-no\-toc\-relocation ]
59-.RB [ \-\-no\-kill\-null\-pages ]
59+.RB [ \-\-no\-kill\-null\-pages [ =\c
60+.IR where ]]
6061 .if t .br
6162 .RB [ \-\-no\-reference\-dictionary ]
6263 .RB [ \-\-reference\-dictionary=\c
@@ -391,7 +392,6 @@
391392 has completed PDF document formatting;
392393 this may be useful when debugging formatting problems.
393394 .
394-.
395395 .IP
396396 See section \[lq]Files\[rq] below for a description of the temporary
397397 files used by
@@ -432,7 +432,8 @@
432432 .
433433 .
434434 .TP
435-.B \-\-no\-kill\-null\-pages
435+.BR \-\-no\-kill\-null\-pages [ =\c
436+.IR where ]
436437 While preparing for simulation of the manual collation step,
437438 which is traditionally required to relocate a
438439 .I "table of contents"
@@ -447,6 +448,48 @@
447448 .I \%pdfroff
448449 to leave them in place.
449450 .
451+.IP
452+It may be noted that, in
453+.IR \%pdfroff 's
454+default mode of operation,
455+entirely blank pages are discarded
456+.I throughout
457+the finished document;
458+the optional
459+.I where
460+argument,
461+which may take any
462+.I one
463+of the values,
464+.BR toc ,
465+.BR body ,
466+or
467+.BR any ,
468+permits a finer degree of control over \%blank-page removal.
469+The default behaviour,
470+when
471+.B \%\-\-no\-kill\-null\-pages
472+is specified
473+.I without
474+any argument,
475+is equivalent to the effect of specifying
476+.BR \%\-\-no\-kill\-null\-pages=all ;
477+this suppresses the removal of blank pages throughout the
478+.I entire
479+document.
480+More often,
481+it will be desired to leave blank pages in place
482+within the body of the document,
483+while removing them from the table of contents;
484+this may be achieved by specifying
485+.BR \%\-\-no\-kill\-null\-pages=body .
486+Conversely,
487+although perhaps less usefully,
488+blank pages may be removed from the document body,
489+while leaving them in place within the table of contents,
490+by specifying
491+.BR \%\-\-no\-kill\-null\-pages=toc .
492+.
450493 .
451494 .TP
452495 .BI \-\-pdf\-output= name
diff -r 7fed1c1a83d2 -r ecd113b7c40f pdfroff.sh
--- a/pdfroff.sh Wed Mar 29 18:59:09 2023 +0100
+++ b/pdfroff.sh Fri Mar 31 14:41:10 2023 +0100
@@ -196,8 +196,8 @@
196196 REFFILE=${GROFF_TMPDIR}/pdf$$.ref
197197 #
198198 CS_DATA=""
199- TC_DATA=${GROFF_TMPDIR}/pdf$$.tc
200- BD_DATA=${GROFF_TMPDIR}/pdf$$.ps
199+ TC_DATA=${GROFF_TMPDIR}/pdf$$.tc TC_FILTER=$TC_DATA
200+ BD_DATA=${GROFF_TMPDIR}/pdf$$.ps BD_FILTER=$BD_DATA
201201 #
202202 # Initialise 'groff' format control settings,
203203 # to discriminate table of contents and document body formatting passes.
@@ -303,7 +303,7 @@
303303 normally required to position the table of contents at the
304304 start of a PDF document.
305305
306- --no-kill-null-pages
306+ --no-kill-null-pages[=all|body|toc]
307307 Suppress the 'null page' elimination filter, which is used
308308 to remove the excess blank pages produced by the collation
309309 algorithm used for 'toc-relocation'.
@@ -355,11 +355,18 @@
355355 ;;
356356
357357 --no-toc-relocation)
358- TC_DATA="" TOC_FORMAT=""
358+ TC_DATA="" TC_FILTER="" TOC_FORMAT=""
359359 ;;
360360
361361 --no-kill-null-pages)
362- PDFROFF_COLLATE="$CAT" PDFROFF_KILL_NULL_PAGES=""
362+ OPTARG=`echo $OPTARG | $SED y/ALTCBODY/altcbody/`
363+ case $OPTARG in all | body | toc) ;; *)
364+ test -n "$OPTARG" && { echo >&2 "$CMD: option '$1' is invalid"
365+ exit 1
366+ } || OPTARG="all" ;;
367+ esac
368+ case $OPTARG in all | body) BD_FILTER="" ;; esac
369+ case $OPTARG in all | toc) TC_FILTER="" ;; esac
363370 ;;
364371 #
365372 # any other non-null match must have matched more than one defined case,
@@ -603,7 +610,7 @@
603610 # ...reproducing the effect of the '--no-toc-relocation' option, when
604611 # no enabling hint has been provided.
605612 #
606- TC_DATA="" TOC_FORMAT=""
613+ TC_DATA="" TC_FILTER="" TOC_FORMAT=""
607614 fi
608615 fi
609616 #
@@ -716,26 +723,31 @@
716723 then
717724 exec > $PDF_OUTPUT
718725 fi
726+
727+ test -n "$BD_FILTER" && { BD_DATA="-"; test -n "$TC_FILTER" && TC_DATA=""
728+ } || test -n "$TC_FILTER" && TC_DATA="-"
719729 #
720730 # (This 'sed' script is a hack, to eliminate redundant blank pages).
721731 #
722- ${PDFROFF_COLLATE-"$SED"} ${PDFROFF_KILL_NULL_PAGES-'
723- /%%Page:/{
724- N
725- /%%BeginPageSetup/b again
726- }
727- b
728- :again
729- /%%EndPageSetup/b finish
730- /%%Page:/{
731- N
732- b again
733- }
734- b
735- :finish
736- N
737- /^%%Page:.*\n0 Cg EP$/d
738- '} $TC_DATA $BD_DATA | $PDFROFF_POSTPROCESSOR_COMMAND $CS_DATA -
732+ if test -n "$TC_FILTER$BD_FILTER"
733+ then ${PDFROFF_COLLATE-"$SED"} ${PDFROFF_KILL_NULL_PAGES-'
734+ /%%Page:/{
735+ N
736+ /%%BeginPageSetup/b again
737+ }
738+ b
739+ :again
740+ /%%EndPageSetup/b finish
741+ /%%Page:/{
742+ N
743+ b again
744+ }
745+ b
746+ :finish
747+ N
748+ /^%%Page:.*\n0 Cg EP$/d
749+ '} $TC_FILTER $BD_FILTER
750+ fi | $PDFROFF_POSTPROCESSOR_COMMAND $CS_DATA $TC_DATA $BD_DATA
739751 $SAY >&2 ". done"
740752 #
741753 # ------------------------------------------------------------------------------
diff -r 7fed1c1a83d2 -r ecd113b7c40f tmac/spdf.tmac
--- a/tmac/spdf.tmac Wed Mar 29 18:59:09 2023 +0100
+++ b/tmac/spdf.tmac Fri Mar 31 14:41:10 2023 +0100
@@ -271,6 +271,7 @@
271271 .\" the TOC output phase of document production.
272272 .\"
273273 .de TC
274+. if d pdfroff .if \\n[PHASE]>1 .return
274275 . pdfsync O
275276 . P1
276277 . OP \n[PDF-TOC-ONLY]