Skip to content

Creating a Static Snapshot from the Command Line

Denis Ah-Kang edited this page Aug 3, 2020 · 2 revisions

To produce static output for your spec source from the command line, you can use a command-line HTTP client such as wget or curl and POST your ReSpec source document to the W3C https://labs.w3.org/spec-generator/ spec-generator service as a file upload; for example:

curl -F "file=@source.html" https://labs.w3.org/spec-generator/ > index.html

That command causes curl to read the source.html file from the current directory, send an HTTP POST request with the contents of that file as the value of the file field in the request, and then write the response to the index.html file.

That index.html file is a dump of the source.html file’s DOM, generated by processing the source with ReSpec — that is, exactly the same output you get by manually using Ctrl+Shift+Alt+S within the document itself and picking "Save as HTML (Source)" to save the output.

You can use additional -F flags with curl to specify particular ReSpec configuration options:

curl -F "file=@source.html" -F "shortName=dahut" -F specStatus="ED" \
     -F "publishDate=2020-02-21" https://labs.w3.org/spec-generator/ > index.html

If your respec document is composed of multiples files (html, js, etc), you can submit a tarball of all the files (see Echidna's wiki on how to create the tarball). The main file should be named 'index.html' and all the other resources should be relative to that file. As above, you can use the following command to send the tarball.

curl -F "file=@source.tar" https://labs.w3.org/spec-generator/ > index.html

See also respecDocWriter tool.

Clone this wiki locally