imbajin commented on code in PR #472:
URL: https://github.com/apache/hugegraph-doc/pull/472#discussion_r4040398230
##########
scripts/hugo.sh:
##########
@@ -0,0 +1,162 @@
+#!/bin/sh
+set -eu
+
+usage() {
+ printf '%s\n' \
+ "Usage: scripts/hugo.sh server [Hugo arguments...]" \
+ " scripts/hugo.sh build [Hugo arguments...]"
+}
+
+if [ "$#" -eq 0 ]; then
+ usage >&2
+ exit 2
+fi
+
+mode=$1
+shift
+case "$mode" in
+ server|build) ;;
+ *)
+ usage >&2
+ exit 2
+ ;;
+esac
+
+script_dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
+repo_dir=$(dirname "$script_dir")
+cd "$repo_dir"
+
+reject_argument() {
Review Comment:
Fixed in : the wrapper now only sniffs the documented baseURL and port
spellings, forwards other Hugo arguments unchanged, and lets Hugo apply
last-wins semantics as documented. The environment-origin precedence and all
documented baseURL/port spellings are covered by the wrapper tests; the full
Python suite passed 123 tests and the five-version build used Hugo 0.165.0.
##########
layouts/_partials/version-target.html:
##########
@@ -0,0 +1,63 @@
+{{- $p := .page -}}
+{{- $version := .version -}}
+{{- $versionID := $version.version | default ($version.name | urlize) -}}
+{{- $rawURL := $version.url | default "" -}}
+{{- $versionURL := "" -}}
+{{- if $rawURL }}{{ $versionURL = printf "%s/" (strings.TrimSuffix "/"
$rawURL) }}{{ end -}}
+{{- $target := $versionURL -}}
+{{- $equivalent := false -}}
+{{- $fallback := false -}}
+{{- $relative := strings.TrimPrefix "/" $p.RelPermalink -}}
+{{- $locale := $p.Site.Language.Lang -}}
+{{- $docsPrefix := cond (eq $locale "cn") "cn/docs/" "docs/" -}}
+{{- $docsSuffix := cond (eq $locale "cn") "/cn/docs" "/docs" -}}
+{{- $root := strings.TrimSuffix $docsSuffix (strings.TrimSuffix "/"
$versionURL) -}}
+{{- if and $rawURL (strings.HasPrefix $relative $docsPrefix) -}}
+ {{- $pages := hugo.Data.version_routes.pages | default dict -}}
Review Comment:
Fixed in : route-map reverse lookup is cached in the page Store and the scan
stops at the first match. After syncing the latest Apache master, the route map
was regenerated for 213 logical routes; the final aggregate passed across 5
versions and 1,108 HTML files, including version-switch contract validation.
##########
tests/e2e/workflow-contract.test.cjs:
##########
@@ -0,0 +1,88 @@
+const assert = require("node:assert/strict");
+const fs = require("node:fs");
+const path = require("node:path");
+const test = require("node:test");
+
+const workflow = fs.readFileSync(
+ path.resolve(__dirname, "../../.github/workflows/hugo.yml"),
+ "utf8"
+);
+const versionManifest = JSON.parse(
+ fs.readFileSync(path.resolve(__dirname, "../../versions.json"), "utf8")
+);
+
+test("each build fetches and verifies its immutable matrix SHA", () => {
Review Comment:
Fixed in , with the final branch further tightening the contract in : the
test now scopes permission parsing to workflow jobs, preserves , and rejects
any other scope or . The final Node UI/AI/workflow suite passed 24/24; the
current YAML has only .
##########
layouts/_partials/hooks/body-end.html:
##########
@@ -0,0 +1,54 @@
+{{- $basePath := (urls.Parse .Site.BaseURL).Path | default "/" -}}
+{{- $localePrefix := cond (eq .Site.Language.Lang "cn") "cn/" "" -}}
+{{- $docsRoot := printf "%s%sdocs/" $basePath $localePrefix -}}
+{{- $fallbackMessage := "" -}}
+{{- if eq .Site.Language.Lang "cn" -}}
+ {{- $fallbackMessage = "目标版本没有此页面,已转到该版本的文档首页。" -}}
+{{- else -}}
+ {{- $fallbackMessage = T "ui_version_fallback" -}}
+{{- end -}}
+{{- $shellConfig := dict
+ "version" (.Site.Params.version | default "latest")
+ "locale" .Site.Language.Lang
+ "docsRoot" $docsRoot
+ "versionFallbackMessage" $fallbackMessage
+-}}
+<script type="application/json" id="hg-shell-config">{{ $shellConfig | jsonify
| safeJS }}</script>
+{{- $shell := resources.Get "js/hugegraph-shell.js" -}}
+{{- if hugo.IsProduction }}{{ $shell = $shell | minify | fingerprint }}{{ end
}}
+<script src="{{ $shell.RelPermalink }}"
+ {{- with $shell.Data.Integrity }} integrity="{{ . }}"
crossorigin="anonymous"{{ end }}></script>
+
+{{- $ai := partial "ai/config.html" . -}}
+{{- if $ai.enabled -}}
+ {{- $lang := .Site.Language.Lang -}}
+ {{- $sourceGroup := index $ai.sourceGroups $lang -}}
+ {{- $themeColor := index .Site.Params.ui "theme_color" -}}
+ {{- $historical := ne (.Site.Params.version | default "latest") "latest" -}}
+ {{- $labels := cond (eq $lang "cn")
Review Comment:
Fixed in : the Ask AI labels and version fallback now use lookups, with the
Chinese catalogue renamed to to match . English and Chinese rendered output
was checked directly, and the final five-version aggregate passed its
localization and output validation.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]