#! /bin/bash -ue
# Last edited on 2026-07-14 01:58:32 by stolfi

# Writes to disk a file with the tags of the sections that occur in
# ${lang}/${book} and the subset that is worth analyzing. To
# be called after the EVT file specific of ${lang} and ${book} has been
# created.

lang="$1"; shift
book="$1"; shift

echo "# ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::" 1>&2
echo "###  $0 ${lang} ${book}" 1>&2

if [[ "/${lang}" == "/" ]]; then echo "** lang not specified" 1>&2; exit 1; fi
if [[ "/${book}" == "/" ]]; then echo "** book not specified" 1>&2; exit 1; fi

# Top folders for output data and output TeX tables of this note:
gen_book_dir="gen/${lang}/${book}"; mkdir -p ${gen_book_dir} 
tex_book_dir="tex/${lang}/${book}"; mkdir -p ${tex_book_dir}

if [[ "/${lang}" == "/voyn" ]]; then
  ./make_voyn_book_list_of_sections.sh
elif [[ "/${lang}" == "/engl" ]]; then
else
  echo "** cannot handle language ${lang}" 1>&2; exit 1; fi
fi
echo "    sections to analyze = ${use_secs[*]} tot.1" 1>&2

# Save list of use_secs to analyze:
echo "writing ${use_sec_list} with list of sections to consider in ${lang}/${book} ..." 1>&2
echo "${use_secs[@]}" \
  | tr ' ' '\012' \
  > ${use_sec_list}
# ./show_first_last_lines.sh 20 3 ${use_sec_list}

echo "# exiting $0" 1>&2
echo "# ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::" 1>&2
