diff options
-rw-r--r-- | exampleSite/config.yml | 1 | ||||
-rw-r--r-- | layouts/_default/list.svg | 44 | ||||
-rw-r--r-- | layouts/affected/list.json | 2 | ||||
-rw-r--r-- | layouts/index.json | 2 | ||||
-rw-r--r-- | layouts/partials/js.html | 2 | ||||
-rw-r--r-- | layouts/partials/meta.html | 2 |
6 files changed, 49 insertions, 4 deletions
diff --git a/exampleSite/config.yml b/exampleSite/config.yml index 5baf09c..b270320 100644 --- a/exampleSite/config.yml +++ b/exampleSite/config.yml @@ -402,6 +402,7 @@ outputs: - html - json - rss + - svg outputFormats: svg: diff --git a/layouts/_default/list.svg b/layouts/_default/list.svg new file mode 100644 index 0000000..73b480f --- /dev/null +++ b/layouts/_default/list.svg @@ -0,0 +1,44 @@ +{{ $incidents := where .RegularPages "Params.section" "issue" -}} +{{ $active := where $incidents "Params.resolved" "=" false -}} +{{ $isNotice := where $active "Params.severity" "=" "notice" -}} +{{ $isDisrupted := where $active "Params.severity" "=" "disrupted" -}} +{{ $isDown := where $active "Params.severity" "=" "down" -}} +{{ $shield_prefix := .Title -}} +{{ $status_text := T "thisIsOk" -}} +{{ $status_color := .Site.Params.ok -}} +{{ if $isDown -}} + {{ $status_text = T "thisIsDown" -}} + {{ $status_color = .Site.Params.down -}} +{{ else if $isDisrupted -}} + {{ $status_text = T "thisIsDisrupted" -}} + {{ $status_color = .Site.Params.disrupted -}} +{{ else if $isNotice -}} + {{ $status_text = T "thisIsNotice" -}} + {{ $status_color = .Site.Params.notice -}} +{{ end -}} +{{ $text_padding := 1 -}} +{{ $left_text_lenght := $shield_prefix | strings.RuneCount -}} +{{ $right_text_length := $status_text | strings.RuneCount -}} +{{ $left_text_padding := $text_padding -}} +{{ $right_box_padding := add (mul $text_padding 2) $left_text_lenght -}} +{{ $right_text_padding := add $right_box_padding $text_padding -}} +{{ $total_width := add (mul $text_padding 4) (add $left_text_lenght $right_text_length) -}} +<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" height="2em" width="{{ $total_width }}ex" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11"> + <linearGradient id="b" x2="0" y2="100%"> + <stop offset="0" stop-color="#bbb" stop-opacity=".1"/> + <stop offset="1" stop-opacity=".1"/> + </linearGradient> + <clipPath id="a"> + <rect width="100%" height="100%" rx="3" fill="#fff"/> + </clipPath> + <g clip-path="url(#a)" fill="#fff" > + <rect x="0" y="0" width="100%" height="100%" fill="#555" /> + <rect x="{{ $right_box_padding }}ex" y="0" height="100%" width="100%" fill="{{ $status_color }}"/> + <rect x="0" y="0" width="100%" height="100%" fill="url(#b)"/> + + <text x="{{ $left_text_padding }}ex" y="15" fill="#010101" fill-opacity=".3">{{ $shield_prefix }}</text> + <text x="{{ $left_text_padding }}ex" y="14">{{ $shield_prefix }}</text> + <text x="{{ $right_text_padding }}ex" y="15" fill="#010101" fill-opacity=".3">{{ $status_text }}</text> + <text x="{{ $right_text_padding }}ex" y="14">{{ $status_text }}</text> + </g> +</svg> diff --git a/layouts/affected/list.json b/layouts/affected/list.json index 1fde8d1..98b8b92 100644 --- a/layouts/affected/list.json +++ b/layouts/affected/list.json @@ -28,7 +28,7 @@ "summary": {{ jsonify .Summary }} } {{ end }}{{ end }} - ], + ] } diff --git a/layouts/index.json b/layouts/index.json index 82c9466..2a11077 100644 --- a/layouts/index.json +++ b/layouts/index.json @@ -1,6 +1,6 @@ {{ $incidents := where .Site.RegularPages "Params.section" "issue" }}{{ $active := where $incidents "Params.resolved" "=" false }}{{ $isNotice := where $active "Params.severity" "=" "notice" }}{{ $isDisrupted := where $active "Params.severity" "=" "disrupted" }}{{ $isDown := where $active "Params.severity" "=" "down" }}{ "is": "index", - "cStateVersion": "5.0.5", + "cStateVersion": "5.1", "apiVersion": "2.0", "title": "{{ .Site.Title }}", "languageCodeHTML": "{{ .Site.LanguageCode }}", diff --git a/layouts/partials/js.html b/layouts/partials/js.html index c866f2b..e11de17 100644 --- a/layouts/partials/js.html +++ b/layouts/partials/js.html @@ -3,7 +3,7 @@ * Dev toolset */ - console.log('cState v5.0.5 - https://github.com/cstate/cstate'); + console.log('cState v5.1 - https://github.com/cstate/cstate'); document.getElementsByTagName('html')[0].className = 'js'; /** diff --git a/layouts/partials/meta.html b/layouts/partials/meta.html index 5c0df56..4e7d06e 100644 --- a/layouts/partials/meta.html +++ b/layouts/partials/meta.html @@ -12,7 +12,7 @@ {{ range .AlternativeOutputFormats -}} {{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }} {{ end -}} - <meta name="generator" content="cState v5.0.5 - https://github.com/cstate/cstate"> + <meta name="generator" content="cState v5.1 - https://github.com/cstate/cstate"> <meta name="theme-color" content="{{ .Site.Params.brand }}"> <script> var themeBrandColor = '{{ .Site.Params.brand }}'; |