Skip to content

Commit 3559a76

Browse files
authored
refactor(w3c/templates): remove redundant html wrapper (#2017)
1 parent 0ef1998 commit 3559a76

File tree

3 files changed

+83
-111
lines changed

3 files changed

+83
-111
lines changed

.eslintrc.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"rules": {
1616
"prettier/prettier": ["error", { "endOfLine": "auto" }],
1717
"dot-notation": "error",
18+
"eol-last": ["error", "always"],
1819
"indent": 0,
1920
"no-console": 0,
2021
"no-duplicate-imports": 2,
@@ -28,8 +29,7 @@
2829
"prefer-const": 2,
2930
"quotes": 0,
3031
"semi": ["error", "always"],
31-
"sort-imports": 2,
32-
"eol-last": ["error", "always"]
32+
"sort-imports": 2
3333
},
3434
"globals": {
3535
"flushIframes": true,

src/w3c/templates/headers.js

Lines changed: 25 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -115,16 +115,10 @@ export default conf => {
115115
: ""
116116
}
117117
${
118-
conf.isED
118+
conf.isED && conf.prevED
119119
? html`
120-
${
121-
conf.prevED
122-
? html`
123-
<dt>Previous editor's draft:</dt>
124-
<dd><a href="${conf.prevED}">${conf.prevED}</a></dd>
125-
`
126-
: ""
127-
}
120+
<dt>Previous editor's draft:</dt>
121+
<dd><a href="${conf.prevED}">${conf.prevED}</a></dd>
128122
`
129123
: ""
130124
}
@@ -137,25 +131,17 @@ export default conf => {
137131
: ""
138132
}
139133
${
140-
conf.prevRecURI
134+
!conf.prevRecURI
135+
? ""
136+
: conf.isRec
141137
? html`
142-
${
143-
conf.isRec
144-
? html`
145-
<dt>Previous Recommendation:</dt>
146-
<dd>
147-
<a href="${conf.prevRecURI}">${conf.prevRecURI}</a>
148-
</dd>
149-
`
150-
: html`
151-
<dt>Latest Recommendation:</dt>
152-
<dd>
153-
<a href="${conf.prevRecURI}">${conf.prevRecURI}</a>
154-
</dd>
155-
`
156-
}
138+
<dt>Previous Recommendation:</dt>
139+
<dd><a href="${conf.prevRecURI}">${conf.prevRecURI}</a></dd>
140+
`
141+
: html`
142+
<dt>Latest Recommendation:</dt>
143+
<dd><a href="${conf.prevRecURI}">${conf.prevRecURI}</a></dd>
157144
`
158-
: ""
159145
}
160146
<dt>${conf.multipleEditors ? conf.l10n.editors : conf.l10n.editor}</dt>
161147
${showPeople(conf, "Editor", conf.editors)}
@@ -330,24 +316,20 @@ export default conf => {
330316
>document use</a
331317
>
332318
`
319+
: conf.isW3CSoftAndDocLicense
320+
? html`
321+
<a
322+
rel="license"
323+
href="https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document"
324+
>permissive document license</a
325+
>
326+
`
333327
: html`
334-
${
335-
conf.isW3CSoftAndDocLicense
336-
? html`
337-
<a
338-
rel="license"
339-
href="https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document"
340-
>permissive document license</a
341-
>
342-
`
343-
: html`
344-
<a
345-
rel="license"
346-
href="https://www.w3.org/Consortium/Legal/copyright-documents"
347-
>document use</a
348-
>
349-
`
350-
}
328+
<a
329+
rel="license"
330+
href="https://www.w3.org/Consortium/Legal/copyright-documents"
331+
>document use</a
332+
>
351333
`
352334
}
353335
rules apply.

src/w3c/templates/sotd.js

Lines changed: 56 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -125,75 +125,65 @@ export default (conf, opts) => {
125125
>.
126126
</p>
127127
`
128-
: html`
129-
${
130-
conf.isTeamSubmission
131-
? html`
132-
<p>
133-
If you wish to make
134-
comments regarding this
135-
document, please send them
136-
to
137-
<a
138-
href="${
139-
`mailto:${
140-
conf.wgPublicList
141-
}@w3.org${
142-
conf.subjectPrefix
143-
? `?subject=${
144-
conf.subjectPrefixEnc
145-
}`
146-
: [""]
147-
}`
148-
}"
128+
: conf.isTeamSubmission
129+
? html`
130+
<p>
131+
If you wish to make comments
132+
regarding this document, please
133+
send them to
134+
<a
135+
href="${
136+
`mailto:${
137+
conf.wgPublicList
138+
}@w3.org${
139+
conf.subjectPrefix
140+
? `?subject=${
141+
conf.subjectPrefixEnc
142+
}`
143+
: [""]
144+
}`
145+
}"
146+
>${conf.wgPublicList}@w3.org</a
147+
>
148+
(<a
149+
href="${
150+
`mailto:${
151+
conf.wgPublicList
152+
}-request@w3.org?subject=subscribe`
153+
}"
154+
>subscribe</a
155+
>,
156+
<a
157+
href="${
158+
`https://lists.w3.org/Archives/Public/${
159+
conf.wgPublicList
160+
}/`
161+
}"
162+
>archives</a
163+
>)${
164+
conf.subjectPrefix
165+
? html`
166+
with
167+
<code
149168
>${
150-
conf.wgPublicList
151-
}@w3.org</a
169+
conf.subjectPrefix
170+
}</code
152171
>
153-
(<a
154-
href="${
155-
`mailto:${
156-
conf.wgPublicList
157-
}-request@w3.org?subject=subscribe`
158-
}"
159-
>subscribe</a
160-
>,
161-
<a
162-
href="${
163-
`https://lists.w3.org/Archives/Public/${
164-
conf.wgPublicList
165-
}/`
166-
}"
167-
>archives</a
168-
>)${
169-
conf.subjectPrefix
170-
? html`
171-
with
172-
<code
173-
>${
174-
conf.subjectPrefix
175-
}</code
176-
>
177-
at the start of
178-
your email's
179-
subject
180-
`
181-
: ""
182-
}.
183-
</p>
184-
<p>
185-
Please consult the
186-
complete
187-
<a
188-
href="https://www.w3.org/TeamSubmission/"
189-
>list of Team
190-
Submissions</a
191-
>.
192-
</p>
193-
`
194-
: ""
195-
}
172+
at the start of your
173+
email's subject
174+
`
175+
: ""
176+
}.
177+
</p>
178+
<p>
179+
Please consult the complete
180+
<a
181+
href="https://www.w3.org/TeamSubmission/"
182+
>list of Team Submissions</a
183+
>.
184+
</p>
196185
`
186+
: ""
197187
}
198188
`
199189
: html`

0 commit comments

Comments
 (0)