/+junk/datalogisk-ordlista

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/%2Bjunk/datalogisk-ordlista

« back to all changes in this revision

Viewing changes to bygg.sh

  • Committer: Gustav Hartvigsson
  • Date: 2020-06-09 21:48:49 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20200609214849-cw3dhtzus5ug5smm
* En Början

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env bash
 
2
 
 
3
ARGS=$@
 
4
 
 
5
 
 
6
HITTAT_PANDOC=false
 
7
HITTA_LATEX=false
 
8
 
 
9
DOCUMENT_SOURCE=./dokument-källa/001.md
 
10
CSL_FILE=apa-5th-edition.csl
 
11
BIBLIOGRAPHY=bibliografi.bib
 
12
LATEX_FILE=./ordlista.tex
 
13
 
 
14
 
 
15
__main () {
 
16
  ARGS=$1
 
17
  
 
18
  __hitta_pandoc
 
19
  
 
20
  __hitta_pandoc_citeproc
 
21
  
 
22
  __hitta_latex
 
23
  
 
24
  if [[ "$HITTAT_LATEX" != true ]]
 
25
  then
 
26
    echo "exiting"
 
27
    exit 2
 
28
  fi
 
29
  
 
30
  if [[ "$HITTAT_PANDOC" != true ]]
 
31
  then
 
32
    echo "exiting"
 
33
    exit 1
 
34
  fi
 
35
  
 
36
  __generera_latex
 
37
  
 
38
  __kompilera_pdf
 
39
  
 
40
  __kompilera_html
 
41
  
 
42
  
 
43
  exit 0
 
44
}
 
45
 
 
46
 
 
47
__hitta_pandoc () {
 
48
  if which pandoc >/dev/null;
 
49
  then
 
50
    echo "Hittade \"pandoc\"."
 
51
    HITTAT_PANDOC=true
 
52
  else
 
53
    echo "Kunde inte hitta \"pandoc\", vänligen installera det."
 
54
  fi
 
55
}
 
56
 
 
57
 
 
58
__hitta_pandoc_citeproc () {
 
59
  if which pandoc-citeproc >/dev/null;
 
60
  then
 
61
    echo "Hittade \"pandoc-citeproc\"."
 
62
    HITTAT_PANDOC=true
 
63
  else
 
64
    echo "Kunde inte hitta \"pandoc-citeproc\", vänligen installera det."
 
65
  fi
 
66
}
 
67
 
 
68
__hitta_latex () {
 
69
  if which pandoc-citeproc >/dev/null;
 
70
  then
 
71
    echo "Hittade \"LaTeX\"."
 
72
    HITTAT_LATEX=true
 
73
  else
 
74
    echo "Kunde inte hitta \"LaTeX\", vänligen installera det."
 
75
  fi
 
76
}
 
77
 
 
78
__generera_latex () {
 
79
  echo "foo"
 
80
  pandoc -s $DOCUMENT_SOURCE \
 
81
            --filter pandoc-citeproc \
 
82
            --bibliography $BIBLIOGRAPHY \
 
83
            --csl $CSL_FILE \
 
84
            -f markdown \
 
85
            -o $LATEX_FILE
 
86
}
 
87
 
 
88
__kompilera_pdf () {
 
89
  echo "bar"
 
90
  pandoc -s $DOCUMENT_SOURCE \
 
91
              --filter pandoc-citeproc \
 
92
              --bibliography $BIBLIOGRAPHY \
 
93
              --csl $CSL_FILE \
 
94
              -f markdown \
 
95
              -o ./ordlista.pdf
 
96
}
 
97
 
 
98
__kompilera_html () {
 
99
  echo "baz"
 
100
  pandoc -s $LATEX_FILE \
 
101
              --filter pandoc-citeproc \
 
102
              --bibliography $BIBLIOGRAPHY \
 
103
              --csl $CSL_FILE \
 
104
              -f latex \
 
105
              -o ./ordlista.html
 
106
}
 
107
 
 
108
 
 
109
#kör skriptet
 
110
__main $ARGS