comparison build.sh @ 12:daf59131cdb8

Support generate index on any working directory
author Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
date Sat, 01 Feb 2014 00:08:07 +0900
parents 9dca7035ab93
children 54fed5d73027
comparison
equal deleted inserted replaced
11:9dca7035ab93 12:daf59131cdb8
1 #/bin/sh 1 #/bin/sh
2 2
3 cd $(dirname $0)
4
3 # source definitions 5 # source definitions
4 . `dirname $0`/config/definition.sh 6 . config/definition.sh
5 7
6 # functions 8 # functions
7 9
8 command_check() { 10 command_check() {
9 if !(which ${build_command} >& /dev/null;) then 11 if !(which ${build_command} >& /dev/null;) then
30 build() { 32 build() {
31 ${build_command} build $1 -o `dirname $1` ${build_template_option} 33 ${build_command} build $1 -o `dirname $1` ${build_template_option}
32 } 34 }
33 35
34 find_sources() { 36 find_sources() {
35 find "$(dirname $0)/${slide_root_dirname}" -name "${build_target_filename}" 37 find "${slide_root_dirname}" -name "${build_target_filename}"
36 } 38 }
37 39
38 build_slides() { 40 build_slides() {
39 target_list=`find_sources` 41 target_list=`find_sources`
40 for target in ${target_list}; do 42 for target in ${target_list}; do
53 title=`head -5 $slide | grep "title[ ]*:" | sed -e 's/^title[ ]*:[ ]*//'` 55 title=`head -5 $slide | grep "title[ ]*:" | sed -e 's/^title[ ]*:[ ]*//'`
54 date=`basename $(dirname $slide)` 56 date=`basename $(dirname $slide)`
55 echo "* ${date} : [$title]($(slide_name_from_full_path $slide))" >> ${index_source_name} 57 echo "* ${date} : [$title]($(slide_name_from_full_path $slide))" >> ${index_source_name}
56 done 58 done
57 59
58 kramdown ${index_source_name} --template "$(dirname $0)/${index_template_file}" > ${index_file_name} 60 kramdown ${index_source_name} --template ${index_template_file} > ${index_file_name}
59 } 61 }
60 62
61 63
62 # main 64 # main
63 65