-
Notifications
You must be signed in to change notification settings - Fork 922
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- allow tab content in markdown - tab(s) can now be disabled - improve storage of active language - new option to turn storage of active language off - improvements and fixes - documentation update
- Loading branch information
Showing
15 changed files
with
213 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
@import "shortcodes/tabbed-pane.scss"; | ||
@import "shortcodes/cards-pane.scss"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
.card-deck { | ||
max-width: 83%; | ||
} | ||
.card { | ||
max-width: 80%; | ||
.highlight { | ||
border: none; | ||
} | ||
} | ||
.card-body.code { | ||
background-color: #f8f9fa; | ||
padding: 0 0 0 1ex; | ||
} | ||
.card-body { | ||
pre { | ||
margin: 0; | ||
padding: 0 1rem 1rem 1rem; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
.td-content { | ||
.highlight { | ||
margin: 0rem 0 2rem 0; | ||
} | ||
} | ||
.tab-content { | ||
.tab-pane { | ||
.highlight { | ||
border: none; | ||
max-width: 100%; | ||
} | ||
pre { | ||
border-left: 1px solid rgba(0, 0, 0, 0.125); | ||
border-right: 1px solid rgba(0, 0, 0, 0.125); | ||
border-bottom: 1px solid rgba(0, 0, 0, 0.125); | ||
} | ||
margin: 0rem; | ||
max-width: 80%; | ||
border-left: none; | ||
border-right: none; | ||
border-bottom: none; | ||
} | ||
} | ||
|
||
.tab-body { | ||
font-weight: $font-weight-medium; | ||
background: $gray-100; | ||
color: inherit; | ||
border-radius: 0; | ||
padding: 1.5rem; | ||
|
||
@each $color, $value in $theme-colors { | ||
&-#{$color} { | ||
|
||
border-style: solid; | ||
border-color: $value; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,123 @@ | ||
<!-- Scratchpad gets populated through call to .Inner --> | ||
<!-- Check parameter types --> | ||
{{ with .Get "langEqualsHeader" }} | ||
{{ if ne ( printf "%T" . ) "bool" }} | ||
{{- errorf "shortcode tabpane: parameter 'langEqualsHeader' must be either true or false" -}} | ||
{{ end }} | ||
{{ end }} | ||
|
||
{{ with .Get "code" }} | ||
{{ if ne ( printf "%T" . ) "bool" }} | ||
{{- errorf "shortcode tabpane: parameter 'code' must be either true or false" -}} | ||
{{ end }} | ||
{{ end }} | ||
|
||
{{ with .Get "persistLang" }} | ||
{{ if ne ( printf "%T" . ) "bool" }} | ||
{{- errorf "shortcode tabpane: parameter 'persistLang' must be either true or false" -}} | ||
{{ end }} | ||
{{ end }} | ||
|
||
<!-- Set values given defined within tabpane --> | ||
{{- $langPane := default "" ($.Get "lang") -}} | ||
{{- $hloptionsPane := default "" ($.Get "highlight") -}} | ||
{{- $codePane := default true ($.Get "code") -}} | ||
{{- $langEqualsHeader := default false ($.Get "langEqualsHeader") -}} | ||
{{- $persistLang := default true ($.Get "persistLang") -}} | ||
{{- $disabled := false -}} | ||
{{- $activeSet := false -}} | ||
|
||
<!-- Scratchpad gets populated through call to .Inner --> | ||
{{- .Inner -}} | ||
|
||
<ul class="nav nav-tabs" id="tabs-{{- $.Ordinal -}}" role="tablist"> | ||
{{- range $index, $element := $.Scratch.Get "tabs" -}} | ||
|
||
{{- $lang := $langPane -}} | ||
{{- if $langEqualsHeader -}} | ||
{{- $lang = $element.header -}} | ||
{{end}} | ||
{{- with $element.language -}} | ||
{{- $lang = $element.language -}} | ||
{{- end -}} | ||
|
||
{{- $disabled := false -}} | ||
{{- with $element.disabled -}} | ||
{{ if ne ( printf "%T" . ) "bool" }} | ||
{{- errorf "shortcode tab: parameter 'disabled' must be either true or false" -}} | ||
{{ end }} | ||
{{- $disabled = . }} | ||
{{- end -}} | ||
|
||
<!-- Replace space and +, not valid for css selectors --> | ||
{{- $lang := replaceRE "[\\s+]" "-" $lang -}} | ||
|
||
<li class="nav-item"> | ||
<!-- Generate the IDs for the <a> and the <div> elements --> | ||
{{- $tabid := printf "tabs-%v-%v-tab" $.Ordinal $index | anchorize -}} | ||
{{- $entryid := printf "tabs-%v-%v" $.Ordinal $index | anchorize -}} | ||
<!-- Replace space and + from tabname to set class --> | ||
{{- $tabname := replaceRE "(\\s)" "-" $element.header -}} | ||
{{- $tabname := replaceRE "(\\+)" "-" $tabname -}} | ||
<a class="nav-link{{ if eq $index "0" }} active{{ end }} tab-{{ $tabname }}" | ||
id="{{ $tabid }}" data-toggle="tab" href="#{{ $entryid }}" role="tab" onclick="handleClick({{ $tabname }});" | ||
aria-controls="{{ $entryid }}" aria-selected="{{- cond (eq $index "0") "true" "false" -}}"> | ||
{{ index . "header" }} | ||
|
||
<a class="nav-link{{ if and ( not $activeSet ) ( not $disabled ) }} active{{ end }}{{ if eq $disabled true }} disabled{{ end }}{{ if ne $lang "" }}{{ if $persistLang }} persistLang-{{- $lang -}}{{ end }}{{ end }}" | ||
id="{{- $tabid -}}" data-toggle="tab" href="#{{ $entryid }}" role="tab" | ||
{{ if ne $lang "" }}{{- if $persistLang -}}onclick="handleClick({{- $lang -}});"{{end}}{{end}} | ||
aria-controls="{{- $entryid -}}" aria-selected="{{- cond (eq $index "0") "true" "false" -}}"> | ||
{{- index . "header" | markdownify -}} | ||
</a> | ||
</li> | ||
|
||
{{ if not $disabled }} | ||
{{ $activeSet = true }} | ||
{{ end }} | ||
|
||
{{- end -}} | ||
</ul> | ||
|
||
{{ $activeSet = false }} | ||
|
||
<!-- Inner content --> | ||
<div class="tab-content" id="tabs-{{- $.Ordinal -}}-content"> | ||
{{- range $index, $element := $.Scratch.Get "tabs" -}} | ||
|
||
{{- $lang := default $.Site.Language.Lang ($.Get "lang") -}} | ||
{{with $.Get "langEqualsHeader"}} | ||
{{ if $.Get "langEqualsHeader"}} | ||
{{ $lang = $element.header }} | ||
{{end}} | ||
{{- $lang := $langPane -}} | ||
{{- if $langEqualsHeader -}} | ||
{{- $lang = $element.header -}} | ||
{{end}} | ||
{{- $hloptions := default "" ($.Get "highlight") -}} | ||
{{- with $element.language -}} | ||
{{ $lang = $element.language }} | ||
{{- $lang = $element.language -}} | ||
{{- end -}} | ||
|
||
{{- $disabled := false -}} | ||
{{- with $element.disabled -}} | ||
{{- $disabled = . }} | ||
{{- end -}} | ||
|
||
{{- $hloptions := $hloptionsPane -}} | ||
{{- with $element.highlight -}} | ||
{{ $hloptions = $element.highlight }} | ||
{{- $hloptions = $element.highlight -}} | ||
{{- end -}} | ||
|
||
{{- $code := $codePane -}} | ||
{{- with $element.code -}} | ||
{{ if ne ( printf "%T" . ) "bool" }} | ||
{{- errorf "shortcode tab: parameter 'code' must be either true or false" -}} | ||
{{ end }} | ||
{{- $code = . }} | ||
{{- end -}} | ||
|
||
{{- $tabid := printf "tabs-%v-%v-tab" $.Ordinal $index | anchorize -}} | ||
{{- $entryid := printf "tabs-%v-%v" $.Ordinal $index | anchorize -}} | ||
<div class="tab-pane fade{{ if eq $index "0" }} show active{{ end }}" | ||
|
||
<div class="{{ if not $code }}tab-body {{end}}tab-pane fade{{ if and ( not $activeSet ) ( not $disabled ) }} show active{{ end }}" | ||
id="{{ $entryid }}" role="tabpanel" aria-labelled-by="{{ $tabid }}"> | ||
{{- highlight (index . "content") $lang $hloptions -}} | ||
{{ if $code }} | ||
{{- highlight (trim (index . "content") "\n") $lang $hloptions -}} | ||
{{- else -}} | ||
{{- index . "content" -}} | ||
{{- end -}} | ||
</div> | ||
|
||
{{ if not $disabled }} | ||
{{ $activeSet = true }} | ||
{{ end }} | ||
|
||
{{ end }} | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,6 @@ | |
"bootstrap": "^4.6.1" | ||
}, | ||
"devDependencies": { | ||
"hugo-extended": "0.98.0" | ||
"hugo-extended": "0.99.1" | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.