Skip to content

Commit

Permalink
initial work for adding docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Bilal2453 committed Jan 19, 2025
1 parent 12c8642 commit b51843d
Show file tree
Hide file tree
Showing 6 changed files with 1,819 additions and 0 deletions.
5 changes: 5 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Luvi documentation

Modules:

- [lminiz](./output/markdown/miniz.md)
31 changes: 31 additions & 0 deletions docs/gen.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
local fs = require 'fs'
local join = require 'pathjoin'.pathJoin
local generators = require './generators'

local function dir(path)
if not fs.existsSync(path) then
assert(fs.mkdirpSync(path))
end
return path
end

-- TODO: a full CLI tool?

local output_dir = dir('./output')
local input_dir = dir('./modules')

local modules_docs = {}
for entry, entry_type in fs.scandirSync(input_dir) do
if entry_type == 'file' then
table.insert(modules_docs, dofile(join(input_dir, entry)))
end
end

for _, docs in ipairs(modules_docs) do
for gen_name, generator in pairs(generators) do
local content = generator.generate(docs)
local dir_path = dir(join(output_dir, gen_name))
local file_name = docs.name .. generator.extension
assert(fs.writeFileSync(join(dir_path, file_name), content))
end
end
3 changes: 3 additions & 0 deletions docs/generators/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
return {
markdown = require './markdown',
}
Loading

0 comments on commit b51843d

Please sign in to comment.