-
Notifications
You must be signed in to change notification settings - Fork 0
/
mkieeepaper.sh
executable file
·47 lines (42 loc) · 920 Bytes
/
mkieeepaper.sh
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
44
45
46
47
#!/bin/sh
templatePath=$(dirname "$(realpath $0)")
newPaperDir="$1"
if [ -a "$templatePath/config.json" ]; then
configFile="$templatePath/config.json"
else
configFile="$templatePath/config_default.json"
fi
mkdir -p "$newPaperDir"
mkdir "$newPaperDir/figures"
strings=(
"main.tex"
"setup-*.tex"
"acronyms.tex"
"literature.bib"
"ieee-proc.bbx"
"previously-published-work.tex"
".gitignore"
"Makefile"
)
for i in "${strings[@]}"; do
echo "Copying file: $i"
cp -u "$templatePath/"$i "$newPaperDir"
done
currDir=$(pwd)
cd "$newPaperDir"
echo "Inserting default values..."
replace=(
"author"
"affiliation"
"funding"
)
for i in "${replace[@]}"; do
echo "Replacing $i from $configFile"
replacement=$(jq -r ".$i" $configFile)
replacement=$(echo "$replacement" | sed 's/\\/\\\\/g')
sed -i -e 's={{'"$i"'}}='"$replacement"'=g' main.tex
done
git init
git add .
git commit -m "Initial commit"
cd "$currDir"