Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #1840. Restore glossary page rendering. #1841

Merged
merged 2 commits into from
Feb 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions layouts/shortcodes/def.html
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
{{ $_hugo_config := `{ "version": 1 }` }}
<!--
Usage (in english):
{% def
id="a unique id for anchor"
name="The term to define (optional if abbr is provided)"
abbr="an acronym (optional)"
abbr_first="1 (When the acronym is more important, such as RSA or SSL)" %}
the definition
the definition
{% /def %}

<p><dfn id="a unique id for anchor">The term to define</dfn>: the definition</p>
<p><dfn id="a unique id for anchor"><abbr>an acronym</abbr</dfn>: the definition</p>
<p><dfn id="a unique id for anchor">The term to define</dfn> (<abbr>an acronym</abbr>): the definition</p>

Usage (in other languages):
{% def
id="a unique id for anchor - the SAME than for english"
{% def
id="a unique id for anchor - the SAME than for english"
name="The term to define (optional if english or abbr is provided)"
abbr="an acronym (optional)"
english="the english term (optional - if present the abbr is in english too)"
Expand Down
9 changes: 5 additions & 4 deletions layouts/shortcodes/renderglossary.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<dl>
{{ range (.Page.Scratch.GetSortedMapValues "glossary") }}
<p class="definition">
<dt class="term">
<a href="#def-{{.id }}">
{{- if and (.abbr) (eq (.abbr_first) "1") -}}
<dfn id="def-{{.id }}"><abbr lang="en">{{ .abbr }}</abbr></dfn>
Expand All @@ -24,8 +25,8 @@
{{- end -}}
{{- end -}}
</a>
{{ .Site.Params.beforeColon | safeHTML }}: {{ .content }}
</p>

</dt>
<dd class="definition">{{ .content | markdownify }}</dd>
{{ end }}

</dl>
4 changes: 4 additions & 0 deletions static/css/glossary.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ dfn {
padding-right: .25em; /* Prevent italics text from hitting the ":" */
}

.definition {
margin-bottom: 1em;
}

.definition>a:first-child {
text-decoration: none;
color: inherit;
Expand Down
Loading