utils/generate-module-api-doc.rb: update for redict.io

Signed-off-by: Drew DeVault <sir@cmpwn.com>
This commit is contained in:
Drew DeVault 2024-03-26 10:50:41 +01:00
parent 5d810f809e
commit d4622e0592

View File

@ -87,7 +87,7 @@ def docufy(src,i)
puts "<span id=\"#{name}\"></span>\n\n"
puts "### `#{name}`\n\n"
puts " #{proto}\n"
puts "**Available since:** #{$since[name] or "unreleased"}\n\n"
puts "**Available since:** #{$since[name] or "Redict 7.3.0"}\n\n"
comment = ""
while true
i = i-1
@ -145,18 +145,14 @@ def is_func_line(src, i)
end
puts "---\n"
puts "title: \"Modules API reference\"\n"
puts "linkTitle: \"API reference\"\n"
puts "weight: 1\n"
puts "description: >\n"
puts " Reference for the Redict Modules API\n"
puts "aliases:\n"
puts " - /topics/modules-api-ref\n"
puts "title: \"API reference\"\n"
puts "---\n"
puts "\n"
puts "<!-- This file is generated from module.c using\n"
puts " utils/generate-module-api-doc.rb -->\n\n"
src = File.open(File.dirname(__FILE__) ++ "/../src/module.c").to_a
puts "# Modules API reference"
src = File.open("src/module.c").to_a
# Build function index
$index = {}
@ -186,16 +182,6 @@ if File.directory?(git_dir) && `which git` != ""
end
end
# Print TOC
puts "## Sections\n\n"
src.each_with_index do |_line,i|
if is_section_doc(src, i)
name = get_section_heading(src, i)
puts "* [#{name}](\##{section_name_to_id(name)})\n"
end
end
puts "* [Function index](#section-function-index)\n\n"
# Docufy: Print function prototype and markdown docs
src.each_with_index do |_line,i|
if is_func_line(src, i)