summaryrefslogtreecommitdiff
path: root/doc/tools/latex_filter
blob: 044a8642f83367a9e11a112116a17e7b5dda2bc6 (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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/sh

# First argument is the number of lines to treat
# Second argument is optional and, if it is "no", overfull are not displayed

i=$1
nooverfull=$2
error=0
verbose=0
chapter=""
file=""
while : ; do 
  read -r line; 
  case $line in
    "! "*)
      echo $line $file;
      error=1
      verbose=1
      ;;
    "LaTeX Font Info"*|"LaTeX Info"*|"Underfull "*)
      verbose=0
      ;;
    "Overfull "*)
      verbose=0
      if [ "$nooverfull" != "no" ]; then echo $line $file; fi
      ;;
    "LaTeX "*)
      verbose=0
      echo $line $chapter
      ;;
    "["*|"Chapter "*)
      verbose=0
      ;;
    "(./"*)
      file="(file `echo $line | cut -b 4- | cut -d' ' -f 1`)"
      verbose=0
      ;;
    *)
      if [ $verbose = 1 ]; then echo $line; fi
  esac;
  if [ "$i" = "0" ]; then break; else i=`expr $i - 1`; fi; 
done
exit $error