Skip to content

static snapshots

Sid Vishnoi edited this page Jul 2, 2020 · 17 revisions

Creating Static Snapshots

Of course the downside of the approach taken by ReSpec is that the specification as it is expected to be, with all its bells and whistles, exists only in your browser's memory as a DOM. Publishing directly with the script would not work as the source would not pass PubRules. Also, as ReSpec process the document each time a page is visited, it might not feel efficient or quick enough (though ReSpec does a great job caching things for repeating visits). The good news is that ReSpec allows you to export a "static snapshot" on processed document. There is no bad news here.

Using Browser

To save a snapshot from browser itself, click the ReSpec menu button on top-right side of page and select "Export" to open the export menu. You can also hit the Ctrl+Shift+Alt+S key combination for the same. Unless you know what you are doing, pick "HTML" as export format. This will produce a dump of the processed source, which you can download as a HTML file for your specification snapshot. The process is a little bit tedious, but normally you should only need to do it very rarely. You can hit Esc to hide the menu.

Using Spec Generator service

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

Using respec2html tool

TODO

Guides

Configuration options

W3C Configuration options

Linter rules

Internal properties

Handled by ReSpec for you.

Special <section> IDs

HTML elements

Custom Elements

WebIDL

HTML attributes

CSS Classes

Special properties

Clone this wiki locally