From 04aff00798ac70edb5d508406db484a51759dc44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Marohni=C4=87?= Date: Fri, 31 Jan 2020 15:35:57 +0100 Subject: [PATCH] Update `make site-docs` to reflect latest setup - Man pages are now placed under `/manual/` - Use Jekyll `permalink` to avoid the `.html` extension - Strip "SEE ALSO" and everything after it --- Makefile | 8 +++++--- cmd/gen-docs/main.go | 4 +++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 00b171858..be2483cdc 100644 --- a/Makefile +++ b/Makefile @@ -21,9 +21,11 @@ site: site-docs: site git -C site pull - git -C site rm 'gh*.md' 2>/dev/null || true - go run ./cmd/gen-docs site - git -C site add 'gh*.md' + git -C site rm 'manual/gh*.md' 2>/dev/null || true + go run ./cmd/gen-docs site/manual + for f in site/manual/gh*.md; do sed -i.bak -e '/^### SEE ALSO/,$$d' "$$f"; done + rm -f site/manual/*.bak + git -C site add 'manual/gh*.md' git -C site commit -m 'update help docs' git -C site push .PHONY: site-docs diff --git a/cmd/gen-docs/main.go b/cmd/gen-docs/main.go index 943c36323..5369d9670 100644 --- a/cmd/gen-docs/main.go +++ b/cmd/gen-docs/main.go @@ -3,6 +3,7 @@ package main import ( "fmt" "os" + "strings" "github.com/cli/cli/command" "github.com/spf13/cobra/doc" @@ -28,13 +29,14 @@ func main() { func filePrepender(filename string) string { return `--- layout: page +permalink: /:path/:basename --- ` } func linkHandler(name string) string { - return fmt.Sprintf("{{site.baseurl}}{%% link %s %%}", name) + return fmt.Sprintf("./%s", strings.TrimSuffix(name, ".md")) } func fatal(msg interface{}) {