diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2021-10-05 11:28:56 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2021-10-05 11:28:56 +0200 |
commit | 574144594f6167078bc91118a0e9504102ca1d2b (patch) | |
tree | 5d50df7b58cf01f8105c3745b36fc8fe2893f923 /manpdf | |
parent | 0ed5b8f5815b90958546cab28d30ba8f2e5a780c (diff) | |
download | bin-574144594f6167078bc91118a0e9504102ca1d2b.zip bin-574144594f6167078bc91118a0e9504102ca1d2b.tar.gz |
add manpdf
Diffstat (limited to 'manpdf')
-rwxr-xr-x | manpdf | 29 |
1 files changed, 29 insertions, 0 deletions
@@ -0,0 +1,29 @@ +#! /bin/bash + +DIR=/tmp/manpdf +STYLE=$DIR/style.css +FNAME=$DIR/$1 + +[ -d $DIR ] || mkdir $DIR + +if [ ! -r $STYLE ] +then + echo "<style type=\"text/css\"> +body { font-family: Whitney Medium; background: #181a1b; } +p { font-size: 20px; color: white; } +h2 { font-size: 25px; display:inline; color: yellow; } +h1 { font-size: 30px; color: white; } +b { color: #5ce7ad; } +i { color: #ff4b4b; } +a { font-size: 20px; color: #3391ff } +pre { color: white; font-size: 15px; } +</style>" > $STYLE +fi + +if [ ! -r $FNAME.pdf ] +then + gunzip --to-stdout $(man --where $1) | groff -mandoc -Thtml > $FNAME.html + sed -i "/<\/style>/r $STYLE" $FNAME.html + wkhtmltopdf $FNAME.html $FNAME.pdf +fi +evince $FNAME.pdf |