#!/bin/bash set -eu set -o pipefail prefix="../../libs" find "$prefix" -name "*.idr" >tmp while IFS= read -r rawfile; do file=$(echo "$rawfile" | sed "s|\.\./\.\./libs/\(.*\)|\1|") libname=$(echo "$file" | sed "s|\([^/]*\)/.*|\1|") filename=$(echo "$file" | sed "s|[^/]*/\(.*\)\.idr|\1|") modulename=$(echo "$filename" | sed "s|/|.|g") htmldir="html/${libname}/source/" htmlfile="${htmldir}/${modulename}.html" mkdir -p "$htmldir" ttc_version=$(ls "${prefix}/${libname}/build/ttc/") katla html "$rawfile" "${prefix}/${libname}/build/ttc/${ttc_version}/${filename}.ttm" >"$htmlfile" sed -i "s||${modulename}|" "$htmlfile" done tmp while IFS= read -r libdirectory; do libname=$(echo "$libdirectory" | sed "s|$prefix/||") cp -r "$prefix"/"$libname"/build/docs/* html/"$libname" find html/"$libname"/docs/ -name "*.html" >tmp2 while IFS= read -r file; do filename=$(basename "$file" ".html") sed -i "s|

${filename}

|

${filename}(source)

|" "$file" done