2
3
镜像来自 https://github.com/sammy-ette/Hilbish synced 2025-08-10 02:52:03 +00:00

Compare commits

..

No commits in common. "6514c8c93758321efec423ff45e98cd5e8bf7043" and "56f9954f97bb695dbb4615ff14400b72952eb304" have entirely different histories.

共有 5 個文件被更改,包括 1416 次插入63 次删除

查看文件

@ -299,25 +299,7 @@ start:
func main() { func main() {
fset := token.NewFileSet() fset := token.NewFileSet()
os.Mkdir("docs", 0777) os.Mkdir("docs", 0777)
os.RemoveAll("docs/api")
os.Mkdir("docs/api", 0777) os.Mkdir("docs/api", 0777)
f, err := os.Create("docs/api/_index.md")
if err != nil {
panic(err)
}
f.WriteString(`---
title: API
layout: doc
weight: -100
menu: docs
---
Welcome to the API documentation for Hilbish. This documents Lua functions
provided by Hilbish.
`)
f.Close()
os.Mkdir("emmyLuaDocs", 0777) os.Mkdir("emmyLuaDocs", 0777)
dirs := []string{"./"} dirs := []string{"./"}

查看文件

@ -1,9 +1,7 @@
local fs = require 'fs' local fs = require 'fs'
local emmyPattern = '^%-%-%- (.+)' local emmyPattern = '^%-%-%- (.+)'
local emmyPattern2 = '^%-%- (.+)'
local modpattern = '^%-+ @module (.+)' local modpattern = '^%-+ @module (.+)'
local pieces = {} local pieces = {}
local descriptions = {}
local files = fs.readdir 'nature' local files = fs.readdir 'nature'
for _, fname in ipairs(files) do for _, fname in ipairs(files) do
@ -17,24 +15,16 @@ for _, fname in ipairs(files) do
print(fname, mod) print(fname, mod)
pieces[mod] = {} pieces[mod] = {}
descriptions[mod] = {}
local docPiece = {} local docPiece = {}
local lines = {} local lines = {}
local lineno = 0 local lineno = 0
local doingDescription = true
for line in f:lines() do for line in f:lines() do
lineno = lineno + 1 lineno = lineno + 1
lines[lineno] = line lines[lineno] = line
if line == header then goto continue2 end if line == header then goto continue2 end
if line:match(emmyPattern) or line:match(emmyPattern2) then if not line:match(emmyPattern) then
if doingDescription then
table.insert(descriptions[mod], line:match(emmyPattern) or line:match(emmyPattern2))
end
else
doingDescription = false
if line:match '^function' then if line:match '^function' then
local pattern = (string.format('^function %s%%.', mod) .. '(%w+)') local pattern = (string.format('^function %s%%.', mod) .. '(%w+)')
local funcName = line:match(pattern) local funcName = line:match(pattern)
@ -117,12 +107,7 @@ for iface, dps in pairs(pieces) do
local f <close> = io.open(path, newOrNotNature and 'r+' or 'w+') local f <close> = io.open(path, newOrNotNature and 'r+' or 'w+')
if not newOrNotNature then if not newOrNotNature then
f:write(string.format(header, 'Module', iface, (descriptions[iface] and #descriptions[iface] > 0) and descriptions[iface][1] or 'No description.', docParent)) f:write(string.format(header, 'Module', iface, 'No description.', docParent))
if descriptions[iface] and #descriptions[iface] > 0 then
table.remove(descriptions[iface], 1)
f:write(string.format('\n## Introduction\n%s\n\n', table.concat(descriptions[iface], '\n')))
f:write('## Functions\n')
end
end end
print(f) print(f)

文件差異過大導致無法顯示 Load Diff

查看文件

@ -1,18 +1,12 @@
--- ---
title: Module dirs title: Module dirs
description: internal directory management description: No description.
layout: doc layout: doc
menu: menu:
docs: docs:
parent: "Nature" parent: "Nature"
--- ---
## Introduction
The dirs module defines a small set of functions to store and manage
directories.
## Functions
<hr> <hr>
<div id='setOld'> <div id='setOld'>
<h4 class='heading'> <h4 class='heading'>

查看文件

@ -1,20 +1,12 @@
--- ---
title: Module doc title: Module doc
description: command-line doc rendering description: No description.
layout: doc layout: doc
menu: menu:
docs: docs:
parent: "Nature" parent: "Nature"
--- ---
## Introduction
The doc module contains a small set of functions
used by the Greenhouse pager to render parts of the documentation pages.
This is only documented for the sake of it. It's only intended use
is by the Greenhouse pager.
## Functions
<hr> <hr>
<div id='renderInfoBlock'> <div id='renderInfoBlock'>
<h4 class='heading'> <h4 class='heading'>