Optimize script for generating LinuxManBook.pdf

2023-11-22 Thread Alejandro Colomar
Hi Deri,

I've optimized from 18.5 s down to 16.3 s the script, by splitting the
pipeline with this wrapper (and slightly reducing the perl script to
just print the pages to stdout).  BTW, now it can be run from any
directory.  And every step can be debugged by just introducing
| tee /dev/tty \
wherever you want to debug.  It's all pushed to master.

The PDF is now printed to stdout, to avoid hard-coding file names.

I still need to split a bit more and reduce the longest lines.  How does
this script look to you?

Cheers,
Alex :-)


$ cat scripts/LinuxManBook/build_linux_man_book.sh 
#!/bin/sh
# Copyright 2023, Alejandro Colomar 
# SPDX-License-Identifier: GPL-3.0-or-later

(
"$(dirname "$0")"/prepare_linux_man_book.pl "$1" \
| groff -z -dPDF.EXPORT=1 -dLABEL.REFS=1 -dpaper=a4 -Tpdf -k -pet \
-M"$(dirname "$0")" -mandoc -manmark \
-F"$(dirname "$0")" -P-pa4 \-rC1 -rCHECKSTYLE=3 2>&1 \
| LC_ALL=C grep '^\. *ds ';

"$(dirname "$0")"/prepare_linux_man_book.pl "$1";
) \
| preconv \
| tbl \
| eqn -Tpdf \
| (
troff -Tpdf -ms <"$(dirname "$0")"/LMBfront.ms;
troff -Tpdf -M"$(dirname "$0")" -mandoc -manmark \
-F"$(dirname "$0")" -dpaper=a4;
) \
| gropdf -F"$(dirname "$0")" -pa4;


-- 



signature.asc
Description: PGP signature


Re: Multi-columns in ms, again

2023-11-22 Thread Thomas Dupond via

Le 2023-11-20 à 19:55, Oliver Corff a écrit :

Dear All,


Hello,


in April 29, I asked whether there is a possibility to resume one-column
text after a two-column text on the same page. Your answers, uni sono,
said what the the manual says: returning to one-column mode will always
finish the page and begin a new one.

The reason for this behaviour is to "[m]ake sure we don't exit if there
are still floats or footnotes left-over." (line 578 of s.tmac, groff
1.22.4)*

I am by far not familiar enough to modify the macros in s.tmac, so may I
kindly ask for some guidance?


I think the section "Multicolumn Processing" beginning on page 391 from 
the Unix Text Processing book[1] might be helpful.  It explains a simple 
macro to do two-column processing.


Although it does not solve your issue since it also implements a page 
break if you go from one column to two, I found these macro to be simple 
enough to bend to my needs.


1: http://chuzzlewit.co.uk/utp_book-1.1.pdf

Best regards,
--
Thomas





Re: Optimize script for generating LinuxManBook.pdf

2023-11-22 Thread Deri
On Wednesday, 22 November 2023 14:58:56 GMT Alejandro Colomar wrote:
> Hi Deri,
> 
> I've optimized from 18.5 s down to 16.3 s the script, by splitting the
> pipeline with this wrapper (and slightly reducing the perl script to
> just print the pages to stdout).  BTW, now it can be run from any
> directory.  And every step can be debugged by just introducing
> 
> | tee /dev/tty \
> 
> wherever you want to debug.  It's all pushed to master.
> 
> The PDF is now printed to stdout, to avoid hard-coding file names.
> 
> I still need to split a bit more and reduce the longest lines.  How does
> this script look to you?
> 
> Cheers,
> Alex :-)
> 
> 
> $ cat scripts/LinuxManBook/build_linux_man_book.sh
> #!/bin/sh
> # Copyright 2023, Alejandro Colomar 
> # SPDX-License-Identifier: GPL-3.0-or-later
> 
> (
>   "$(dirname "$0")"/prepare_linux_man_book.pl "$1" \
> 
>   | groff -z -dPDF.EXPORT=1 -dLABEL.REFS=1 -dpaper=a4 -Tpdf -k -pet \
> 
>   -M"$(dirname "$0")" -mandoc -manmark \
>   -F"$(dirname "$0")" -P-pa4 \-rC1 -rCHECKSTYLE=3 2>&1 \
> 
>   | LC_ALL=C grep '^\. *ds ';
> 
>   "$(dirname "$0")"/prepare_linux_man_book.pl "$1";
> ) \
> 
> | preconv \
> | tbl \
> | eqn -Tpdf \
> | (
> 
>   troff -Tpdf -ms <"$(dirname "$0")"/LMBfront.ms;
>   troff -Tpdf -M"$(dirname "$0")" -mandoc -manmark \
>   -F"$(dirname "$0")" -dpaper=a4;
> ) \
> 
> | gropdf -F"$(dirname "$0")" -pa4;

Hi Alex,

Is there a git address I can clone to see the changes "in the round” and give 
it a go?

Cheers 

Deri






Re: Optimize script for generating LinuxManBook.pdf

2023-11-22 Thread Alejandro Colomar
Hi Deri,

On Wed, Nov 22, 2023 at 05:33:52PM +, Deri wrote:
> Hi Alex,
> 
> Is there a git address I can clone to see the changes "in the round” and give 
> it a go?

Here's an unstable branch (I rebase often):


It's similar to Linux's 'next' branch.

But most of those changes are already in the master branch.

Cheers,
Alex

-- 



signature.asc
Description: PGP signature