Skip to content

Common Lisp HyperSpec - Modernize by rainslide

Screenshot of Common Lisp HyperSpec - Modernize

Details

Authorrainslide

LicenseAGPL-3.0-or-later

Categoryprogramming, doc, document, reference, spec, specification, ancient, antique, lisp, common-lisp, lispworks

Created

Updated

Size8.5 kB

Statistics

Learn how we calculate statistics in the FAQ.

Failed to fetch stats.

Description

Make CLHS great again!

Layout, typesetting, visual style, dark theme, hopefully I got everything covered.

  • Layout changes:
    • centered <body>
    • every visual element is properly gapped and aligned
    • multi-column for some lists
  • Typesetting changes:
    • sets a max width for content
    • text-align: justify
  • Visual style changes:

Notes

CLHS is copyrighted by LispWorks Ltd. Common Lisp HyperSpec is a trademark of Lispworks Ltd. See offical infomation about its authorship and legal infomation.

For topic related to modernizing CLHS, or userstyle for CLHS, you really need to read the Conditions of Use part of the Copyright and Conditions of Use section. For example, you can't add or replace any links or any graphical images to any of its pages.

Source code

/* ==UserStyle==
@name           Common Lisp HyperSpec - Modernize
@description    Make CLHS great again
@namespace      RainSlide
@author         RainSlide
@version        1.0.3
@license        AGPL-3.0-or-later
@var text  body-max-width  "Max width of <body>"  48em
==/UserStyle== */

@-moz-document regexp("https?:\\/\\/(www\\.lispworks\\.com\\/documentation\\/HyperSpec|clhs\\.lisp\\.se)\\/(.+(\\/|\\.htm([?#].*)?)?)?") {
/* All pages */

/* Typesetting & font */
:root {
	text-align: justify;
	font-family: serif;
	line-height: 1.8;
}

	/* Layout */

/* Set a max width to <body> & centerize <body> */
body { max-width: var(--body-max-width); margin: 1em auto; }
body:empty { display: none; }

/* Unify vertical spacing to 1em */
/* Shrink the font size of <h1> to prevent possible overflow on:
https://www.lispworks.com/documentation/HyperSpec/Front/index_tx.htm */
body { padding: 1em; }
body > hr {  margin: 1em 0; }
body > h1:first-of-type {
	font-size: 1.5em;
	margin: 0 0 calc(2em / 3);
}


	/* header */

/* Center the content of the "header" */
body > h1:first-of-type {
	display: flex;
	justify-content: center;
	align-items: start;
}

/* [rev="MADE"], [rel="TOP"], [rel="PREV"], [rel="UP"], [rel="NEXT"] */

/* Push PREV, UP and NEXT to the right */
body > h1:first-of-type > a[rel="TOP"] { margin-right: auto; }

/* Add spacing between PREV, UP and NEXT */
body > h1:first-of-type > a[rel="UP"]  { margin: 0 20px; }


	/* footer */

/* Add spacing between the "footer" image links */
/* After the last <hr>, a[rel="COPYRIGHT"] should be the only text link. */
body > hr:last-of-type ~ a[rel]:not([rel="COPYRIGHT"]) { margin-right: 1em; }

/* Center the "footer" image links */
body > hr:last-of-type + a[rel] {
	/* (100% - 6 * (80px + 2 * 2px) - 5 * 1em) / 2 */
	margin-left: calc(50% - 252px - 2.5em);
}

/* Set the display of <a>s of image links from inline to inline-block
Currect their size (mostly, height) and vertical-align */
a { display: inline-block; }

/* When styling CLHS, image links (<a><img></a>) is one of the major problems.

...TODO

*/

/* Colors */

/* Fix & expand the original stylesheet:
https://www.lispworks.com/documentation/HyperSpec/Data/clhs.css */
html { background-color: #EEE; }
body { background-color: white; }

hr        { color: #218AE7; } /* hsl(208, 80%, 52%) */

a:link    { color: #4C66D9; } /* hsl(229, 65%, 57%) */
a:visited { color: #31418C; } /* hsl(229, 48%, 37%) */
a:hover,
a:focus   { color: #7488E2; } /* hsl(229, 65%, 67%) */
a:active  { color: #2A47C6; } /* hsl(229, 65%, 47%) */

/* a:hover { color: red; } */ /* IE 5 default */

h1 ~ img, h1 ~ * img { border: 2px solid currentcolor; }

a { text-decoration: none; }
a:hover,
a:focus { text-decoration: underline; }

a:hover  img,
a:focus  img { filter: brightness(.95); }
a:active img { filter: brightness(.9); }

/* color transitions */
html, body, a, img { transition: .1s ease; }
html, body { transition-property: color, background-color; }
a          { transition-property: color; }
img        { transition-property: color, border-color, filter; }

@media (prefers-color-scheme: dark) {
	html { background-color: #151515; color: #F5F5F5; }
	body { background-color: #303030; }

	a:link    { color: #218AE7; } /* hsl(208, 80%, 52%) */
	a:visited { color: #4C66D9; } /* hsl(229, 65%, 57%) */
	a:hover,
	a:focus   { color: #51A3EC; } /* hsl(208, 80%, 62%) */
	a:active  { color: #1571C1; } /* hsl(208, 80%, 42%) */

	/* dark filter for images */
	:root { --dark-filter: invert() hue-rotate(180deg) brightness(.9); }

	a img { filter: var(--dark-filter); mix-blend-mode: screen; }

	a:hover  img,
	a:focus  img { filter: var(--dark-filter) brightness(1.25); }
	a:active img { filter: var(--dark-filter) brightness(1.5); }

}

}

@-moz-document regexp("https?:\\/\\/(www\\.lispworks\\.com\\/documentation\\/HyperSpec|clhs\\.lisp\\.se)\\/Front\\/(index(_tx)?\\.htm([?#].*)?)?") {
/* Index pages */

/* Center <body>, both horizontal and vertical */
html {
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	min-height: 100%;
}

/* Align the author to the end in <blockquote> */
body > blockquote > p:last-child { text-align: end; }

}

@-moz-document url("about:nowhere") {
/* Front/index.htm: HTML source ref */

/* The "flashier" index page is a disaster. */

/* <body>

<h1>
	<a rev="MADE"><img alt="[LISPWORKS]"></a>
	<a rel="META"><img alt="[Common Lisp HyperSpec (TM)]"></a>
</h1>

<hr>

<blockquote>
Welcome to the <i>Common Lisp HyperSpec</i>.<br>
I hope it serves your need.
<p>
	--<I><a rev="MADE">Kent Pitman</a></i>, X3J13 Project Editor
</p>
</blockquote>

<hr>

<a rel="NAVIGATOR"><img alt="[Starting Points]"></a>
Here are some useful <a rel="NAVIGATOR">starting points</a>:

<p>
	<a rel="NAVIGATOR"><img alt="[Highlights]"></a>
	<a rel="TOC"      ><img alt="[Contents]"  ></a>
	<a rel="INDEX"    ><img alt="[Index]"     ></a>
	<a rel="INDEX"    ><img alt="[Symbols]"   ></a>
	<a rel="GLOSSARY" ><img alt="[Glossary]"  ></a>
	<a rel="META"     ><img alt="[Issues]"    ></a>
</p>

<p>
	<a rel="META"><img alt="[Help]"></a>
	A <a>text-only version of this cover sheet</a> is available.
<p>

<hr>

<A rel="COPYRIGHT"><i>Copyright 1996-2005, LispWorks Ltd.  All Rights Reserved.</i></a>

<p></p>

</body> */

}

@-moz-document regexp("https?:\\/\\/(www\\.lispworks\\.com\\/documentation\\/HyperSpec|clhs\\.lisp\\.se)\\/Front\\/(index\\.htm([?#].*)?)?") {
/* Front/index.htm: Default index page */

/* vertical-align: middle everything inside <body>, the hard way */

/*
hr:nth-of-type(2)
a[rel="NAVIGATOR"][href="../Front/StartPts.htm"] Here are some...
p:nth-of-type(1) > ( a[rel], a[rel], a[rel], a[rel], a[rel], a[rel] )
p:nth-of-type(2) > a[rel="META"][href="../Front/Help.htm#Top"] A text-only...
hr:nth-of-type(3)
*/

body * { vertical-align: bottom; }

body {
	/* (image height - line height) / 2  */
	--offset: calc( 20px - .75em );
	--plus-offset:  calc( 1em + var(--offset) );
	--minus-offset: calc( 1em - var(--offset) );
}

/* add spacing between the image links */
body >  p:nth-of-type(1)          { padding: 0 .5em; }
body >  p:nth-of-type(1) > a[rel] {  margin: 0 .5em; }

body > hr:nth-of-type(2) + a[rel="NAVIGATOR"][href="Front/StartPts.htm"],
body > hr:nth-of-type(2) + a[rel="NAVIGATOR"][href="../Front/StartPts.htm"],
body >  p:nth-of-type(2) > a[rel="META"][href="Front/Help.htm#Top"],
body >  p:nth-of-type(2) > a[rel="META"][href="../Front/Help.htm#Top"] {
	margin-left: 1em;
	margin-right: .5em;
	position: relative;
	top: var(--offset);
}

body > hr:nth-of-type(2),
body >  p:nth-of-type(1) {
	margin-bottom: var(--minus-offset);
}
body >  p:nth-of-type(1),
body > hr:nth-of-type(3) {
	margin-top:    var( --plus-offset);
}
body >  p:nth-of-type(2) {
	margin-top:    var(--minus-offset);
	margin-bottom: var( --plus-offset);
}

}

@-moz-document regexp("https?:\\/\\/(www\\.lispworks\\.com\\/documentation\\/HyperSpec|clhs\\.lisp\\.se)\\/Front\\/index_tx\\.htm([?#].*)?") {
/* Front/index_tx.htm: Text-only index page */
/* Overrides: body > h1:first-child { display: flex; } */
body > h1:first-of-type { display: block; text-align: center; }
}

@-moz-document regexp("https?:\\/\\/(www\\.lispworks\\.com\\/documentation\\/HyperSpec|clhs\\.lisp\\.se)\\/Front\\/Help\\.htm([?#].*)?") {
/* Front/Help.htm: About the Common Lisp HyperSpec (TM) */
body > a[name] { display: block; }
}

@-moz-document regexp("https?:\\/\\/(www\\.lispworks\\.com\\/documentation\\/HyperSpec|clhs\\.lisp\\.se)\\/Issues\\/I_Categ\\.htm([?#].*)?"), regexp("https?:\\/\\/(www\\.lispworks\\.com\\/documentation\\/HyperSpec|clhs\\.lisp\\.se)\\/Front\\/(X_.+|Contents|index_tx|StartPts)\\.htm([?#].*)?") {
/* Lists that can have 2 columns */
body > ol, body > ul { columns: 2; }
}

@-moz-document regexp("https?:\\/\\/(www\\.lispworks\\.com\\/documentation\\/HyperSpec|clhs\\.lisp\\.se)\\/Front\\/StartPts\\.htm([?#].*)?") {
/* Front/StartPts.htm: Starting Points */
ul { padding: 0 1em; }
ul > * { vertical-align: middle; }
ul > a { margin: .5em; }
}

@-moz-document regexp("https?:\\/\\/(www\\.lispworks\\.com\\/documentation\\/HyperSpec|clhs\\.lisp\\.se)\\/Front\\/X_.+\\.htm([?#].*)?") {
/* Front/X_*.htm: Symbol Indexes */
ul { font-family: monospace; }
}

Reviews

No reviews yet.