LDoc: move files for generating docs into ".ldoc" directory

This commit is contained in:
Jordan Irwin 2021-07-30 17:54:33 -07:00
parent 99544d286f
commit c13f78b471
5 changed files with 41 additions and 17 deletions

View file

@ -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 "<img src=\"../../../textures/" .. value .. "\" style=\"width:32px; height:32px;\" />"
return "<img src=\"../data/" .. value .. "\" style=\"width:32px; height:32px;\" />"
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

39
.ldoc/gendoc.sh Executable file
View file

@ -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!"

View file

@ -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}"