diff --git a/docs/config.ld b/docs/config.ld new file mode 100644 index 0000000..765a1f9 --- /dev/null +++ b/docs/config.ld @@ -0,0 +1,58 @@ +title = "Sneeker mod for Minetest" +project = "sneeker" +format = "markdown" +not_luadoc = true +boilerplate = false + +file = {"settings.lua",} + +local function italic(value) + return "" .. value .. "" +end + +new_type("setting", "Settings") +new_type("chatcmd", "Chat Commands", false, "chatparam") +custom_tags = { + {"type2", + title = "Type", + format = italic, + }, + {"dfield", + title = "Definition Fields", + }, + {"chatparam", + title = "Parameters", + }, + {"option", + title = "Options", + }, + {"settype", + title = "Type", + format = italic, + }, + {"default", + title = "Default", + format = italic, + }, + {"note", + title = "Notes", + format = italic, + }, +} + +local function chatcmd_handler(item) + local output = item.name + for i, p in ipairs(item.tags.chatparam) do + output = output .. " " .. p + end + + return output +end + +function custom_display_name_handler(item, default_handler) + if item.type == "chatcmd" then + return chatcmd_handler(item) + end + + return default_handler(item) +end diff --git a/docs/gendoc.sh b/docs/gendoc.sh new file mode 100644 index 0000000..7ed4130 --- /dev/null +++ b/docs/gendoc.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +DOCS="$(dirname $(readlink -f $0))" +ROOT="$(dirname ${DOCS})" +CONFIG="${DOCS}/config.ld" + +cd "${ROOT}" + +# Clean old files +rm -rf "${DOCS}/api.html" "${DOCS}/scripts" "${DOCS}/modules" + +# Create new files +ldoc -c "${CONFIG}" -d "${DOCS}" -o "api" "${ROOT}"