- HTML 100%
| assets | assets/: Remove the other version files | |
| htmlize.ed | Fix <libref> syntax to allow inline tags in it | |
| makefile | Rename r7rs.html to source.html for clarity of purpose | |
| README.org | README: <xref> requirement for unescaped content is lifted now | |
| source.html | Escape double quotes | |
HTML5 Rendering of Scheme R7RS Standard
This is a project of modernizing HTML for R7RS (with errata encorporated.) Right now, the only HTML version on the Internet is this auto-converted version. It’s broken, with dozens of unnecessary newlines and non-semantic markup. It’s not really navigable either. So the goals for this project are:
- Fix formatting to more or less match the PDF one, or even improve on it
- Hyperlink everything
- Allow for arbitrary styling of HTML content
- Introduce semantic tags for easier processing
- Be friendly to different screen sizes, including mobile
- Hopefully achieve something of the level of Common Lisp HyperScpec.
Getting Started
Clone the repo:
git clone https://codeberg.org/aartaka/r7rs-html5
and build the index.html file (requires ed(1), the standard text editor—and nothing else:)
make clean index.html
The resulting file (yes, it’s all of the standard in a single file) is ready for styling and hosting,
Self-hosting
You can host index.html as is, given that it’s also bundled with the /phm/r7rs-html5/src/branch/main/assets directory images.
(Will be unnecessary once all the formulas are translated to HTML/MathML.)
Check the pages branch for an example of how my styling (r7rs.aartaka.me) of the spec looks.
And consult Codeberg Pages docs to see the machinery setting it in motion.
pages branch changes
-
prettify.ed script adding
- Stylesheet reference
- Nav header
- favicon/manifest references
- And the note on the original repository
- a bunch of favicon files and web app manifest
- screen.css with all the styles applied to the page
- and index.html, the output of the generation. Explicitly committed to the repository for Codeberg Pages deployment.
Explanation
The source file (/phm/r7rs-html5/src/branch/main/source.html) has some custom tags for references and easier writing. Build script (/phm/r7rs-html5/src/branch/main/htmlize.ed) processes these into valid HTML5 tags. If you want to customize the conversion (add classes, change the format of the resulting tags,) then edit the script file and re-generate
Special tags:
- <xref>symbol</xref>
- to reference standard procedures/syntax.
- <secref X.X.X>
- to reference sections of the document
- <libref name>
- to reference one of the standard libraries
- <bibref>integer</bibref>
- to reference one of the bibliography references
- <syntax [library]>(name ...)</syntax>, procedure, auxiliary-syntax, lexical-syntax (same format as <syntax>)
- tags for semantic definitions of entities, possibly with library names
- <h2 id>
- Also note the special syntax
<h2 ID>,<h3 ID>etc. for headers, because it allows generating sensible section IDs and self-references.
Classes to style:
- note
- class for side notes, like Note or Rationale sections
- example
-
for possibly runnable small code blocks exemplifying some procedure or feature
-
Other code blocks are plain
<pre>-s, so style accordingly- Example blocks are
<pre>too, just in case
- Example blocks are
-
- author
-
for author display customization in the report preamble
- authors
- container for author groups
- xref, secref, bibref, libref
- for results of tags above,
<a>links by default - syntax, procedure, auxiliary-syntax, lexical-syntax
- results of generation from
<syntax>and the kind,<h5>by default
Changes to the original document
Many of these changes are encoded in the /phm/r7rs-html5/src/branch/main/htmlize.ed script, but some were hand-edited into the document. The version hosted on standards.scheme.org was taken as a departure point and improved over.
-
Of course, many non-semantic tags were replaced with semantic (or at least less evil) counterparts from HTML5:
<i>to<em>(<dfn>might be preferable for some cases, but it’s not added yet)<span style="font-family:monospace">(what? yes, that’s what it used!) to<code>- Arbitrary
<br>-s to semantic structures like<table>,<pre>, and<dl>.
- Section links were expanded to include "section" and "chapter" for easier clicking/tapping. I.e., "see section [XXX]" became "see [section XXX]".
- Evaluation results (these
⟹expressions) are comments now, for ease of parsing and highlighting -
Standard libraries and symbols were heavily hyperlinked to point to the most sensible document section describing them. Including links in
<pre>blocks that some might deem un-aesthetic. The usefulness of these in allowing a quick lookup greatly exceeds their "ugliness."-
If you wish to, you can remove them by adding this (untested) line to htmlize.ed and rebuild:
g;<pre>;.,/<\/pre>/s;</*xref>;;g
-
-
Most procedure arguments have associated type information in their tooltips now. I allowed myself a liberty of expanding these type descriptions, as in
port => port, an input and output device (see section 6.13.1) -
HTML document is heavy with newlines, for readability.
- Some source code blocks had newlines inserted for consistency and ease of read on mobile.
Contributing
Contributions are welcome, because I couldn’t possibly iron out all the translation mistakes myself. And I might not know about some features of HTML (and MathML in particular) I’m missing. So please fix things and open a pull request with them! Nice to have for contributions:
- Group edits into semantic batches and split into commits
- Format commits in "Action—rationale" style
-
Some editing conventions:
- If you see overly long lines (> 120 chars), split them at sentence or clause boundaries. This way, even the source code is readable.
-
Do not introduce styles or scripts—this is left for downstream users to customize.
- Exceptions can be made for accessibility fixes needing JavaScript to work
- Use of historic HTML shortcuts (unclosed
<p>, using closing tags to close stack of unclosed ones) is okay, but better do stricter HTML than lax