From 6b3220048bef393f47d40e99c06175243e90b5e7 Mon Sep 17 00:00:00 2001 From: Jordan Irwin Date: Mon, 16 Aug 2021 02:18:29 -0700 Subject: [PATCH] LDoc: add script to build versioned docs --- .ldoc/build_versioned_docs.sh | 98 +++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100755 .ldoc/build_versioned_docs.sh diff --git a/.ldoc/build_versioned_docs.sh b/.ldoc/build_versioned_docs.sh new file mode 100755 index 0000000..728103f --- /dev/null +++ b/.ldoc/build_versioned_docs.sh @@ -0,0 +1,98 @@ +#!/usr/bin/env bash + +# place this file in mod ".ldoc" directory + + +d_config="$(dirname $(readlink -f $0))" + +cd "${d_config}/.." + +d_root="$(pwd)" +d_export="${d_export:-${d_root}/docs/reference}" + +cmd_ldoc="${d_root}/../ldoc/ldoc.lua" +if test -f "${cmd_ldoc}"; then + if test ! -x "${cmd_ldoc}"; then + chmod +x "${cmd_ldoc}" + fi +else + cmd_ldoc="ldoc" +fi + +# clean old files +rm -rf "${d_export}" + +# store current branch +main_branch="$(git branch --show-current)" + +html_out="\n\n\n\n\n\n\n" + +cd "${d_root}" +git checkout ${main_branch} + +echo -e "${html_out}" > "${d_export}/index.html" + +echo -e "\nDone!"