From a43e6f7a6a7875383dded97299263dc0b189ba92 Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Sat, 11 Jan 2025 17:11:49 +0100 Subject: [PATCH] docs: docsgen theme and linkd for proto (#571) theme for #557 --------- Signed-off-by: Jan Kowalleck --- docgen/json/templates/cyclonedx/base.html | 5 + docgen/proto/gen.sh | 11 +- docgen/proto/templates/html.tmpl | 161 +++++++++++++++++++--- docgen/xml/xs3p.xsl | 5 + 4 files changed, 163 insertions(+), 19 deletions(-) diff --git a/docgen/json/templates/cyclonedx/base.html b/docgen/json/templates/cyclonedx/base.html index dfbba7c5..1e8b62d5 100644 --- a/docgen/json/templates/cyclonedx/base.html +++ b/docgen/json/templates/cyclonedx/base.html @@ -53,6 +53,11 @@
  • v1.2 (XML)
  • v1.1 (XML)
  • v1.0 (XML)
  • +
  • +
  • v1.6 (Protobuf)
  • +
  • v1.5 (Protobuf)
  • +
  • v1.4 (Protobuf)
  • +
  • v1.3 (Protobuf)
  • diff --git a/docgen/proto/gen.sh b/docgen/proto/gen.sh index 50b18949..5d7a38e7 100755 --- a/docgen/proto/gen.sh +++ b/docgen/proto/gen.sh @@ -14,10 +14,11 @@ rm -f -R "$DOCS_PATH" generate () { version="$1" - title="CycloneDX v$version Proto Reference" + title="CycloneDX v$version Protobuf Reference" echo "Generating: $title" - OUT_DIR="$DOCS_PATH/$version/proto/" + OUT_DIR="$DOCS_PATH/$version/proto" + OUT_FILE="index.html" mkdir -p "$OUT_DIR" ## docs: https://github.com/pseudomuto/protoc-gen-doc @@ -26,7 +27,7 @@ generate () { -v "${SCHEMA_PATH}:/protos:ro" \ -v "${TEMPLATES_PATH}:/templates:ro" \ "pseudomuto/protoc-gen-doc:${PROTOC_GEN_DOC_VERSION}" \ - --doc_opt=/templates/html.tmpl,index.html \ + --doc_opt=/templates/html.tmpl,"$OUT_FILE" \ "bom-${version}.proto" # fix file permissions @@ -35,6 +36,10 @@ generate () { --entrypoint chown \ "pseudomuto/protoc-gen-doc:${PROTOC_GEN_DOC_VERSION}" \ "$(id -u):$(id -g)" -R /out + + sed -i -e "s/\${quotedTitle}/\"$title\"/g" "$OUT_DIR/$OUT_FILE" + sed -i -e "s/\${title}/$title/g" "$OUT_DIR/$OUT_FILE" + sed -i -e "s/\${version}/$version/g" "$OUT_DIR/$OUT_FILE" } generate 1.3 diff --git a/docgen/proto/templates/html.tmpl b/docgen/proto/templates/html.tmpl index fca1e303..5e2682c9 100644 --- a/docgen/proto/templates/html.tmpl +++ b/docgen/proto/templates/html.tmpl @@ -7,17 +7,31 @@ https://github.com/pseudomuto/protoc-gen-doc/blob/master/resources/html.tmpl */}} - Protocol Documentation - - + ${title} + + + + + + + + + + + + + + + + + + + + + - - - + -

    Protocol Documentation

    + +
    + +

    ${title}

    Table of Contents

    @@ -179,8 +304,9 @@ https://github.com/pseudomuto/protoc-gen-doc/blob/master/resources/html.tmpl
      {{range .Files}} {{$file_name := .Name}} + {{$file_package := .Package}}
    • - {{.Name}} + Package: {{.Package}}
        {{range .Messages}}
      • @@ -211,8 +337,9 @@ https://github.com/pseudomuto/protoc-gen-doc/blob/master/resources/html.tmpl {{range .Files}} {{$file_name := .Name}} + {{$file_package := .Package}}
        -

        {{.Name}}

        Top +

        Package: {{.Package}}

        Top
        {{p .Description}} @@ -437,5 +564,7 @@ https://github.com/pseudomuto/protoc-gen-doc/blob/master/resources/html.tmpl {{end}} + +
    diff --git a/docgen/xml/xs3p.xsl b/docgen/xml/xs3p.xsl index 65e2275f..9c4ace94 100644 --- a/docgen/xml/xs3p.xsl +++ b/docgen/xml/xs3p.xsl @@ -353,6 +353,11 @@
  • v1.2 (XML)
  • v1.1 (XML)
  • v1.0 (XML)
  • +
  • +
  • v1.6 (Protobuf)
  • +
  • v1.5 (Protobuf)
  • +
  • v1.4 (Protobuf)
  • +
  • v1.3 (Protobuf)