From c13f78b471ad73a52eb50ec335c37756d9cc8f9c Mon Sep 17 00:00:00 2001 From: Jordan Irwin Date: Fri, 30 Jul 2021 17:54:33 -0700 Subject: [PATCH] LDoc: move files for generating docs into ".ldoc" directory --- {docs => .ldoc}/config.ld | 6 ++---- {docs => .ldoc}/config.luadoc | 0 .ldoc/gendoc.sh | 39 +++++++++++++++++++++++++++++++++++ {docs => .ldoc}/ldoc.css | 0 docs/gendoc.sh | 13 ------------ 5 files changed, 41 insertions(+), 17 deletions(-) rename {docs => .ldoc}/config.ld (93%) rename {docs => .ldoc}/config.luadoc (100%) create mode 100755 .ldoc/gendoc.sh rename {docs => .ldoc}/ldoc.css (100%) delete mode 100755 docs/gendoc.sh diff --git a/docs/config.ld b/.ldoc/config.ld similarity index 93% rename from docs/config.ld rename to .ldoc/config.ld index 0bfde0f..8703578 100644 --- a/docs/config.ld +++ b/.ldoc/config.ld @@ -20,7 +20,7 @@ file = { "api.lua", "chat.lua", "tools.lua", - "docs/config.luadoc", + ".ldoc/config.luadoc", } new_type("chatcmd", "Chat Commands") @@ -49,7 +49,7 @@ custom_tags = { "img", title = "Image", format = function(value) - return "" + return "" end, }, } @@ -64,8 +64,6 @@ local function format_setting_tag(desc, value) end local function setting_handler(item) - print("\nsetting_handler: " .. item.name) - if not ipairs or not type then return item end diff --git a/docs/config.luadoc b/.ldoc/config.luadoc similarity index 100% rename from docs/config.luadoc rename to .ldoc/config.luadoc diff --git a/.ldoc/gendoc.sh b/.ldoc/gendoc.sh new file mode 100755 index 0000000..ead6b19 --- /dev/null +++ b/.ldoc/gendoc.sh @@ -0,0 +1,39 @@ +#!/usr/bin/env bash + +# place this file in mod ".ldoc" directory + + +d_ldoc="$(dirname $(readlink -f $0))" +f_config="${d_ldoc}/config.ld" + +cd "${d_ldoc}/.." + +d_root="$(pwd)" +d_ref="${d_root}/docs/reference" +d_data="${d_ref}/data" + +cmd_ldoc="${d_ldoc}/ldoc/ldoc.lua" +if test ! -x "${cmd_ldoc}"; then + cmd_ldoc="ldoc" +fi + +# clean old files +rm -rf "${d_ref}" + +# create new files +"${cmd_ldoc}" --UNSAFE_NO_SANDBOX -c "${f_config}" -d "${d_ref}" "${d_root}" + +# check exit status +retval=$? +if test ${retval} -ne 0; then + exit ${retval} +fi + +# copy textures to data directory +echo -e "\ncopying textures ..." +mkdir -p "${d_data}" +for png in $(find "${d_root}/textures" -maxdepth 1 -type f -name "*.png"); do + cp -v "${png}" "${d_data}" +done + +echo -e "\nDone!" diff --git a/docs/ldoc.css b/.ldoc/ldoc.css similarity index 100% rename from docs/ldoc.css rename to .ldoc/ldoc.css diff --git a/docs/gendoc.sh b/docs/gendoc.sh deleted file mode 100755 index e159050..0000000 --- a/docs/gendoc.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -docs="$(dirname $(readlink -f $0))" -root="$(dirname ${docs})" -config="${docs}/config.ld" - -cd "${root}" - -# Clean old files -rm -rf "${docs}/reference" - -# Create new files -ldoc --UNSAFE_NO_SANDBOX -c "${config}" -d "${docs}/reference" "${root}"