Skip to content

Commit fc42f44

Browse files
committed
use separate functions for the different notices
1 parent 3e24e94 commit fc42f44

1 file changed

Lines changed: 100 additions & 81 deletions

File tree

‎src/w3c/templates/cg-headers.js‎

Lines changed: 100 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,102 @@ function transferredTo(conf) {
8282
return to.url ? html`<a href="${to.url}">${to.name}</a>` : to.name;
8383
}
8484

85+
/** @param {Conf} conf */
86+
function noticeBoxSnapshot(conf) {
87+
return html`<div class="box box--information" id="top-status-block">
88+
<h2>
89+
This is a <a href="${LIVING_V_SNAPSHOT}">snapshot</a> of an incubation
90+
</h2>
91+
<ul>
92+
<li>
93+
<strong
94+
>This document instance is archival and is not intended to
95+
change.</strong
96+
>
97+
</li>
98+
<li>
99+
It was published on
100+
<time class="dt-updated" datetime="${conf.dashDate}"
101+
>${W3CDate.format(conf.publishDate)}</time
102+
>.
103+
</li>
104+
${
105+
conf.thisVersion
106+
? html`<li>
107+
The address of this snapshot is
108+
<a href="${conf.thisVersion}">${conf.thisVersion}</a>.
109+
</li>`
110+
: ""
111+
}
112+
</ul>
113+
</div>`;
114+
}
115+
116+
/** @param {Conf} conf */
117+
function noticeBoxTransferred(conf) {
118+
return html`<div class="box box--information" id="top-status-block">
119+
<h2>
120+
This specification has been
121+
<a href="${LIFECYCLE}">transferred</a>
122+
</h2>
123+
<ul>
124+
<li>
125+
<strong
126+
>Rather than use or reference this specification, please consult the
127+
guidance of the organization to which the specification has been
128+
transferred.</strong
129+
>
130+
</li>
131+
<li>
132+
${transferredTo(conf)} has taken up the work for standardization and so
133+
the W3C Community Group is no longer the “owner”.
134+
</li>
135+
</ul>
136+
</div>`;
137+
}
138+
139+
/** The notice for a specification nobody is maintaining any more. */
140+
function noticeBoxUnmaintained() {
141+
return html`<div class="box box--warning">
142+
<h2>
143+
This specification is no longer in development and is
144+
<a href="${LIFECYCLE}">unmaintained</a>
145+
</h2>
146+
<ul>
147+
<li><strong>Do not use or reference.</strong></li>
148+
<li>
149+
If these circumstances change in the future, we will review our
150+
guidance.
151+
</li>
152+
</ul>
153+
</div>`;
154+
}
155+
156+
/** The notice for a living specification still under development. */
157+
function noticeBoxDraft() {
158+
return html`<div class="box box--information" id="top-status-block">
159+
<h2>
160+
This is a
161+
<a href="${LIVING_V_SNAPSHOT}">living specification</a>
162+
</h2>
163+
<ul>
164+
<li>
165+
The text of this specification and the status information support for
166+
this specification are expected to change in place at this address.
167+
</li>
168+
${createRegion(
169+
"last-edited",
170+
"The last-edited date is loaded from the status metadata, which needs JavaScript.",
171+
"li"
172+
)}
173+
<li>
174+
This is a W3C Community Group incubation and is not (yet) ready for
175+
standardization.
176+
</li>
177+
</ul>
178+
</div>`;
179+
}
180+
85181
/**
86182
* The notice depending on the type of CG spec
87183
*
@@ -90,90 +186,13 @@ function transferredTo(conf) {
90186
function noticeBox(conf) {
91187
switch (cgVariant(conf)) {
92188
case "snapshot":
93-
return html`<div class="box box--information" id="top-status-block">
94-
<h2>
95-
This is a <a href="${LIVING_V_SNAPSHOT}">snapshot</a> of an incubation
96-
</h2>
97-
<ul>
98-
<li>
99-
<strong
100-
>This document instance is archival and is not intended to
101-
change.</strong
102-
>
103-
</li>
104-
<li>
105-
It was published on
106-
<time class="dt-updated" datetime="${conf.dashDate}"
107-
>${W3CDate.format(conf.publishDate)}</time
108-
>.
109-
</li>
110-
${
111-
conf.thisVersion
112-
? html`<li>
113-
The address of this snapshot is
114-
<a href="${conf.thisVersion}">${conf.thisVersion}</a>.
115-
</li>`
116-
: ""
117-
}
118-
</ul>
119-
</div>`;
189+
return noticeBoxSnapshot(conf);
120190
case "transferred":
121-
return html`<div class="box box--information" id="top-status-block">
122-
<h2>
123-
This specification has been
124-
<a href="${LIFECYCLE}">transferred</a>
125-
</h2>
126-
<ul>
127-
<li>
128-
<strong
129-
>Rather than use or reference this specification, please consult
130-
the guidance of the organization to which the specification has
131-
been transferred.</strong
132-
>
133-
</li>
134-
<li>
135-
${transferredTo(conf)} has taken up the work for standardization and
136-
so the W3C Community Group is no longer the “owner”.
137-
</li>
138-
</ul>
139-
</div>`;
191+
return noticeBoxTransferred(conf);
140192
case "unmaintained":
141-
return html`<div class="box box--warning">
142-
<h2>
143-
This specification is no longer in development and is
144-
<a href="${LIFECYCLE}">unmaintained</a>
145-
</h2>
146-
<ul>
147-
<li><strong>Do not use or reference.</strong></li>
148-
<li>
149-
If these circumstances change in the future, we will review our
150-
guidance.
151-
</li>
152-
</ul>
153-
</div>`;
193+
return noticeBoxUnmaintained();
154194
default:
155-
return html`<div class="box box--information" id="top-status-block">
156-
<h2>
157-
This is a
158-
<a href="${LIVING_V_SNAPSHOT}">living specification</a>
159-
</h2>
160-
<ul>
161-
<li>
162-
The text of this specification and the status information support
163-
for this specification are expected to change in place at this
164-
address.
165-
</li>
166-
${createRegion(
167-
"last-edited",
168-
"The last-edited date is loaded from the status metadata, which needs JavaScript.",
169-
"li"
170-
)}
171-
<li>
172-
This is a W3C Community Group incubation and is not (yet) ready for
173-
standardization.
174-
</li>
175-
</ul>
176-
</div>`;
195+
return noticeBoxDraft();
177196
}
178197
}
179198

0 commit comments

Comments
 (0)