Skip to content

Commit 4ae98e4

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents 4041030 + ad84b26 commit 4ae98e4

File tree

280 files changed

+55445
-44246
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

280 files changed

+55445
-44246
lines changed

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[submodule "document/core/util/katex"]
22
path = document/core/util/katex
3-
url = https://github.com/Khan/KaTeX.git
3+
url = https://github.com/KaTeX/KaTeX.git

.travis.yml

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,27 @@
1-
language: c++
21
language: python
32
python:
4-
- "2.7"
3+
- "3.7"
4+
dist: bionic
55

6-
sudo: on
6+
addons:
7+
apt:
8+
sources:
9+
- sourceline: 'ppa:avsm/ppa'
10+
- sourceline: 'deb https://dl.yarnpkg.com/debian/ stable main'
11+
key_url: 'https://dl.yarnpkg.com/debian/pubkey.gpg'
12+
update: true
13+
packages:
14+
- opam
15+
- texlive-full
16+
- yarn
717

818
install:
9-
- ./interpreter/meta/travis/install-ocaml.sh
10-
- sudo pip install sphinx
11-
- sudo apt-get install texlive-full
19+
- opam init --auto-setup --compiler=4.07.1
20+
- eval $(opam env)
21+
- opam --version
22+
- ocaml --version
23+
- opam install --yes ocamlbuild.0.14.0
24+
- pip install Sphinx==2.4.4
1225
- git clone https://github.com/tabatkins/bikeshed.git
1326
- pip install --editable $PWD/bikeshed
1427
- bikeshed update

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,7 @@ should take place in
3232
[the WebAssembly design repository](https://github.com/WebAssembly/design)
3333
first, so that this spec repository can remain focused. And please follow the
3434
[guidelines for contributing](Contributing.md).
35+
36+
# citing
37+
38+
For citing WebAssembly in LaTeX, use [this bibtex file](wasm-specs.bib).

document/Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ publish: all deploy
2121
clean: $(DIRS:%=clean-%)
2222
rm -rf $(BUILDDIR)
2323

24+
.PHONY: diff
25+
diff: $(DIRS:%=diff-%)
26+
2427

2528
# Directory-specific targets.
2629

@@ -54,6 +57,10 @@ $(DIRS:%=clean-%): clean-%:
5457
(cd $(@:clean-%=%); make BUILDDIR=$(BUILDDIR) clean)
5558
rm -rf $(BUILDDIR)/$(@:clean-%=%)
5659

60+
.PHONY: $(DIRS:%=diff-%)
61+
$(DIRS:%=diff-%): diff-%:
62+
(cd $(@:diff-%=%); make BUILDDIR=$(BUILDDIR) diff)
63+
5764

5865
# Help.
5966

document/README.md

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,98 @@ To build everything and update [webassembly.github.io/spec](https://webassembly.
2121
make publish
2222
```
2323
Please make sure to only use that once a change has approval.
24+
25+
## Step by step guide to building the spec
26+
27+
### Prerequisites
28+
29+
You will need `python3.7`, and `pip`. `pip` should come with Python, if not follow [these installation instructions for `pip`](https://pip.pypa.io/en/stable/installing/), or check your system package manager for `pip3`.
30+
31+
> Important: you will need the version of pip that works with `python3.7`.
32+
33+
34+
Use something like [`pipenv`](https://pipenv.pypa.io/) to keep your system installation of Python clean.
35+
36+
```
37+
pip install pipenv
38+
pipenv --python 3.7
39+
pipenv shell
40+
```
41+
42+
Install Python dependencies:
43+
44+
```
45+
pip install Sphinx==2.4.4
46+
```
47+
48+
### Checking out the repository
49+
50+
Make sure this repository was cloned with `--recursive`:
51+
52+
```
53+
git clone --recursive https://github.com/WebAssembly/spec
54+
```
55+
56+
If you have already cloned but without `--recursive`, you can delete and re-clone, or `cd` into `spec` and run:
57+
58+
```
59+
git submodule update --init --recursive
60+
```
61+
62+
The rest of these instructions assume you are in the directory where is README is:
63+
64+
```
65+
cd spec/document
66+
```
67+
68+
### Building the multi-page HTML document
69+
70+
You can now build the [multi-page html document](https://webassembly.github.io/spec/core/):
71+
72+
```
73+
make -C core html
74+
```
75+
76+
### Building the single-page HTML document
77+
78+
To build the [single-page W3C version](https://webassembly.github.io/spec/core/bikeshed/), there are more dependencies to install. First, get [Bikeshed](https://github.com/tabatkins/bikeshed):
79+
80+
```
81+
# cd back to root of git directory
82+
git clone https://github.com/tabatkins/bikeshed.git
83+
pip install --editable bikeshed
84+
bikeshed update
85+
```
86+
87+
You will also need `npm` and `yarn` for all the LaTeX goodness. `npm` might already be available on your system, you can also use something like [`nvm`](https://github.com/nvm-sh/nvm) to prevent messing with system packages:
88+
89+
```
90+
npm install -g yarn
91+
cd document
92+
make -C core bikeshed
93+
```
94+
95+
### Building the PDF
96+
97+
To build the [PDF](https://webassembly.github.io/spec/core/_download/WebAssembly.pdf), you will need `texlive-full`, install it using your system package manager:
98+
99+
```
100+
apt install texlive-full
101+
make -C core pdf
102+
```
103+
104+
### Building the JavaScript Embedding API
105+
106+
To build the [JavaScript Embedding API](https://webassembly.github.io/spec/js-api/index.html), you will need `bikeshed` as describe in the section [Building the single-page HTML document](#building-the-single-page-html-document):
107+
108+
```
109+
make -C js-api
110+
```
111+
112+
### Building the Web Embedding API
113+
114+
To build the [Web Embedding API](https://webassembly.github.io/spec/web-api/index.html), you will need `bikeshed` as describe in the section [Building the single-page HTML document](#building-the-single-page-html-document):
115+
116+
```
117+
make -C web-api
118+
```

document/core/Makefile

Lines changed: 53 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,10 @@ STATICDIR = _static
1010
DOWNLOADDIR = _download
1111
NAME = WebAssembly
1212

13-
# Hack until we have moved to more recent Sphinx.
14-
OLDMATHJAX = https://cdn.mathjax.org/mathjax/latest/MathJax.js
15-
NEWMATHJAX = https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js
16-
1713
# Internal variables.
1814
PAPEROPT_a4 = -D latex_paper_size=a4
1915
PAPEROPT_letter = -D latex_paper_size=letter
20-
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
16+
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(SPHINXOPTS) .
2117
# the i18n builder cannot share the environment and doctrees with the others
2218
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
2319

@@ -27,6 +23,9 @@ usage:
2723
@echo " html to make standalone HTML files"
2824
@echo " pdf to make standalone PDF file"
2925
@echo " bikeshed to make a bikeshed wrapped single large HTML file"
26+
@echo " diff to make a diff of the bikeshed HTML file with the latest TR"
27+
@echo " WD-tar generate tar file for updating the Working Draft"
28+
@echo " WD-echidna publish the Working Draft tar file via Echidna"
3029
@echo " all to make all 3"
3130
@echo " publish to make all and push to gh-pages"
3231
@echo " help to see more options"
@@ -90,8 +89,12 @@ bikeshed-keep:
9089
echo Downloaded Bikeshed.
9190

9291

92+
.PHONY: index
93+
index:
94+
(cd appendix; ./gen-index-instructions.py)
95+
9396
.PHONY: pdf
94-
pdf: latexpdf
97+
pdf: index latexpdf
9598
mkdir -p $(BUILDDIR)/html/$(DOWNLOADDIR)
9699
ln -f $(BUILDDIR)/latex/$(NAME).pdf $(BUILDDIR)/html/$(DOWNLOADDIR)/$(NAME).pdf
97100

@@ -102,22 +105,16 @@ clean:
102105
rm -rf $(STATICDIR)
103106

104107
.PHONY: html
105-
html:
108+
html: index
106109
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
107110
for file in `ls $(BUILDDIR)/html/*.html`; \
108111
do \
109112
sed s:BASEDIR:.:g <$$file >$$file.out; \
110113
mv -f $$file.out $$file; \
111-
sed s~$(OLDMATHJAX)~$(NEWMATHJAX)~g <$$file >$$file.out; \
112-
mv -f $$file.out $$file; \
113114
done
114115
for file in `ls $(BUILDDIR)/html/*/*.html`; \
115116
do \
116117
sed s:BASEDIR:..:g <$$file >$$file.out; \
117-
sed 's;<body; <script type="text/javascript">MathJax.Hub.Config({TeX: {MAXBUFFER: 30*1024}})</script><body;' \
118-
<$$file.out >$$file; \
119-
rm -f $$file.out; \
120-
sed s~$(OLDMATHJAX)~$(NEWMATHJAX)~g <$$file >$$file.out; \
121118
mv -f $$file.out $$file; \
122119
done
123120
@echo
@@ -139,18 +136,60 @@ singlehtml:
139136
bikeshed:
140137
$(SPHINXBUILD) -b singlehtml -c util/bikeshed \
141138
$(ALLSPHINXOPTS) $(BUILDDIR)/bikeshed_singlehtml
139+
python util/bikeshed_fixup.py $(BUILDDIR)/bikeshed_singlehtml/index.html \
140+
>$(BUILDDIR)/bikeshed_singlehtml/index_fixed.html
142141
mkdir -p $(BUILDDIR)/bikeshed_mathjax/
143142
bikeshed spec index.bs $(BUILDDIR)/bikeshed_mathjax/index.html
144143
mkdir -p $(BUILDDIR)/html/bikeshed/
144+
(cd util/katex/ && yarn && yarn build && npm install --only=prod)
145145
python util/mathjax2katex.py $(BUILDDIR)/bikeshed_mathjax/index.html \
146146
>$(BUILDDIR)/html/bikeshed/index.html
147147
mkdir -p $(BUILDDIR)/html/bikeshed/katex/dist/
148148
cp -r util/katex/dist/* $(BUILDDIR)/html/bikeshed/katex/dist/
149149
patch -p0 $(BUILDDIR)/html/bikeshed/katex/dist/katex.css \
150150
< util/katex_fix.patch
151+
cp $(BUILDDIR)/bikeshed_singlehtml/_static/pygments.css \
152+
$(BUILDDIR)/html/bikeshed/
151153
@echo
152154
@echo "Build finished. The HTML page is in $(BUILDDIR)/html/bikeshed/."
153155

156+
.PHONY: WD-tar
157+
WD-tar: bikeshed
158+
@echo "Building tar file..."
159+
tar cvf \
160+
$(BUILDDIR)/WD.tar \
161+
--transform='s|$(BUILDDIR)/html/bikeshed/||' \
162+
--transform='s|index.html|Overview.html|' \
163+
$(BUILDDIR)/html/bikeshed/index.html \
164+
$(BUILDDIR)/html/bikeshed/pygments.css \
165+
$(BUILDDIR)/html/bikeshed/katex/dist/katex.css \
166+
$(BUILDDIR)/html/bikeshed/katex/dist/fonts
167+
@echo "Built $(BUILDDIR)/WD.tar."
168+
169+
.PHONY: WD-echidna
170+
WD-echidna: WD-tar
171+
@if [ -z $(W3C_USERNAME) ] || \
172+
[ -z $(W3C_PASSWORD) ] || \
173+
[ -z $(DECISION_URL) ] ; then \
174+
echo "Must provide W3C_USERNAME, W3C_PASSWORD, and DECISION_URL environment variables"; \
175+
exit 1; \
176+
fi
177+
curl 'https://labs.w3.org/echidna/api/request' \
178+
--user '$(W3C_USERNAME):$(W3C_PASSWORD)' \
179+
-F "tar=@$(BUILDDIR)/WD.tar" \
180+
-F "decision=$(DECISION_URL)" | tee $(BUILDDIR)/WD-echidna-id.txt
181+
@echo
182+
@echo "Published working draft. Check its status at https://labs.w3.org/echidna/api/status?id=`cat $(BUILDDIR)/WD-echidna-id.txt`"
183+
184+
.PHONY: diff
185+
diff: bikeshed
186+
@echo "Downloading the old single-file html spec..."
187+
curl `grep "^TR" index.bs | cut -d' ' -f2` -o $(BUILDDIR)/html/bikeshed/old.html
188+
@echo "Done."
189+
@echo "Diffing new against old (go get a coffee)..."
190+
perl ../util/htmldiff.pl $(BUILDDIR)/html/bikeshed/old.html $(BUILDDIR)/html/bikeshed/index.html $(BUILDDIR)/html/bikeshed/diff.html
191+
@echo "Done. The diff is at $(BUILDDIR)/html/bikeshed/diff.html"
192+
154193
.PHONY: pickle
155194
pickle:
156195
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
@@ -223,7 +262,7 @@ latex:
223262
latexpdf:
224263
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
225264
@echo "Running LaTeX files through pdflatex..."
226-
$(MAKE) -C $(BUILDDIR)/latex all-pdf
265+
$(MAKE) -C $(BUILDDIR)/latex LATEXMKOPTS=" </dev/null" all-pdf >$(BUILDDIR)/latex/LOG 2>&1 || cat $(BUILDDIR)/latex/LOG
227266
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
228267

229268
.PHONY: latexpdfja

0 commit comments

Comments
 (0)