blob: d44b9200b1cb3a86e81f7bb474ffdb5b44e0cdd1 (
plain)
| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
 | #!/bin/sh
# Little dirty script to print wdiff's output to a pdf file using pandoc and latex
title="wdiff to pdf"
if [ -z "$1" ] || [ -z "$2" ]; then
  echo "Please specify two files to wdiff"
  exit
fi
if [ ! -z "$3" ]; then
  title="$3"
fi
body="$(wdiff "$1" "$2" | sed 's/\[-/\\sout{\\textcolor[rgb]{0.5,0,0}{/g;s/-\]/}}/g;s/{+/\\textcolor[rgb]{0,0.64,0.1}{/g;s/+}/}/g')"
file=$(readlink -f "$1")
pandocfile="${file%.*}.md"
resultfile="${file%.*}.pdf"
printf -- "---\ntitle: %s\noutput: pdf_document\nheader-includes:\n  \\\\usepackage{ulem}\n  \\\\usepackage[margin=3cm]{geometry}\n---\n\n%s" "$title" "$body" > "$pandocfile"
pandoc "$pandocfile" -o "$resultfile"
 |