58160ca8c0
Extracts and separately renders browser version information. `IE 11` will be transformed to `IE` and `11`, the version is matched from the right side using a regex `[0-9]+$` and the browser name is matched from the left side using `^[a-zA-Z ]+` Removed some code duplication.
29 lines
980 B
HTML
29 lines
980 B
HTML
{{ $tested := replace (.Get "using") ", " "," }}
|
|
{{ $tested := replace $tested " + " "+" }}
|
|
{{ $tested := split $tested "," }}
|
|
<table class="tested">
|
|
<tr>
|
|
<th scope="row">
|
|
<svg viewBox="0 0 177.16535 177.16535" focusable="false" aria-hidden="true">
|
|
<use xlink:href="#tick"></use>
|
|
</svg>
|
|
Tested using
|
|
</th>
|
|
{{ range $tested }}
|
|
<td>
|
|
{{ $browser := findRE "^[a-zA-Z ]+" . }}
|
|
{{ $browser := index $browser 0 }}
|
|
{{ $version := findRE "[0-9]+$" . }}
|
|
{{ $slug := replace $browser " " "-" | lower }}
|
|
<img src="{{ (printf "images/browser-%s" $slug) | absURL }}.svg" alt="">
|
|
<span><strong>{{ $browser }} {{ index $version 0 }}</strong></span>
|
|
{{ if in . "+" }}
|
|
{{ $parts := split . "+" }}
|
|
{{ $additional := index $parts 1 }}
|
|
<span class="additional">with <strong>{{ $additional }}</strong></span>
|
|
{{ end }}
|
|
</td>
|
|
{{ end }}
|
|
</tr>
|
|
</table>
|