mirror of https://github.com/onweru/compose.git

Ray
11.38.2023 fa22efc00a50fbd9758ec39e31cef1d7f8884b89
scoping strikes again

As it turns out, the bkImg had a scoping problem. I ended up with a fair amount of duplicated code because of it.

Removed the debug printf statements and completed the shortcodes.md doc.
4 files modified
18 ■■■■■ changed files
exampleSite/content/docs/compose/shortcodes.md 4 ●●● patch | view | raw | blame | history
exampleSite/go.mod 4 ●●● patch | view | raw | blame | history
exampleSite/go.sum 2 ●●●●● patch | view | raw | blame | history
layouts/shortcodes/liteyoutube.html 8 ●●●● patch | view | raw | blame | history
exampleSite/content/docs/compose/shortcodes.md
@@ -98,7 +98,7 @@
{{< liteyoutube videoid="MmG2ah5Df4g" params="controls=0&start=10&end=30&modestbranding=2&rel=0&enablejsapi=1" >}}
##### With All Three Parameters
##### With All Three Positional Parameters
```markdown
{{</* liteyoutube "MmG2ah5Df4g" "painting.jpg" "controls=0&start=10&end=30&modestbranding=2&rel=0&enablejsapi=1" */>}}
@@ -106,8 +106,6 @@
{{< liteyoutube "MmG2ah5Df4g" "painting.jpg" "controls=0&start=10&end=30&modestbranding=2&rel=0&enablejsapi=1" >}}
{{< liteyoutube videoid="MmG2ah5Df4g" img="painting.jpg" params="controls=0&start=10&end=30&modestbranding=2&rel=0&enablejsapi=1" >}}
{{< tip >}}
You can browse the full list of YouTube parameters [here](https://developers.google.com/youtube/player_parameters#Parameters)
{{< /tip >}}
exampleSite/go.mod
@@ -2,4 +2,6 @@
go 1.15
require github.com/rwstorer/hugo-theme-compose v0.0.0-20230611041900-16c2ce96ef5a // indirect
require (
)
exampleSite/go.sum
@@ -58,3 +58,5 @@
github.com/rwstorer/hugo-theme-compose v0.0.0-20230611040011-726a11f5e7b8/go.mod h1:7TS3BoBV/IcLPRT2r7LyTyOqzsS5P5sXKlNpGgxdK/s=
github.com/rwstorer/hugo-theme-compose v0.0.0-20230611041900-16c2ce96ef5a h1:O5zmkIshvR3RKLwxxDhFOXz1RGvsF23KAv9MrCxBrPc=
github.com/rwstorer/hugo-theme-compose v0.0.0-20230611041900-16c2ce96ef5a/go.mod h1:7TS3BoBV/IcLPRT2r7LyTyOqzsS5P5sXKlNpGgxdK/s=
github.com/rwstorer/hugo-theme-compose v0.0.0-20230611042716-1ae2e3d6a2af h1:XV6rJpiYMEox+r63cdP9ShXR9E2jshhiij1Ftu7I6VI=
github.com/rwstorer/hugo-theme-compose v0.0.0-20230611042716-1ae2e3d6a2af/go.mod h1:7TS3BoBV/IcLPRT2r7LyTyOqzsS5P5sXKlNpGgxdK/s=
layouts/shortcodes/liteyoutube.html
@@ -4,9 +4,7 @@
  {{ $bkImg := "" }}
  {{ $params := .Get "params" }} <!-- not required. List of params here: https://developers.google.com/youtube/player_parameters -->
  {{ with $img }}
    {{ $bkImg := absURL (printf "images/%s" $img) }}
    {{ printf "named img = [%s]" $img }}
    {{ printf "named bkImg = [%s]" $bkImg}}
    {{ $bkImg := absURL (printf "images/%s" .) }}
    <lite-youtube videoid="{{$videoid}}"{{ with $bkImg }} style="background-image: url('{{ . }}')"{{ end }}{{ with $params }} params="{{ . }}"{{ end }}></lite-youtube>
  {{ else }}
    <lite-youtube videoid="{{$videoid}}"{{ with $params }} params="{{ . }}"{{ end }}></lite-youtube>
@@ -17,9 +15,7 @@
  {{- $params := .Get 2 -}} <!-- not required. List of params here: https://developers.google.com/youtube/player_parameters -->
  {{ $bkImg := "" }}
  {{ with $img }}
    {{ $bkImg := absURL (printf "images/%s" $img) }}
    {{ printf "pos img = [%s]" $img }}
    {{ printf "pos bkImg = [%s]" $bkImg}}
    {{ $bkImg := absURL (printf "images/%s" .) }}
    <lite-youtube videoid="{{$videoid}}"{{ with $bkImg }} style="background-image: url('{{ . }}')"{{ end }}{{ with $params }} params="{{ . }}"{{ end }}></lite-youtube>
  {{ else }}
    <lite-youtube videoid="{{$videoid}}"{{ with $params }} params="{{ . }}"{{ end }}></lite-youtube>