From 726082ba032309b80b27d8ba63ea0a215f7cae91 Mon Sep 17 00:00:00 2001 From: sammyette Date: Sat, 9 Sep 2023 13:38:54 -0400 Subject: [PATCH] docs: fix duplicate functions header --- cmd/docgen/docgen.go | 6 +++++- docs/api/bait.md | 1 - docs/api/commander.md | 1 - docs/api/fs.md | 1 - docs/api/hilbish/_index.md | 1 - docs/api/hilbish/hilbish.aliases.md | 1 - docs/api/hilbish/hilbish.completions.md | 1 - docs/api/hilbish/hilbish.editor.md | 1 - docs/api/hilbish/hilbish.history.md | 1 - docs/api/hilbish/hilbish.jobs.md | 1 - docs/api/hilbish/hilbish.runner.md | 1 - docs/api/hilbish/hilbish.timers.md | 1 - docs/api/terminal.md | 1 - 13 files changed, 5 insertions(+), 13 deletions(-) diff --git a/cmd/docgen/docgen.go b/cmd/docgen/docgen.go index 8598091..487af9f 100644 --- a/cmd/docgen/docgen.go +++ b/cmd/docgen/docgen.go @@ -435,6 +435,7 @@ func main() { if modu.ParentModule != "" { modOrIface = "Module" } + lastHeader := "" f, _ := os.Create(docPath) f.WriteString(fmt.Sprintf(header, modOrIface, modname, modu.ShortDescription)) @@ -460,6 +461,7 @@ func main() { } f.WriteString("## Functions\n") + lastHeader = "functions" mdTable := md.NewTable(funcCount, 2) mdTable.SetTitle(0, "") @@ -511,7 +513,9 @@ func main() { } if len(modu.Docs) != 0 { - f.WriteString("## Functions\n") + if lastHeader != "functions" { + f.WriteString("## Functions\n") + } for _, dps := range modu.Docs { if dps.IsMember { continue diff --git a/docs/api/bait.md b/docs/api/bait.md index 468648f..91cfb31 100644 --- a/docs/api/bait.md +++ b/docs/api/bait.md @@ -41,7 +41,6 @@ this function will set the user prompt. |release(name, catcher)|Removes the `catcher` for the event with `name`.| |throw(name, ...args)|Throws a hook with `name` with the provided `args`| -## Functions

bait.catch(name, cb) diff --git a/docs/api/commander.md b/docs/api/commander.md index 20117af..4d67c81 100644 --- a/docs/api/commander.md +++ b/docs/api/commander.md @@ -43,7 +43,6 @@ name would suggest. |deregister(name)|Deregisters any command registered with `name`| |register(name, cb)|Register a command with `name` that runs `cb` when ran| -## Functions

commander.deregister(name) diff --git a/docs/api/fs.md b/docs/api/fs.md index fff8877..37045eb 100644 --- a/docs/api/fs.md +++ b/docs/api/fs.md @@ -25,7 +25,6 @@ I/O and filesystem functions. |readdir(dir) -> {}|Returns a table of files in `dir`.| |stat(path) -> {}|Returns a table of info about the `path`.| -## Functions

fs.abs(path) -> string diff --git a/docs/api/hilbish/_index.md b/docs/api/hilbish/_index.md index 3bfb92b..36e6413 100644 --- a/docs/api/hilbish/_index.md +++ b/docs/api/hilbish/_index.md @@ -46,7 +46,6 @@ interfaces and functions which directly relate to shell functionality. |vimMode|Current Vim input mode of Hilbish (will be nil if not in Vim input mode)| |exitCode|xit code of the last executed command| -## Functions

hilbish.alias(cmd, orig) diff --git a/docs/api/hilbish/hilbish.aliases.md b/docs/api/hilbish/hilbish.aliases.md index b5d27a2..5274e04 100644 --- a/docs/api/hilbish/hilbish.aliases.md +++ b/docs/api/hilbish/hilbish.aliases.md @@ -18,7 +18,6 @@ The alias interface deals with all command aliases in Hilbish. |list() -> table|Get a table of all aliases, with string keys as the alias and the value as the command.| |resolve(alias) -> command (string)|Tries to resolve an alias to its command.| -## Functions

hilbish.aliases.add(alias, cmd) diff --git a/docs/api/hilbish/hilbish.completions.md b/docs/api/hilbish/hilbish.completions.md index 698140d..790aeee 100644 --- a/docs/api/hilbish/hilbish.completions.md +++ b/docs/api/hilbish/hilbish.completions.md @@ -18,7 +18,6 @@ The completions interface deals with tab completions. |bins(query, ctx, fields) -> entries (table), prefix (string)|Returns binary/executale completion candidates based on the provided query.| |files(query, ctx, fields) -> entries (table), prefix (string)|Returns file completion candidates based on the provided query.| -## Functions

hilbish.completions.call(name, query, ctx, fields) -> completionGroups (table), prefix (string) diff --git a/docs/api/hilbish/hilbish.editor.md b/docs/api/hilbish/hilbish.editor.md index ee55580..282737d 100644 --- a/docs/api/hilbish/hilbish.editor.md +++ b/docs/api/hilbish/hilbish.editor.md @@ -19,7 +19,6 @@ directly interact with the line editor in use. |insert(text)|Inserts text into the line.| |setVimRegister(register, text)|Sets the vim register at `register` to hold the passed text.| -## Functions

hilbish.editor.getLine() -> string diff --git a/docs/api/hilbish/hilbish.history.md b/docs/api/hilbish/hilbish.history.md index dee087a..3d9b856 100644 --- a/docs/api/hilbish/hilbish.history.md +++ b/docs/api/hilbish/hilbish.history.md @@ -21,7 +21,6 @@ method of saving history. |get(idx)|Retrieves a command from the history based on the `idx`.| |size() -> number|Returns the amount of commands in the history.| -## Functions

hilbish.history.add(cmd) diff --git a/docs/api/hilbish/hilbish.jobs.md b/docs/api/hilbish/hilbish.jobs.md index 290fe6f..bb1af1e 100644 --- a/docs/api/hilbish/hilbish.jobs.md +++ b/docs/api/hilbish/hilbish.jobs.md @@ -23,7 +23,6 @@ interactive usage or with the functions defined below for use in external runner |get(id) -> @Job|Get a job object via its ID.| |last() -> @Job|Returns the last added job from the table.| -## Functions

hilbish.jobs.add(cmdstr, args, execPath) diff --git a/docs/api/hilbish/hilbish.runner.md b/docs/api/hilbish/hilbish.runner.md index 98e8f6c..5528195 100644 --- a/docs/api/hilbish/hilbish.runner.md +++ b/docs/api/hilbish/hilbish.runner.md @@ -21,7 +21,6 @@ write command in Fennel. |lua(cmd)|Evaluates `cmd` as Lua input. This is the same as using `dofile`| |sh(cmd)|Runs a command in Hilbish's shell script interpreter.| -## Functions

hilbish.runner.setMode(cb) diff --git a/docs/api/hilbish/hilbish.timers.md b/docs/api/hilbish/hilbish.timers.md index f996bb4..dae7782 100644 --- a/docs/api/hilbish/hilbish.timers.md +++ b/docs/api/hilbish/hilbish.timers.md @@ -42,7 +42,6 @@ print(t.running) // true |INTERVAL|Constant for an interval timer type| |TIMEOUT|Constant for a timeout timer type| -## Functions

hilbish.timers.create(type, time, callback) -> Timer diff --git a/docs/api/terminal.md b/docs/api/terminal.md index c5cb5ea..4977e97 100644 --- a/docs/api/terminal.md +++ b/docs/api/terminal.md @@ -18,7 +18,6 @@ The terminal library is a simple and lower level library for certain terminal in |setRaw()|Puts the terminal in raw mode| |size()|Gets the dimensions of the terminal. Returns a table with `width` and `height`| -## Functions

terminal.restoreState()