From 495e8286bc664903fcb38467f90db44e222c45b5 Mon Sep 17 00:00:00 2001 From: Cell <1024@lruihao.cn> Date: Wed, 20 Jul 2022 17:55:22 +0800 Subject: [PATCH] :alembic: Chore: preprocessing developer options --- exampleSite/config.toml | 1 - layouts/partials/init/detection-env.html | 12 +++++++++--- layouts/partials/init/detection-version.html | 5 ++--- layouts/partials/init/index.html | 4 ++-- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/exampleSite/config.toml b/exampleSite/config.toml index bcd67c9c..5ef06551 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -1166,7 +1166,6 @@ enableEmoji = true # Developer options since v0.2.15 # 开发者选项 since v0.2.15 [params.dev] - # TODO 提前处理 如果 dev.enable = false 那其他值全部清空,避免后续使用时判断条件过多 enable = false # Check for updates # 检查更新 diff --git a/layouts/partials/init/detection-env.html b/layouts/partials/init/detection-env.html index 2ace279f..43d69d58 100644 --- a/layouts/partials/init/detection-env.html +++ b/layouts/partials/init/detection-env.html @@ -21,6 +21,12 @@ {{- else if eq .Params.comment false -}} {{- .Scratch.Set "comment" dict -}} {{- end -}} -{{- else if eq .Site .Sites.First -}} - {{- warnf "FixIt %v\n%v\n\n" (.Scratch.Get "version") (T "devEnvWarn") -}} -{{- end -}} \ No newline at end of file +{{- else -}} + {{- .Scratch.Set "devOpts" .Site.Params.dev -}} + {{- if ne .Site.Params.dev.enable true -}} + {{- .Scratch.Set "devOpts" dict -}} + {{- end -}} + {{- if eq .Site .Sites.First -}} + {{- warnf "FixIt %v\n%v\n\n" (.Scratch.Get "version") (T "devEnvWarn") -}} + {{- end -}} +{{- end -}} diff --git a/layouts/partials/init/detection-version.html b/layouts/partials/init/detection-version.html index f4d58091..95bf5d8a 100644 --- a/layouts/partials/init/detection-version.html +++ b/layouts/partials/init/detection-version.html @@ -1,9 +1,9 @@ -{{- $version := "v0.2.15-RC" -}} +{{- $version := .Scratch.Get "version" -}} {{- $latest := $version -}} {{- $devOpts := .Scratch.Get "devOpts" -}} {{- /* Check for updates */ -}} -{{- if $devOpts.enable | and $devOpts.c4u -}} +{{- if $devOpts.c4u -}} {{- /* Select the scope named "public_repo" to generate personal access token */ -}} {{- $header := dict "Authorization" "" -}} {{- with $devOpts.githubtoken -}} @@ -27,5 +27,4 @@ {{- end -}} {{- end -}} -{{- .Scratch.Set "version" $version -}} {{- .Scratch.Set "latest" $latest -}} \ No newline at end of file diff --git a/layouts/partials/init/index.html b/layouts/partials/init/index.html index d5ff57fe..f7971d44 100644 --- a/layouts/partials/init/index.html +++ b/layouts/partials/init/index.html @@ -1,9 +1,9 @@ +{{- .Scratch.Set "version" "v0.2.15-RC" -}} {{- .Scratch.Set "params" (.Params | merge .Site.Params.page) -}} -{{- .Scratch.Set "devOpts" (.Site.Params.dev | default dict) -}} {{- .Scratch.Set "this" dict -}} -{{- partial "init/detection-version.html" . -}} {{- partial "init/detection-env.html" . -}} +{{- partial "init/detection-version.html" . -}} {{- partial "init/detection-deprecated.html" . -}} {{- partial "init/patch.html" . -}}