diff --git a/assets/styles/root.css b/assets/styles/root.css index 1f5d2d1..15c48ad 100644 --- a/assets/styles/root.css +++ b/assets/styles/root.css @@ -180,6 +180,24 @@ details { width: 100%; } +fieldset { + box-sizing: border-box; + border: 1px solid var(--separator-color); + padding: var(--body-item-spacing); + padding-top: calc(var(--body-item-spacing) / 10); +} + +fieldset#ruby-controls { +} + +fieldset#ruby-controls input[type=radio] { + margin-inline-end: calc(var(--body-item-spacing) / 6); +} + +fieldset#ruby-controls label { + margin-inline-end: calc(var(--body-item-spacing)); +} + figure { border-radius: 6px; line-height: 1; @@ -608,6 +626,29 @@ ruby:hover rt { } } +body:has(fieldset#ruby-controls > input[value=NONE]:checked) rt { + display: none; +} +body:has(fieldset#ruby-controls > input[value=BOTH]:checked) rt { +} +body:has(fieldset#ruby-controls > input[value=ENGLISH]:checked) rt { +} + +/* When ruby-controls is set to hidden, hide the ruby base and only show the */ +body:has(fieldset#ruby-controls > input[value=HIDDEN]:checked) ruby > span { + display: none; +} +body:has(fieldset#ruby-controls > input[value=HIDDEN]:checked) rt { + color: inherit; + display: inline; + font-size: inherit; + white-space: inherit; +} +body:has(fieldset#ruby-controls > input[value=HIDDEN]:checked) :is(h1, h2, h3, h4, h5, h6) rt { + font-family: var(--font-family-heading); + font-weight: bold; +} + table { border: 1px solid var(--separator-color); border-collapse: collapse; diff --git a/layouts/_default/term.html b/layouts/_default/term.html index 92d3069..58fd86b 100644 --- a/layouts/_default/term.html +++ b/layouts/_default/term.html @@ -8,6 +8,7 @@ {{ partial "table_of_contents.html" . }} +{{ partial "ruby_controls.html" . }} {{- $hasContent := false -}} {{ with .Content }} diff --git a/layouts/partials/ruby_controls.html b/layouts/partials/ruby_controls.html new file mode 100644 index 0000000..726a7ef --- /dev/null +++ b/layouts/partials/ruby_controls.html @@ -0,0 +1,15 @@ +{{ if .HasShortcode "ruby" -}} + +{{- end }} diff --git a/layouts/shortcodes/ruby.html b/layouts/shortcodes/ruby.html index 8932a94..6f87aeb 100644 --- a/layouts/shortcodes/ruby.html +++ b/layouts/shortcodes/ruby.html @@ -1 +1 @@ -{{- .Inner }} ({{- .Get 0 -}}){{- "" -}} +{{- .Inner }} ({{- .Get 0 -}}){{- "" -}}