From d1b7515722b2867a99d63e35634f3dcae7ef3434 Mon Sep 17 00:00:00 2001 From: TorchedSammy <38820196+TorchedSammy@users.noreply.github.com> Date: Thu, 24 Feb 2022 20:42:54 -0400 Subject: [PATCH] fix(docgen): remove trailing spaces in docs --- cmd/docgen/docgen.go | 6 +++--- docs/bait.txt | 1 - docs/commander.txt | 1 - docs/fs.txt | 1 - docs/hilbish.txt | 3 +-- docs/terminal.txt | 1 - 6 files changed, 4 insertions(+), 9 deletions(-) diff --git a/cmd/docgen/docgen.go b/cmd/docgen/docgen.go index c297bd9..9837e31 100644 --- a/cmd/docgen/docgen.go +++ b/cmd/docgen/docgen.go @@ -52,7 +52,7 @@ func main() { mod := l if strings.HasPrefix(t.Name, "hl") { mod = "hilbish" } if !strings.HasPrefix(t.Name, prefix[mod]) || t.Name == "Loader" { continue } - parts := strings.Split(t.Doc, "\n") + parts := strings.Split(strings.TrimSpace(t.Doc), "\n") funcsig := parts[0] doc := parts[1:] @@ -61,7 +61,7 @@ func main() { for _, t := range p.Types { for _, m := range t.Methods { if !strings.HasPrefix(m.Name, prefix[l]) || m.Name == "Loader" { continue } - parts := strings.Split(m.Doc, "\n") + parts := strings.Split(strings.TrimSpace(m.Doc), "\n") funcsig := parts[0] doc := parts[1:] @@ -73,6 +73,6 @@ func main() { for mod, v := range docs { os.Mkdir("docs", 0777) f, _ := os.Create("docs/" + mod + ".txt") - f.WriteString(strings.Join(v, "\n") + "\n") + f.WriteString(strings.Join(v, "\n\n") + "\n") } } diff --git a/docs/bait.txt b/docs/bait.txt index 9f1e54b..c847680 100644 --- a/docs/bait.txt +++ b/docs/bait.txt @@ -3,4 +3,3 @@ catch(name, cb) > Catches a hook with `name`. Runs the `cb` when it is thrown catchOnce(name, cb) > Same as catch, but only runs the `cb` once and then removes the hook throw(name, ...args) > Throws a hook with `name` with the provided `args` - diff --git a/docs/commander.txt b/docs/commander.txt index 8b4b329..f4688b6 100644 --- a/docs/commander.txt +++ b/docs/commander.txt @@ -1,4 +1,3 @@ deregister(name) > Deregisters any command registered with `name` register(name, cb) > Register a command with `name` that runs `cb` when ran - diff --git a/docs/fs.txt b/docs/fs.txt index 648737e..1d9361a 100644 --- a/docs/fs.txt +++ b/docs/fs.txt @@ -5,4 +5,3 @@ mkdir(name, recursive) > Makes a directory called `name`. If `recursive` is true readdir(dir) > Returns a table of files in `dir` stat(path) > Returns info about `path` - diff --git a/docs/hilbish.txt b/docs/hilbish.txt index 59f0a25..2037631 100644 --- a/docs/hilbish.txt +++ b/docs/hilbish.txt @@ -22,7 +22,7 @@ multiprompt(str) > Changes the continued line prompt to `str` prependPath(dir) > Prepends `dir` to $PATH - prompt(str) > Changes the shell prompt to `str` +prompt(str) > Changes the shell prompt to `str` There are a few verbs that can be used in the prompt text. These will be formatted and replaced with the appropriate values. `%d` - Current working directory @@ -36,4 +36,3 @@ Returns `input`, will be nil if ctrl + d is pressed, or an error occurs (which s run(cmd) > Runs `cmd` in Hilbish's sh interpreter. timeout(cb, time) > Runs the `cb` function after `time` in milliseconds - diff --git a/docs/terminal.txt b/docs/terminal.txt index 80af3f4..8268fe7 100644 --- a/docs/terminal.txt +++ b/docs/terminal.txt @@ -6,4 +6,3 @@ saveState() > Saves the current state of the terminal size() > Gets the dimensions of the terminal. Returns a table with `width` and `height` Note: this is not the size in relation to the dimensions of the display -