chore: remove lua docgen

docs-refactor
sammyette 2022-12-14 23:57:04 -04:00
parent 0f97abef0f
commit e1177b5a04
Signed by: sammyette
GPG Key ID: 904FC49417B44DCD
2 changed files with 0 additions and 79 deletions

View File

@ -4,24 +4,15 @@ on:
push: push:
branches: branches:
- master - master
- docs-refactor
jobs: jobs:
gen: gen:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
with:
submodules: true
- uses: actions/setup-go@v2 - uses: actions/setup-go@v2
- name: Download Task
run: 'sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d'
- name: Build
run: ./bin/task
- name: Run docgen - name: Run docgen
run: go run cmd/docgen/docgen.go run: go run cmd/docgen/docgen.go
- name: Run lua docgen
run: ./hilbish cmd/docgen/docgen.lua
- name: Commit new docs - name: Commit new docs
uses: stefanzweifel/git-auto-commit-action@v4 uses: stefanzweifel/git-auto-commit-action@v4
with: with:

View File

@ -1,70 +0,0 @@
local fs = require 'fs'
local emmyPattern = '^%-%-%- (.+)'
local pieces = {}
local files = fs.readdir 'nature'
for _, fname in ipairs(files) do
local isScript = fname:match'%.lua$'
if not isScript then goto continue end
local f = io.open(string.format('nature/%s', fname))
local header = f:read '*l'
if not header:match(emmyPattern) then goto continue end
print(fname)
local iface = header:match(emmyPattern)
pieces[iface] = {}
local docPiece = {}
for line in f:lines() do
if line == header then goto continue2 end
if not line:match(emmyPattern) then
if line:match '^function' then
local pattern = (string.format('^function %s.', iface) .. '(%w+)')
local funcName = line:match(pattern)
pieces[iface][funcName] = docPiece
end
docPiece = {}
goto continue2
end
table.insert(docPiece, line)
::continue2::
end
::continue::
end
for iface, dps in pairs(pieces) do
local mod = iface:match '(%w+)%.'
local path = string.format('docs/api/%s/%s.md', mod, iface)
local f <close> = io.open(path, 'a+')
print(mod, path)
for func, docs in pairs(dps) do
local params = table.filter(docs, function(t)
return t:match '^%-%-%- @param'
end)
f:write(string.format('## %s(', func))
for i, str in ipairs(params) do
if i ~= 1 then
f:write ', '
end
f:write(str:match '^%-%-%- @param ([%w]+) ')
end
f:write(')\n')
for _, str in ipairs(docs) do
if not str:match '^%-%-%- @' then
f:write(str:match '^%-%-%- (.+)' .. '\n')
end
end
f:write('\n')
end
f:flush()
end