From 2276ed8d2a9f69694e3b4086f2cded1dfc8071d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Pablo=20Villaf=C3=A1=C3=B1ez?= Date: Wed, 19 Jan 2022 18:51:16 +0100 Subject: [PATCH] Generate the proto docs in the grpc_apis folder and ignore it from repo --- docs/.gitignore | 1 + protogen/docs/GRPC.tmpl | 16 +++++++++------- protogen/proto/buf.gen.yaml | 5 ++--- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/docs/.gitignore b/docs/.gitignore index 0ad8bbf7e..baf62f090 100644 --- a/docs/.gitignore +++ b/docs/.gitignore @@ -1,2 +1,3 @@ hugo/ +grpc_apis/ mutagen.yml.lock diff --git a/protogen/docs/GRPC.tmpl b/protogen/docs/GRPC.tmpl index ca038092b..e96761c8c 100644 --- a/protogen/docs/GRPC.tmpl +++ b/protogen/docs/GRPC.tmpl @@ -1,9 +1,11 @@ --- -title: "GRPC API" -date: 2018-05-02T00:00:00+00:00 +{{- $package := (index .Files 0).Package }} +title: "{{ $package }}" +url: /grpc_apis/{{ $package }} +date: {{ now | date "2006-01-02T15:04:05Z07:00" }} weight: 50 -geekdocRepo: https://github.com/owncloud/ocis-thumbnails -geekdocEditPath: edit/master/docs +geekdocRepo: https://github.com/owncloud/ocis +geekdocEditPath: edit/master/docs/grpc_apis/{{ $package | replace "." "/" }} geekdocFilePath: grpc.md --- @@ -26,9 +28,9 @@ geekdocFilePath: grpc.md {{ range .Fields -}} {{- $loca := printf "#%s" (.LongType | lower | replace "." "") -}} {{- if and (hasPrefix "ocis." .LongType) (ge (len $filenameParts) 3) -}} - {{- $rep := regexReplaceAll "[^/]+" (slice $filenameParts 1 (sub (len $filenameParts) 1) | join "/") ".." -}} - {{- $fieldDir := dir (.LongType | lower | replace "." "/") -}} - {{- $loca = printf "%s/%s/grpc.md#%s" $rep (substr 5 (len $fieldDir) $fieldDir) (.Type | lower | replace "." "") -}} + {{- $ltypeSpl := .LongType | splitList "." -}} + {{- $ltypePkg := slice $ltypeSpl 0 (sub (len $ltypeSpl) 1) | join "." -}} + {{- $loca = printf "/grpc_apis/%s/#%s" $ltypePkg (.Type | lower) -}} {{- end -}} | {{.Name}} | [{{.LongType}}]({{ $loca }}) | {{.Label}} | {{nobr .Description}}{{if .DefaultValue}} Default: {{.DefaultValue}}{{end }} | {{ end -}} diff --git a/protogen/proto/buf.gen.yaml b/protogen/proto/buf.gen.yaml index e738d4893..0ab33a71f 100644 --- a/protogen/proto/buf.gen.yaml +++ b/protogen/proto/buf.gen.yaml @@ -13,8 +13,7 @@ plugins: - paths=source_relative - name: microweb - #path: ../../.bingo/protoc-gen-microweb - path: ../../../protoc-gen-microweb/protoc-gen-microweb + path: ../../.bingo/protoc-gen-microweb out: ../gen/ opt: - paths=source_relative @@ -30,6 +29,6 @@ plugins: - name: doc path: ../../.bingo/protoc-gen-doc - out: ../docs/extensions + out: ../../docs/grpc_apis opt: - ../docs/GRPC.tmpl,grpc.md,source_relative