shortcodes: avoid superflous margin at start and end of content #558

This commit is contained in:
Sören Weber 2023-06-05 00:24:14 +02:00
parent 30b23b9213
commit 5ca1c4c5f0
No known key found for this signature in database
GPG key ID: BEC6D55545451B6D
4 changed files with 9 additions and 2 deletions

View file

@ -16,6 +16,7 @@
{{ $title | .RenderString }} {{ $title | .RenderString }}
</label> </label>
<div id="expandcontent-{{ $id }}" class="expand-content"> <div id="expandcontent-{{ $id }}" class="expand-content">
{{ if ne "<" (substr (strings.TrimLeft " " $content) 0 1) }}<p>{{ end }}<!-- we add a DOM element here if there is none to make collapsing marings work -->
{{ $content | safeHTML }}</div><!-- no line break allowed here because of awkward behavior of Hugo 110 or this theme when tag shortcode is called standalone outside of tags shortcode ? --> {{ $content | safeHTML }}</div><!-- no line break allowed here because of awkward behavior of Hugo 110 or this theme when tag shortcode is called standalone outside of tags shortcode ? -->
</div> </div>
{{- end }} {{- end }}

View file

@ -19,6 +19,7 @@
<div class="box notices cstyle {{ $style }}"{{ if $color }} style="--VARIABLE-BOX-color: {{ $color }};"{{ end }}> <div class="box notices cstyle {{ $style }}"{{ if $color }} style="--VARIABLE-BOX-color: {{ $color }};"{{ end }}>
<div class="box-label">{{ if $icon }}<i class="{{ $icon }}"></i>{{ end }}{{ if and $icon $title }} {{ end }}{{ $title | .RenderString }}</div> <div class="box-label">{{ if $icon }}<i class="{{ $icon }}"></i>{{ end }}{{ if and $icon $title }} {{ end }}{{ $title | .RenderString }}</div>
<div class="box-content"> <div class="box-content">
{{ if ne "<" (substr (strings.TrimLeft " " $content) 0 1) }}<p>{{ end }}<!-- we add a DOM element here if there is none to make collapsing marings work -->
{{ $content | safeHTML }}</div><!-- no line break allowed here because of awkward behavior of Hugo 110 or this theme when tag shortcode is called standalone outside of tags shortcode ? --> {{ $content | safeHTML }}</div><!-- no line break allowed here because of awkward behavior of Hugo 110 or this theme when tag shortcode is called standalone outside of tags shortcode ? -->
</div> </div>
{{- end }} {{- end }}

View file

@ -19,6 +19,7 @@
data-tab-item="{{ .name | $context.RenderString | plainify }}" data-tab-item="{{ .name | $context.RenderString | plainify }}"
class="tab-content-text{{ cond (eq $idx 0) " active" ""}}" class="tab-content-text{{ cond (eq $idx 0) " active" ""}}"
> >
{{ if ne "<" (substr (strings.TrimLeft " " .content) 0 1) }}<p>{{ end }}<!-- we add a DOM element here if there is none to make collapsing marings work -->
{{ .content | safeHTML }}</div><!-- no line break allowed here because of awkward behavior of Hugo 110 or this theme when tag shortcode is called standalone outside of tags shortcode ? --> {{ .content | safeHTML }}</div><!-- no line break allowed here because of awkward behavior of Hugo 110 or this theme when tag shortcode is called standalone outside of tags shortcode ? -->
{{- end }} {{- end }}
</div> </div>

View file

@ -444,7 +444,9 @@ div.box > .box-content {
#body table td > :first-child, #body table td > :first-child,
#body table td > :first-child :first-child, #body table td > :first-child :first-child,
#body div.box > .box-content > :first-child, #body div.box > .box-content > :first-child,
#body div.box > .box-content > :first-child :first-child { #body div.box > .box-content > :first-child :first-child,
#body div.tab-content > .tab-content-text > :first-child,
#body div.tab-content > .tab-content-text > :first-child :first-child {
margin-top: 0; margin-top: 0;
} }
@ -453,7 +455,9 @@ div.box > .box-content {
#body table td > :last-child, #body table td > :last-child,
#body table td > :last-child :last-child, #body table td > :last-child :last-child,
#body div.box > .box-content > :last-child, #body div.box > .box-content > :last-child,
#body div.box > .box-content > :last-child :last-child { #body div.box > .box-content > :last-child :last-child,
#body div.tab-content > .tab-content-text > :last-child,
#body div.tab-content > .tab-content-text > :last-child :last-child {
margin-bottom: 0; margin-bottom: 0;
} }