summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2021-10-05 11:28:56 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2021-10-05 11:28:56 +0200
commit574144594f6167078bc91118a0e9504102ca1d2b (patch)
tree5d50df7b58cf01f8105c3745b36fc8fe2893f923
parent0ed5b8f5815b90958546cab28d30ba8f2e5a780c (diff)
downloadbin-574144594f6167078bc91118a0e9504102ca1d2b.zip
bin-574144594f6167078bc91118a0e9504102ca1d2b.tar.gz
add manpdf
-rwxr-xr-xmanpdf29
1 files changed, 29 insertions, 0 deletions
diff --git a/manpdf b/manpdf
new file mode 100755
index 0000000..32136f9
--- /dev/null
+++ b/manpdf
@@ -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