Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
{{- /*
2
  Usage: `placeholder args`
3
 
4
  `args` are all optional and can be one of the following:
5
    * title: Used in the SVG `title` tag - default: "Placeholder"
6
    * text: The text to show in the image - default: "width x height"
7
    * class: Class to add to the `svg` - default: "bd-placeholder-img"
8
    * color: The text color (foreground) - default: "#dee2e6"
9
    * background: The background color - default: "#868e96"
10
    * width: default: "100%"
11
    * height: default: "180px"
12
*/ -}}
13
 
14
{{- $grays := $.Site.Data.grays -}}
15
{{- $default_color := (index $grays 2).hex -}}
16
{{- $default_background := (index $grays 5).hex -}}
17
 
18
{{- $title := .Get "title" | default "Placeholder" -}}
19
{{- $class := .Get "class" -}}
20
{{- $color := .Get "color" | default $default_color -}}
21
{{- $background := .Get "background" | default $default_background -}}
22
{{- $width := .Get "width" | default "100%" -}}
23
{{- $height := .Get "height" | default "180" -}}
24
{{- $text := .Get "text" | default (printf "%sx%s" $width $height) -}}
25
 
26
{{- $show_title := not (eq $title "false") -}}
27
{{- $show_text := not (eq $text "false") -}}
28
 
29
<svg class="bd-placeholder-img{{ with $class }} {{ . }}{{ end }}" width="{{ $width }}" height="{{ $height }}" xmlns="http://www.w3.org/2000/svg"{{ if (or $show_title $show_text) }} role="img" aria-label="{{ if $show_title }}{{ $title }}{{ if $show_text }}: {{ end }}{{ end }}{{ if ($show_text) }}{{ $text }}{{ end }}"{{ else }} aria-hidden="true"{{ end }} preserveAspectRatio="xMidYMid slice" focusable="false">
30
  {{- if $show_title }}<title>{{ $title }}</title>{{ end -}}
31
  <rect width="100%" height="100%" fill="{{ $background }}"/>
32
  {{- if $show_text }}<text x="50%" y="50%" fill="{{ $color }}" dy=".3em">{{ $text }}</text>{{ end -}}
33
</svg>