forked from speced/bikeshed
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.bs
4331 lines (3479 loc) · 186 KB
/
index.bs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<pre class='metadata'>
Title: Bikeshed Documentation
H1: Bikeshed, Your Friendly Spec Generator
Shortname: bikeshed
Level: 1
Status: LS
URL: https://tabatkins.github.io/bikeshed/
Editor: Tab Atkins-Bittner
Repository: tabatkins/bikeshed
Abstract: Bikeshed is a spec-generating tool that takes in lightly-decorated Markdown and spits out a full spec, with cross-spec autolinking, automatic generation of indexes/ToC/etc, and many other features.
Markup Shorthands: css no, markdown yes
Ignored Terms: h1, h2, h3, h4, h5, h6, xmp
</pre>
<pre class=link-defaults>
spec:html; type:element;
text:a
text:script
text:style
text:title
text:link
</pre>
<!--
████ ██ ██ ██████ ████████ ███ ██ ██
██ ███ ██ ██ ██ ██ ██ ██ ██ ██
██ ████ ██ ██ ██ ██ ██ ██ ██
██ ██ ██ ██ ██████ ██ ██ ██ ██ ██
██ ██ ████ ██ ██ █████████ ██ ██
██ ██ ███ ██ ██ ██ ██ ██ ██ ██
████ ██ ██ ██████ ██ ██ ██ ████████ ████████
-->
Installing {#installing}
========================
Using Bikeshed Without A Local Install {#install-no}
----------------------------------------------------
If you use Bikeshed infrequently,
or are okay with requiring a network roundtrip every time you invoke Bikeshed,
you probably want to use [the Bikeshed API instead](https://api.csswg.org/bikeshed/).
In return, the API version is always up-to-date,
so you don't have to remember to update things yourself.
See [[#remote]] for options.
Installing The Right Py3 {#install-py3}
---------------------------------------
Your OS should already be shipping with some version of Python 3.
However, Bikeshed requires Python 3.7,
and that's not always the version installed by default.
You can tell which you're running with:
```bash
python3 --version
```
If it reports 3.7 or later, you're fine.
If it gives 3.5, 3.6, or some lesser version,
you'll need to install 3.7.
This can be a little complicated if you do it directly
(building from source?),
but luckily `pyenv` is now a mature and easy way to do this.
### Installing Pyenv ### {#install-pyenv}
<a href="https://github.com/pyenv/pyenv#installation">https://github.com/pyenv/pyenv#installation</a> gives instructions for installing pyenv on various environments.
It also links to the auto-installer, which can make things even easier.
Windows users have slightly different instructions,
but it links to a windows fork as well.
Note that the final install step currently installs 3.7.8;
that's fine, go ahead and follow it.
If you know your way around pyenv already,
feel free to do what you're used to here.
Otherwise, it's usually easiest to set up 3.7 as your "default" Python:
```bash
pyenv versions
```
will list what versions exist, and then
```bash
pyenv global 3.7.0
```
will set 3.7.0 as your "global" version, used by default.
(Substitute in whatever the name of the version you saw in `versions` was.)
Installing Bikeshed Itself {#install-final}
-------------------------------------------
Once your environment is set up for Python 3.7,
installation is a breeze.
Run the following command:
```bash
pip3 install bikeshed && bikeshed update
```
When this is completed, Bikeshed should be installed,
and the `bikeshed` command should work in your shell.
Note: Depending on your system and python/pip install,
you might instead need to run `pip`, `python -m pip`, or `python3 -m pip`,
instead of the plain `pip`.
Note: If you'd prefer a user-local install rather than a global,
add a `--user` flag to the `pip3 install` invocation.
If you haven't done a user-local install before,
`pip` will warn you about having to add new things to your `$PATH`
before `bikeshed` becomes available to use as a command.
Note: If you're on a Mac,
`bikeshed update` might fail with some errors about certificates.
This is a known issue with the version of Python 3.7 shipped with XCode,
which might be the default on your system.
To fix this, install Python 3.7 with [Brew](https://brew.sh/) instead.
### Installing Bikeshed for Development ### {#install-dev}
If you're installing Bikeshed so you can work on it,
or want to ensure you have the bleeding-edge tip-of-tree version,
the instructions are just a tiny bit more complex.
First, clone the Bikeshed repository:
```bash
git clone https://github.com/tabatkins/bikeshed.git
```
Then navigate to that folder
(by default, it'll be a folder called "bikeshed"
in the current folder you're in)
and run:
```bash
pip3 install -e .
```
This will spam your console with a bunch of install progress.
When it successfully completes,
the `bikeshed` module should be globally available for import in Python,
and a `bikeshed` command should now work in your shell.
Finally,
run the following command to update your data files to the latest version:
```bash
bikeshed update
```
<div class=advisement>
These install instructions are new,
and it's possible they may not work on all systems.
If something doesn't work for you,
please <a href="https://github.com/tabatkins/bikeshed/issues/new">open an issue</a>
and let me know what system you're on,
what you've done so far,
and what errors you've gotten.
</div>
### Installing With Pipenv ### {#install-pipenv}
If you're a user of `pipenv`,
Bikeshed's folder contains a `Pipfile` and `Pipfile.lock` for you.
Follow the same instructions as above,
but instead of running `pip3 install`,
run:
```bash
pipenv install --dev -e .
pipenv run bikeshed update
```
This will *not* install a `bikeshed` command by default;
instead, you run Bikeshed with `pipenv run bikeshed`.
If you'd like `bikeshed` to work by itself,
either start a pipenv shell with `pipenv shell`,
or add an alias to your machine like:
```bash
bikeshed=pipenv run bikeshed
```
Updating Bikeshed {#updating-bikeshed}
--------------------------------------
To update bikeshed to its latest version at any time,
just run:
```
pip3 install --upgrade bikeshed && bikeshed update
```
This’ll pull the latest version of Bikeshed,
and ensure that you’re looking at the latest version of the data files,
rather than whatever stale version is currently sitting in the repo.
Note: If you did a user-local install up above,
by passing the `--user` flag to `pip3 install`,
pass it here as well to update your local copy;
otherwise this command will install it globally.
Note: If you did an "editable" install up above,
to update it you just run the install command again;
no `--upgrade` flag required.
Travis CI steps {#travis-ci}
----------------------------
To use bikeshed on [Travis CI](https://travis-ci.org/)'s github integration, you'll need the following `.travis.yml` commands:
```
language: python
python:
- "3.8"
install:
- pip install bikeshed
- bikeshed update
script:
# Invoke bikeshed here, at your own leisure. E.g.:
- bikeshed spec
```
[Raymond Toy has written a very thoro guide on the full setup you need to auto-build and -publish the generated files to GitHub via Travis, so you only need to check in the source files themselves.](https://github.com/rtoy/auto-deploy-spec)
GitHub Actions CI Steps {#gh-action-ci}
---------------------------------------
The W3C maintains a [spec-prod](https://w3c.github.io/spec-prod/#examples) GitHub Action
that allows automatically processing commits or PRs
as either Bikeshed or ReSpec.
The linked document has a number of usage examples to achieve various outcomes--
simple validation,
publishing to GitHub Pages,
auto-publishing on w3.org/TR,
and some others.
It also explains the entire process from start to finish.
Building a Bikeshed docker image {#install-docker}
--------------------------------------------------
Note: I don't actually understand Docker or know how to use it,
so this guide is based on one community member's efforts.
If something is wrong or outdated, uh, figure out how to fix it
and tell me so I can fix the docs.
- If needed, download and install [docker community engine](https://hub.docker.com/search/?type=edition&offering=community)
- Build the Bikeshed image from the project's directory:
```
docker build --tag=bikeshed:latest .
```
The above command will cache Bikeshed's datafiles in the Docker layer cache,
in order to speed up rebuilds.
If you want to be sure you get the latest datafiles,
run `bikeshed update` in the container or add the `--no-cache` flag when building the image:
```
docker build --tag=bikeshed:latest --no-cache .
```
- Optionally, deploy the Bikeshed image to a docker registry
For example, on a unix system (for Windows, consider the Windows Subsystem for Linux):
```
TAG=$(docker image inspect --format='{{.Id}}' bikeshed:latest)
DATE=$(date '+%Y.%m.%d')
```
Login to a docker registry.
```
docker login
```
Tag the image to be pushed as organization/artifact:version
```
docker tag $TAG <organization>/bikeshed:$DATE
```
Push the tagged image to the docker registry
```
docker push <organization>/bikeshed:$DATE
```
- Running Bikeshed using a docker image.
See [[#cli-docker]]
<!--
██████ ██ ██ ████████ ██
██ ██ ██ ██ ██ ██ ██
██ ██ ██ ██ ██ ██
██ ██ ██ ████████ ██
██ ██ ██ ██ ██ ██
██ ██ ██ ██ ██ ██ ██
██████ ███████ ██ ██ ████████
-->
Invoking Bikeshed Without Installing {#remote}
============================================
While a locally-installed Bikeshed does provide additional functionality,
if all you need to do is process a spec,
there is an API server you can talk to,
maintained by Peter Linss.
Using Curl {#curl}
------------------
These instructions assume use of the `curl` command,
but you can use any equivalent "talk HTTP at a server" command you might have access to.
<div class=example>
<pre highlight=bash>
curl https://api.csswg.org/bikeshed/ -F [email protected] -F force=1 > index.html
</pre>
Simplest possible usage:
* passing the source as `-F [email protected]`
* forcing output even if there are errors with `-F force=1`
* piping the output to the desired filename with `> index.html`.
Additional possible arguments:
* `-F output=err` to just receive errors, if any
* `-F md-Foo=bar` to pass a `Foo: bar` metadata to the spec
(same as passing `--md-Foo=bar` locally)
* `-F die-on=[nothing, fatal, link-error, warning, everything]`,
(same as the `--die-on` local flag)
</div>
<div class=example>
If your source file is online,
such as in a git repository,
you can pass the url directly instead:
<pre highlight=bash>
curl http://api.csswg.org/bikeshed/ -F url=http://dev.w3.org/csswg/css-syntax/Overview.bs -F force=1 > Overview.html
</pre>
If you are using additional files beyond your plain source file--
local boilerplate files,
[[#including|sub-document includes]],
[[#custom-dfns|custom definition files]],
etc--
this is the *only* way to make those still work
via the curl API;
Bikeshed will look for the additional files
relative to the source document's url.
(Any additional files that get included *implicitly*,
such as local boilerplates,
must be listed in the [=Local Boilerplate=]
or [=External Infotrees=] metadatas
to get picked up.
Files explicitly listed in the source file,
such as in a `<pre class=include>`,
will be picked up automatically.)
</div>
<div class=example>
The separate `bikeshed issues-list` command
(for generating issues lists for a W3C Disposition of Comments)
can also be invoked via curl:
<pre highlight=bash>
curl http://api.csswg.org/bikeshed/ -F [email protected] -F input=issues > Issues.html
</pre>
</div>
Using the Web Form {#web}
-------------------------
Alternately, you can just visit [https://api.csswg.org/bikeshed/](https://api.csswg.org/bikeshed/) directly,
and upload a file,
point to a URL,
or directly paste in your spec source.
It defaults to outputting both the HTML and the errors,
but you can switch it to one or the other only if you want.
Automatically When You Commit {#commit}
---------------------------------------
See [[#travis-ci]] for a guide on setting up Bikeshed, GitHub, Travis CI
so that you can just commit the source files
and have the processed HTML automatically generated and committed to your GitHub repository.
<!--
██████ ██ ████
██ ██ ██ ██
██ ██ ██
██ ██ ██
██ ██ ██
██ ██ ██ ██
██████ ████████ ████
-->
Invoking Bikeshed Locally {#cli}
================================
Locally-installed Bikeshed is invoked via the command-line.
There's a bunch of options,
but you'll only use a few in day-to-day use.
If you've installed Bikeshed via one of the standard local installs above,
you can typically just type `bikeshed` in the folder where your `.bs` file lives
and it'll do its thing,
automatically invoking the `spec` subcommand.
However, Bikeshed has a number of different subcommands,
and both global and subcommand-specific flags that can be invoked.
Invoking Bikeshed using a docker image {#cli-docker}
----------------------------------------------------
Note: As stated up in [[#install-docker]],
I don't know how Docker works
and this guide is based on a community member's experience,
so use at your own risk.
Typically, this requires login to the docker registry and pulling a Bikeshed image.
For some `<organization>` and some `<date>`:
```
docker login
docker pull <organization>/bikeshed:<date>
```
Regardless of host environment's operating system, running Bikeshed from a docker image
requires two things:
- mapping a host directory to a path in the docker image (e.g. `/data`)
- specifying the location of Bikeshed's input and output relative to the path in the docker image (i.e., `/data`)
Example for a Unix host:
```
docker run --rm -v $(pwd):/data <organization>/bikeshed:<date> bikeshed spec /data/<some *.bs file> [/data/<some output file>]
```
Example for a Windows host:
```
docker run --rm --volume C:\mystuff\project1\:/data <organization>/bikeshed:<date> spec /data/Index.bs /data/out/Index.html
```
Note that the [[#cli-options]] apply to running Bikeshed from a docker image.
Since the Bikeshed docker image is read-only, it does not make sense to execute the Bikeshed `update` command from a docker image.
Global Options {#cli-options}
-----------------------------
There are a few options that apply to many different options,
so they're specified before the individual commands:
: `-h` or `--help`
:: Shows the help message for the current command.
Can be run without any command,
like `bikeshed -h`
to show the list of valid commands and the global flags,
or after a command,
like `bikeshed spec -h`
to show the help text for that command in particular.
: `--die-on = [ nothing | fatal | link-error | warning | everything ]`
:: Bikeshed categorizes errors into several categories,
depending on their severity:
clear mistakes are "fatal",
errors in resolving autolinks are "link-error",
and things that look a little questionable but are totally okay to generate a document with are "warning".
The `--die-on` flag controls which sorts of errors
cause Bikeshed to immediately die
and exit with a non-0 status
(indicating the command failed).
Possible values are "nothing", "fatal", "link-error", "warning", and "everything",
with each level including all previous levels.
Defaults to "fatal".
It's often useful to set this to "nothing" if you just need to push thru and generate a spec,
or if you're generating a freshly-written or freshly-ported spec that may have several errors,
where it's useful to see all the errors at once,
in case some depend on each other.
The `-f` flag is a shorthand for this.
(Pairing this with `-q` or `-qq` might be useful,
to suppress the non-fatal errors temporarily
and make the output easier to read.)
Alternately, it can be useful to set it to a level stricter than "fatal"
if you want to ensure that,
for example,
a CI build fails when link errors creep into your document,
or if you just generally want to ensure that your document builds "cleanly",
without any warnings at all.
"everything" is equivalent to "warning",
but is guaranteed to always die on *all* error messages,
even if more levels are added in the future.
: `-f` or `--force`
:: A shorthand for `--die-on=nothing`.
: `-q` or `--quiet`
:: The `-q` flag suppresses one level of error messages.
It can be passed multiple times to suppress additional levels,
in the order "warnings", then "link errors", then "fatal errors".
: `-s` or `--silent`
:: The `-s` flag suppresses *all* console output from Bikeshed,
regardless of source.
(It's more powerful than `-q`,
as it'll also suppresses things like the success/failure message.)
: `-d` or `--dry-run`
:: The `-d` flag prevents Bikeshed from actually writing anything to disk.
It does everything else,
just skips that final "save" operation.
: `--print= [ plain | console | markup ]`
:: Specifies how Bikeshed should output its messages.
Default is "console",
which outputs colored text using console color codes.
"plain" outputs the same text as "console",
but without any color codes
(which look like gibberish if you're not outputting to a console).
"markup" outputs the text in a light markup structure
(suitable for parsing as HTML),
for easier parsing of the output by tools.
`bikeshed spec` {#cli-spec}
---------------------------
The `spec` command is the most common one you'll use.
It turns a Bikeshed source file
into an output HTML file.
The rest of this document mostly describes how to format a source file
for use with this command.
Most of the time you can just run `bikeshed spec`
and things will "just work"
as long as your source file has the `.bs` extension.
Relevant flags:
: `--gh-token=TOKEN`
:: If you're using <a>Inline GitHub Issues</a> heavily,
you might run into the GitHub rate limit.
You can generate an OAuth token at <a href="https://github.com/settings/tokens">https://github.com/settings/tokens</a>
and then pass it to Bikeshed via this flag
to raise your limit considerably.
: `-l` or `--line-numbers`
:: If you're having trouble locating the source of an error in your code,
run Bikeshed with this flag
and *almost* all errors will report the source line number they appear at
(or somewhere very close - it's per-element).
This code is unfortunately forced to be fairly hacky,
and has the potential to lightly corrupt your file
(inserting extra debugging info into plain text
that just happens to look like markup),
so it automatically triggers a dry-run,
as if you'd specified `--dry-run`.
When you're done debugging,
just run again without this flag to actually get some output.
After any flags,
you can optionally specify the input file path and output file path.
Both of these can usually be omitted;
if you omit the output file,
it'll just output to a file with the same name as the input file,
but with the extension changed to `.html`;
if you omit the input file,
it'll search thru the current directory
and assume you want the first file with a Bikeshed extension (`.bs`).
If you want to feed Bikeshed from stdin
or have it output to stdout,
just use `-` as the appropriate filename.
`bikeshed watch` {#cli-watch}
-----------------------------
The `watch` command is identical to the `spec` command,
except it sets up a watcher
and auto-rebuilds the spec every time it changes.
With this turned on,
you can edit with a simple save->refresh cycle,
rather than having to do save->build->refresh.
It accepts all the same arguments as `spec`.
(Tho using stdin/stdout might get a little weird.)
Use Ctrl-C to stop the watcher
(or whatever key combo kills the currently running process in your console).
`bikeshed template` {#cli-template}
-----------------------------------
The `template` command outputs a minimal "skeleton" document to stdout.
It's useful to get started with Bikeshed,
without having to remember what all the required metadata is.
On a Linux-like command line,
it should be used like:
```
bikeshed template > index.bs
```
`bikeshed echidna` {#cli-echidna}
---------------------------------
The `echidna` command hooks into the W3C's Echidna auto-publishing system,
letting you publish W3C specs from the command-line,
rather than having to go thru a staff contact.
Note: Currently, only Working Drafts (**not** including FPWD) and Candidate Recommendation Drafts can be published via Echidna.
It's invoked similarly to `bikeshed spec`,
with three required flags:
: `--u USERNAME`
:: Your W3C username
: `--p PASSWORD`
:: Your W3C password
: `--decision DECISION_URL`
:: A link to a publicly-visible message approving the publication of this draft.
After the flags,
you can optionally specify the input file path,
just like for `bikeshed spec`;
if omitted,
it selects a file automatically in the same way.
Bikeshed then builds the spec normally,
performs a little bit of fixup for common issues that PubRules complains about,
and submits the spec to Echidna.
It will print out a URL for you to check on the progress of your publication;
it should complete in a few seconds.
Most likely you'll have some PubRules errors when you check your progress;
fix those
(ask in irc.w3.org#pub for help if needed)
then just run `bikeshed echidna` again.
Note: If auto-publishing via Travis CI,
[this Travis blog post about encrypted environment variables](https://blog.travis-ci.com/2014-08-22-environment-variables)
will be helpful for safely using your W3C password.
### Testing Publication Locally ### {#echidna-testing}
Publishing via Echidna automatically does some "fixup" on your document,
to fix some common errors that would make the doc fail the W3C's PubRules check.
These fixes are controlled by the <a>Prepare For TR</a> metadata,
so if you want to see precisely what your spec will look like when it's published,
add that to your metadata block manually.
If you want to go further,
and see the actual TAR file that will be sent to the Echidna service,
you can pass `--just-tar` to the command
(and omit the authentication flags that are normally required).
This will cause Bikeshed to create a file named `test.tar` in your current directory.
### Echidna Hooks ### {#echidna-hooks}
Bikeshed's default publication behavior is usually sufficient,
but if you need to customize it in some way,
there are a few hooks you can use
(assuming you can write Python).
In an include file named `bs-extensions.include`,
provide an implementation of the following methods
(check the default version of this file for the default implementations,
for the methods you don't want to change):
: `BSPrepTR(doc)`
:: This method is called after processing is done,
when the document is ready to be packed up and sent to Echidna.
Here, you can perform whatever final post-processing is required.
<div class=example>
For example, the CSSWG EDs link to a stylesheet
in the parent directory of the server they're stored on.
In their `BSPrepTR()`,
they search for the link to that stylesheet,
and update it to point to the current directory instead.
</div>
: `BSPublishAdditionalFiles(files)`
:: This method allows you to specify what files should be included in the publishing bundle.
It must return an array of additional files/folders;
each entry must either be a string,
referring to a file/folder in the spec's directory or subdirectories,
or a tuple of 2 strings,
the first of which points to a file outside the spec's directory,
and the second of which provides the path the file should have within the spec's directory.
The `files` value provides the default values,
which you probably want to just extend,
rather than fully replace.
It defaults to `["images", "diagrams", "examples"]`,
indicating that those folders,
if present,
will be included.
<div class=example>
For example, as stated in the example for `BSPrepTR()`,
the CSSWG needs to include its stylesheet in with its specs.
To do so,
it just needs to add the entry `["../default.css", "default.css"]`
to the `files` array,
indicating that Bikeshed should grab the `default.css` file from the parent directory,
and put it in the spec's directory
(in the bundle)
with the same name.
</div>
`bikeshed update` {#cli-update}
-------------------------------
The `update` command updates Bikeshed's datafiles,
which it uses for autolinking and similar things.
By default it'll update all of its datafiles,
but if you want to update only particular ones,
you can pass any or all of the following flags:
* `--anchors` to update Bikeshed's "anchor data" - a list of all the definitions and headers it knows about.
* `--biblio` to update Bikeshed's bibliography database.
* `--caniuse` to update Bikeshed's CanIUse.com information.
* `--link-defaults` to update Bikeshed's manually-maintained list of special linking rules.
* `--test-suites` to update Bikeshed's database of test-suite information from the Shepherd system.
* `--languages` to update Bikeshed's database of language codes/names (used for the [=Translations=] metadata)
* `--wpt` to update Bikeshed's database of WPT tests; see [[#testing]].
By default, Bikeshed's update system relies on the [Bikeshed-Data](http://github.com/tabatkins/bikeshed-data) project,
which preprocesses the various data sources directly into Bikeshed's data formats,
and prepares a manifest of changed files,
letting Bikeshed quickly download only what it needs.
However, this can be up to 10 minutes out of date
(or longer, if the update process has fallen over);
if you need absolutely up-to-date information *right now*,
pass the `--skip-manifest` flag
to force Bikeshed to do its full manual update process.
(You can combine it with any of the flags above to only get the exact files you need.)
`bikeshed refs` {#cli-refs}
---------------------------
The `refs` command lets you search Bikeshed's anchor database,
letting you see what sort of things it's looking at when doing autolinking.
This can be very useful for debugging,
or just for a quick check of where something is defined.
It's flags are similar to the attributes used on autolinks:
* `--text=FOO` to specify the linktext you want to filter for
* `--type=FOO` to specify the link type
* `--for=FOO` to specify the for value
* `--spec=FOO` to specify the spec
* `--status=foo` to specify the status
* `--exact` to turn off the variations that Bikeshed applies to some link texts
(such as looking for "book" when you search for "books"),
and just search for the exact text you specified
Any or all of these flags can be specified,
and Bikeshed will display all the refs it can find matching the criteria.
`bikeshed source` {#cli-source}
-------------------------------
The `source` command applies various transformations to the source document itself,
rather than producing a separate output document.
Its options are described in [[#source]].
`bikeshed issues-list` {#cli-issues-list}
-----------------------------------------
The `issues-list` command processes a plain-text document
in an "issues-list" format pioneered by the CSSWG
into an equivalent HTML version.
Relevant flags:
* `-t` outputs a template issues-list file to stdout,
making it easier to start a new document
without having to reference an old one to remember the format.
Use it like `bikeshed issues-list -t > issues-19700101.txt`.
After the command you can pass the input and output filenames.
As usual, one or both can be omitted:
if you omit the output,
it'll write to a file with the same name as the input,
but a `.html` extension;
it you omit the input,
it will look in the current folder
for any files starting with "issues" and ending in ".txt",
and then extract the digits from those filenames
and select the one with the largest number.
If you name your file as suggested above,
with an ISO date,
it'll correctly always choose the latest issues list.
Issue: Define the issues-list format.
The `-t` output is already more than enough to actually work with,
but it would still be good to describe it more fully.
<!--
██ ██ ████████ ████████ ███ ████████ ███ ████████ ███
███ ███ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
████ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ███ ██ ██████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ██ ██ ██ █████████ ██ ██ █████████ ██ █████████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ██ ████████ ██ ██ ██ ████████ ██ ██ ██ ██ ██
-->
Metadata {#metadata}
====================
Crucial to the processor's ability to automatically generate most of a spec's boilerplate is a small metadata section,
typically located at the top of a file.
A metadata block is just a <code><pre class='metadata'></code> element, with contents like:
```html
Status: UD
TR: http://www.w3.org/TR/css-variables/
ED: http://dev.w3.org/csswg/css-variables/
Shortname: css-variables
Level: 1
Editor: Tab Atkins Jr., Google, http://xanthir.com/contact
Editor: Daniel Glazman, Disruptive Innovations, [email protected]
Abstract: This module introduces cascading variables as a new primitive value type that is accepted by all CSS properties,
and custom properties for defining them.
```
The syntax of a metadata block is very simple - it's a line-based format, with each line consisting of a key and a value, separated by a colon.
Or if you're adding multiple lines with the same key, you can just start the subsequent lines with whitespace to have it reuse the last-seen key.
Several keys are required information, and will cause the processor to flag an error if you omit them:
<ul dfn-for=metadata export>
* <dfn>Title</dfn> is the spec's full title, used to generate both the <{title}> and <{h1}> of the document.
This can alternately be specified by adding an <{h1}> element as the first line of the spec.
Note: The optional [=metadata/H1=] metadata lets you specify the text you want for the document's <{h1}>,
if for some reason you want the <{title}> and <{h1}> to have different text.
For example, some browsers interpret markup as literal text in <{title}>,
so you may want to provide "plain text" in the [=metadata/Title=] metadata
and marked-up text in [=metadata/H1=].
* <dfn>Status</dfn> is the spec's status. There are a few general abbreviations that can be used any group (or specs without a Group at all), and several that are restricted to particular groups.
<details>
<summary>Statuses usable by anyone</summary>
* DREAM: "A Collection of Interesting Ideas"
* LS: "Living Standard"
* LS-COMMIT: "Commit Snapshot"
* LS-BRANCH: "Branch Snapshot"
* LD: "Living Document"
* FINDING: "Finding"
</details>
<details>
<summary>Statuses usable by W3C groups</summary>
* ED: "Editor's Draft"
* WD: "W3C Working Draft"
* FPWD: "W3C First Public Working Draft"
* LCWD: "W3C Last Call Working Draft"
* CR: "W3C Candidate Recommendation Snapshot"
* CRD: "W3C Candidate Recommendation Draft"
* PR: "W3C Proposed Recommendation"
* REC: "W3C Recommendation"
* PER: "W3C Proposed Edited Recommendation"
* WG-NOTE: "W3C Working Group Note"
* IG-NOTE: "W3C Interest Group Note"
* NOTE: "W3C Note" ([unclear what this is used for](https://github.com/w3c/tr-design/issues/124))
* NOTE-ED: "Editor's Draft" of a Group Note
* NOTE-WD: "W3C Working Draft" of a Group Note
* NOTE-FPWD: "W3C First Public Working Draft" of a Group Note
* MO: "W3C Member-only Draft"
* UD: "Unofficial Proposal Draft"
* CG-DRAFT: "Draft Community Group Report"
* CG-FINAL: "Final Community Group Report"
Bikeshed has a listing of what Groups are associated with the W3C.
If your Group isn't on that list,
it'll complain when you try to use a W3C status.
Please file a bug on Bikeshed to add your Group,
and/or prefix your status like `Status: w3c/ED`.
</details>
<details>
<summary>Statuses usable by ISO groups</summary>
* I: "Issue"
* DR: "Defect Report"
* D: "Draft Proposal"
* P: "Published Proposal"
* MEET: "Meeting Announcements"
* RESP: "Records of Response"
* MIN: "Minutes"
* ER: "Editor's Report"
* SD: "Standing Document"
* PWI: "Preliminary Work Item"
* NP: "New Proposal"
* NWIP: "New Work Item Proposal"
* WD: "Working Draft"
* CD: "Committee Draft"
* FCD: "Final Committee Draft"
* DIS: "Draft International Standard"
* FDIS: "Final Draft International Standard"
* PRF: "Proof of a new International Standard"
* IS: "International Standard"
* TR: "Technical Report"
* DTR: "Draft Technical Report"
* TS: "Technical Specification"
* DTS: "Draft Technical Specification"
* PAS: "Publicly Available Specification"
* TTA: "Technology Trends Assessment"
* IWA: "International Workshop Agreement"
* COR: "Technical Corrigendum"
* GUIDE: "Guidance to Technical Committees"
* NP-AMD: "New Proposal Amendment"
* AWI-AMD: "Approved new Work Item Amendment"
* WD-AMD: "Working Draft Amendment"
* CD-AMD: "Committee Draft Amendment"
* PD-AMD: "Proposed Draft Amendment"
* FPD-AMD: "Final Proposed Draft Amendment"
* D-AMD: "Draft Amendment"
* FD-AMD: "Final Draft Amendment"
* PRF-AMD: "Proof Amendment"
* AMD: "Amendment"
Bikeshed has a listing of what Groups are associated with ISO.
If your Group isn't on that list,
it'll complain when you try to use an ISO status.
Please file a bug on Bikeshed to add your Group,
and/or prefix your status like `Status: iso/ER`.
</details>
<details>
<summary>Statuses usable by the TC39 group</summary>
* STAGE0
* STAGE1
* STAGE2
* STAGE3
* STAGE4
</details>
* <dfn>ED</dfn> (or its synonym <dfn>URL</dfn>) must contain a link that points to the most current draft
(typically the "editor's draft", or otherwise the version that's most live and updated).
* <dfn>Shortname</dfn> must contain the spec's shortname, like "css-lists" or "css-backgrounds".
* <dfn>Level</dfn> (or <dfn>Revision</dfn>, an alias) must contain the spec's level as an integer or `none` if the spec does not use levels.
* <dfn>Editor</dfn> must contain an editor's information.
This has a special format of comma-separated clauses
the first is required and must contain the editor's name;
all the rest are optional.
* If editing a W3C document, your W3C ID (the number at the end of the url when you navigate to <a href="https://www.w3.org/users/myprofile">https://www.w3.org/users/myprofile</a>) can be added as a `w3cid ####` clause.
* Your affiliation (company you work for, etc), optionally followed by a link to their homepage, like `Example Company http://example.com`. If your affiliation contains a comma, HTML-escape it (`,`).
* Your email address.
* Your homepage.
All of the optional clauses can occur in any order, except that affiliation must occur before email or homepage.
Multiple <a>Editor</a> lines can be used to supply multiple editors.
* <dfn>Abstract</dfn> must contain an abstract for the spec, a 1-2 sentence description of what the spec is about.
Multiple Abstract lines can be used, representing multiple lines of content, as if you'd written those multiple lines directly into the document.
</ul>
There are several additional optional keys: