From f4a0656ab1fb2899294eaa3d977f9f75eb0db8d0 Mon Sep 17 00:00:00 2001 From: Martin Taillefer Date: Fri, 13 Jul 2018 07:26:36 -0700 Subject: [PATCH] Add a lint check for incorrectly indented code blocks. (#1800) Fixed a problem reported by the link check. --- .../docs/concepts/security/rbac/index.md | 2 +- .../fault-injection/index.md | 64 +++++++++---------- scripts/lint_site.sh | 7 ++ 3 files changed, 40 insertions(+), 33 deletions(-) diff --git a/content_zh/docs/concepts/security/rbac/index.md b/content_zh/docs/concepts/security/rbac/index.md index 9796ca6478..687ffbfa9b 100644 --- a/content_zh/docs/concepts/security/rbac/index.md +++ b/content_zh/docs/concepts/security/rbac/index.md @@ -30,7 +30,7 @@ Istio 的 RBAC 引擎做了下面两件事: ### 请求上下文 -在当前版本中,Istio RBAC 引擎被实现为一个 [Mixer 适配器](/docs/concepts/policies-and-telemetry/#adapter)。请求上下文则作为[授权模板](https://github.com/istio/istio/blob/master/mixer/template/authorization/template.proto)的实例。请求上下文包含请求和授权模块需要环境的所有信息。特别是两个部分: +在当前版本中,Istio RBAC 引擎被实现为一个 [Mixer 适配器](/docs/concepts/policies-and-telemetry/#adapters)。请求上下文则作为[授权模板](https://github.com/istio/istio/blob/master/mixer/template/authorization/template.proto)的实例。请求上下文包含请求和授权模块需要环境的所有信息。特别是两个部分: * 主题 包含调用者标识的属性列表,包括`"user"` name/ID,主题属于`“group”`,或者关于主题的任意附加属性,比如命名空间、服务名称。 diff --git a/content_zh/docs/tasks/traffic-management/fault-injection/index.md b/content_zh/docs/tasks/traffic-management/fault-injection/index.md index f654a3a662..30307f82b6 100644 --- a/content_zh/docs/tasks/traffic-management/fault-injection/index.md +++ b/content_zh/docs/tasks/traffic-management/fault-injection/index.md @@ -100,40 +100,40 @@ Istio 的故障注入规则可帮助您识别此类异常,而不会影响最 1. 为用户 “jason” 创建故障注入规则发送 HTTP 中止 - {{< text bash >}} - $ istioctl replace -f @samples/bookinfo/networking/virtual-service-ratings-test-abort.yaml@ - {{< /text >}} + {{< text bash >}} + $ istioctl replace -f @samples/bookinfo/networking/virtual-service-ratings-test-abort.yaml@ + {{< /text >}} - 确认已创建规则 + 确认已创建规则 - {{< text bash yaml >}} - $ istioctl get virtualservice ratings -o yaml - apiVersion: networking.istio.io/v1alpha3 - kind: VirtualService - metadata: - name: ratings - ... - spec: - hosts: - - ratings - http: - - fault: - abort: - httpStatus: 500 - percent: 100 - match: - - headers: - cookie: - regex: ^(.*?;)?(user=jason)(;.*)?$ - route: - - destination: - host: ratings - subset: v1 - - route: - - destination: - host: ratings - subset: v1 - {{< /text >}} + {{< text bash yaml >}} + $ istioctl get virtualservice ratings -o yaml + apiVersion: networking.istio.io/v1alpha3 + kind: VirtualService + metadata: + name: ratings + ... + spec: + hosts: + - ratings + http: + - fault: + abort: + httpStatus: 500 + percent: 100 + match: + - headers: + cookie: + regex: ^(.*?;)?(user=jason)(;.*)?$ + route: + - destination: + host: ratings + subset: v1 + - route: + - destination: + host: ratings + subset: v1 + {{< /text >}} 1. 观察应用程序行为 diff --git a/scripts/lint_site.sh b/scripts/lint_site.sh index cdb367655c..d09d1a4356 100755 --- a/scripts/lint_site.sh +++ b/scripts/lint_site.sh @@ -56,6 +56,13 @@ check_content() { check_content content --en-us check_content content_zh --zh-cn +grep -nr -e "ERROR: markdown" ./public +if [ "$?" == "0" ] +then + echo "Ensure text blocks are either not indented, or indented by a multiple of 4 spaces" + FAILED=1 +fi + htmlproofer ./public --check-html --assume-extension --timeframe 2d --storage-dir .htmlproofer --url-ignore "/localhost/,/github.com/istio/istio.github.io/edit/master/,/github.com/istio/istio/issues/new/choose/" if [ "$?" != "0" ] then