Skip to content

Commit 14c79a0

Browse files
committed
Meta: Preparation for source reformatting
* Add data-noreformat attributes * Fix double spaces and incorrect wrapping around tags * Add a Check Formatting workflow * Update CONTRIBUTING.md
1 parent 4ce63af commit 14c79a0

File tree

3 files changed

+217
-378
lines changed

3 files changed

+217
-378
lines changed

.github/workflows/build.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,18 @@ jobs:
1515
with:
1616
fetch-depth: 2
1717
path: 'source'
18+
- name: Check Formatting
19+
run: |
20+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
21+
source $HOME/.cargo/env
22+
cargo install reformahtml
23+
mkdir tmp
24+
reformahtml source/source tmp/reformatted-source
25+
diff source/source tmp/reformatted-source > tmp/diff_output.txt || true
26+
if [ -s tmp/diff_output.txt ]; then
27+
cat tmp/diff_output.txt
28+
exit 1
29+
fi
1830
- name: Build
1931
run: |
2032
mkdir output

CONTRIBUTING.md

Lines changed: 6 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -53,28 +53,9 @@ Due to the long legacy of the existing text, these guidelines are not always app
5353

5454
#### Line wrapping length
5555

56-
Use a column width of 100 characters and add newlines where whitespace is used. (Emacs, set `fill-column` to `100`; in Vim, set `textwidth` to `100`; and in Sublime, set `wrap_width` to `100`. Alternatively, wrap the paragraph(s) with your changes with https://domenic.github.io/rewrapper/. Make sure that `column length to rewrap` is set to 100.)
56+
Do not wrap text within a paragraph (or list item, etc.). Custom wrapping for readability (e.g. one `code` element per line) is OK; add a `data-noreformat` attribute on the containing element.
5757

58-
#### Wrapping opportunities
59-
60-
Using newlines between "inline" element tag names and their content is forbidden. (This actually alters the content, by adding spaces.) That is,
61-
```html
62-
<dd><span>Parse error</span>. Create a new DOCTYPE token. Set its <i data-x="force-quirks
63-
flag">force-quirks flag</i> to …
64-
```
65-
is fine and
66-
```html
67-
<dd><span>Parse error</span>. Create a new DOCTYPE token. Set its <i data-x="force-quirks flag">
68-
force-quirks flag</i> to …
69-
```
70-
is not.
71-
72-
Using newlines between attributes and inside attribute values that contain whitespace is allowed. Always wrap after putting the maximum number of characters on a single line within these guidelines.
73-
74-
```html
75-
<p>A <code>base</code> element that is the first <code>base</code> element with an <code
76-
data-x="attr-base-href">href</code> content attribute <span>in a document tree</span> has a
77-
```
58+
You can run https://github.com/zcorpan/reformahtml locally to remove inter-paragraph line wrapping. This script is also run as a GitHub workflow.
7859

7960
### Element hierarchy
8061

@@ -92,22 +73,20 @@ and the previous list item. No extra newline at the start or end of the list tho
9273

9374
If a "block" element contains a single "block" element, do not put it on a new line.
9475

95-
Do not indent for anything except a new "block" element. For instance
76+
For instance
9677
```html
97-
<li><p>Let <var>corsAttributeState</var> be the current state of the element's <code
98-
data-x="attr-link-crossorigin">crossorigin</code> content attribute.</p></li>
78+
<li><p>Let <var>corsAttributeState</var> be the current state of the element's <code data-x="attr-link-crossorigin">crossorigin</code> content attribute.</p></li>
9979
```
10080
is not indented, but
10181
```html
10282
<li>
103-
<p>For each <var>element</var> in <var>candidate elements</var>, run the following
104-
substeps:</p>
83+
<p>For each <var>element</var> in <var>candidate elements</var>, run the following substeps:</p>
10584

10685
<ol>
10786
```
10887
is.
10988

110-
End tags must not be omitted (except where it is consistent to do so) and attribute values must be quoted (use double quotes).
89+
End tags must not be omitted (except where it is consistent to do so) and non-empty attribute values must be quoted (use double quotes).
11190

11291
### Algorithms
11392

0 commit comments

Comments
 (0)