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

Use PST styling for spec meta styling #576

Merged
merged 2 commits into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
19 changes: 7 additions & 12 deletions assets/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -21,29 +21,24 @@ table.spec__table thead {
text-decoration: none;
}

.spec-meta {
background-color: var(--pst-color-surface);
border: 1px solid var(--pst-color-border);
border-radius: 0.25rem;
line-height: 1.2em;
margin: 1.5em 0;
padding: 1rem;
display: inline-block;
.admonition.spec-meta {
margin: 0.5625rem auto 1.5625rem;
}

.spec-meta table {
table.spec-meta {
margin-bottom: 0;
line-height: 1.2em;
display: inline-block;
}

.spec-meta .field {
.spec-field {
}

.spec-meta .field-name {
.spec-field-name {
white-space: nowrap;
font-weight: bold;
vertical-align: top;
}

.gallery {
display: flex;
flex-wrap: wrap;
Expand Down
5 changes: 0 additions & 5 deletions layouts/partials/specs/author.html

This file was deleted.

12 changes: 0 additions & 12 deletions layouts/partials/specs/date.html

This file was deleted.

49 changes: 25 additions & 24 deletions layouts/partials/specs/spec_meta.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{{ $page := . }}
{{ $isSpec := eq (len (findRE "^spec-\\d*" .File.ContentBaseName)) 1 }}
<div class="spec-meta">
<table>
<div class="sd-container-fluid sd-mb-4" >
<div class="sd-row">
<div class="sd-col sd-d-flex-row">
<div class="sd-card sd-w-100 sd-shadow-sm">
<div class="sd-card-body">
<table class="spec-meta">
{{ $meta_fields := (slice "author" "discussion" "history" "endorsed-by") }}
{{- range $attr := $meta_fields -}}
{{ $val := index $.Params $attr }}
Expand All @@ -20,13 +24,13 @@
{{- end -}}
{{ $isSpecField := (in (slice "endorsed-by" "discussion" ) $attr) }}
{{ if (or $isSpec (not $isSpecField)) }}
<tr class="field">
<td class="field-name">
<tr class="spec-field">
<td class="spec-field-name">
{{ $attr | humanize }}:
</td>
{{- if (reflect.IsSlice $val) -}}
{{ $len := len $val }}
<td class="field-value">
<td class="spec-field-value">
{{- range $idx, $el := $val }}
{{ if eq $attr "endorsed-by" }}
<a href="{{ relref $.Page.CurrentSection (printf "core-projects/%s" $el) }}">{{ $el }}</a>
Expand All @@ -37,29 +41,26 @@
{{ end }}
</td>
{{- else }}
<td class="field-value">
<td class="spec-field-value">
{{ $val | markdownify }}
</td>
{{- end -}}
</tr>
{{/* add warning that this is a draft, i.e. has not been endorsed by 2 projects or more */}}
{{- if (and (eq $attr "endorsed-by") (lt (len (or $val "")) 2)) }}
{{/* add blank line */}}
<tr class="field">
<td class="field-name">&nbsp;</td>
<td class="field-value"></td>
</tr>
{{/* add warning */}}
<tr class="field" style="background-color:crimson;color:white;">
<td class="field-name">
&nbsp; WARNING:
</td>
<td class="field-value">
Draft document.
</td>
</div>
{{- end -}}
{{- end -}}
{{/* add warning that this is a draft, i.e. has not been endorsed by 2 projects or more */}}
{{- if (and (eq $attr "endorsed-by") (lt (len (or $val "")) 2)) -}}
{{/* add warning */}}
<div class="admonition attention spec-meta">
<div class="admonition-title">
Attention
</div>
<p>This is a draft document.</p>
</div>
{{- end -}}
</table>
{{- end -}}
</table>
</div>
</div>
</div>
</div>
</div>