From 04e1c1b0b1eddd0446577a353fceed566083d8ca Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Tue, 17 Oct 2023 02:01:23 +0200 Subject: [PATCH] Fix cheatsheet style on small screens --- _includes/cheatsheet-text.md | 12 ++++++------ preserves.css | 17 +++++++++++------ 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/_includes/cheatsheet-text.md b/_includes/cheatsheet-text.md index b3136cf..f206a39 100644 --- a/_includes/cheatsheet-text.md +++ b/_includes/cheatsheet-text.md @@ -1,17 +1,17 @@ -{:.postcard-grammar} +{:.postcard-grammar.textsyntax} | *Document* | := | *Value* **ws** | | *Value* | := | **ws** (*Record* | *Collection* | *Atom* | *Embedded* | *Annotated*) | | *Collection* | := | *Sequence* | *Dictionary* | *Set* | | *Atom* | := | *Boolean* | *ByteString* | *String* | *QuotedSymbol* | *Symbol* | *Number* | | **ws** | := | (**space** | **tab** | **cr** | **lf** |`,`) | -{:.postcard-grammar} +{:.postcard-grammar.textsyntax} | *Record* | := | `<`*Value*+ **ws**`>` | | *Sequence* | := | `[`*Value* **ws**`]` | | *Dictionary* | := | `{` (*Value* **ws**`:`*Value*) **ws**`}` | | *Set* | := | `#{`*Value* **ws**`}` | -{:.postcard-grammar} +{:.postcard-grammar.textsyntax} | *Boolean* | := | `#t`|`#f` | | *ByteString* | := | `#"`*binchar* `"`|`#x"` (**ws** *hex* *hex*) **ws**`"`|`#[` (**ws** | *base64char*) **ws**`]` | | *String* | := | `"` (« any unicode scalar value except `\` or `"` » | *escaped* |`\"`) `"` | @@ -22,12 +22,12 @@ | *Double* | := | *flt* |`#xd"` (**ws** *hex* *hex*)8 **ws**`"` | | *SignedInteger* | := | *int* | -{:.postcard-grammar} +{:.postcard-grammar.textsyntax} | *Embedded* | := | `#!`*Value* | | *Annotated* | := | *Annotation* *Value* | | *Annotation* | := | `@`*Value* |`;`« any unicode scalar value except **cr** or **lf** » (**cr** | **lf**) | -{:.postcard-grammar} +{:.postcard-grammar.textsyntax} | *escaped* | := | `\\`|`\/`|`\b`|`\f`|`\n`|`\r`|`\t`|`\u`*hex* *hex* *hex* *hex* | | *binchar* | := | *binunescaped* | (*escaped* |`\"`|`\x`*hex* *hex*) | | *binunescaped* | := | « any unicode scalar value ≥32 and ≤126, except `\` or `"` » | @@ -35,7 +35,7 @@ | *sympunct* | := | `~`|`!`|`$`|`%`|`^`|`&`|`*`|`?`|`_`|`=`|`+`|`-`|`/`|`.` | | *symuchar* | := | « any scalar value ≥128 whose Unicode category is Lu, Ll, Lt, Lm, Lo, Mn, Mc, Me, Nd, Nl, No, Pc, Pd, Po, Sc, Sm, Sk, So, or Co » | -{:.postcard-grammar} +{:.postcard-grammar.textsyntax} | *flt* | := | *int* ( *frac* *exp* | *frac* | *exp* ) | | *int* | := | (`-`|`+`) (`0`..`9`)+ | | *frac* | := | `.` (`0`..`9`)+ | diff --git a/preserves.css b/preserves.css index 8bd89bf..aec65ba 100644 --- a/preserves.css +++ b/preserves.css @@ -184,19 +184,24 @@ td { font-family: var(--sans-font); font-size: 1rem; color: #888; - line-height: 1.414rem; + line-height: 141.4%; } table.postcard-grammar { background: #e9f0f9; } +@media screen and (max-width: 768px) { table.postcard-grammar { font-size: 0.75rem; } } .postcard-grammar.binarysyntax { color: black; } -.postcard-grammar tr > *:nth-child(1) { width: 7em; text-align: right; } -.postcard-grammar.binarysyntax tr > *:nth-child(1) { width: 13em; text-align: right; } +.postcard-grammar tr > *:nth-child(1) { text-align: right; } +.postcard-grammar.textsyntax tr > *:nth-child(1) { width: 7em; } +.postcard-grammar.binarysyntax tr > *:nth-child(1) { width: 13em; } +@media screen and (max-width: 580px) { + .postcard-grammar.binarysyntax tr > *:nth-child(1) { width: auto; } +} .postcard-grammar tr > *:nth-child(2) { width: 1em; text-align: center; } .postcard-grammar sup { color: #040; - font-size: 0.9rem; + font-size: 90%; } .postcard-grammar em { color: black; } -.postcard-grammar .roman { font-family: var(--serif-font); font-size: 1.05rem; } +.postcard-grammar .roman { font-family: var(--serif-font); font-size: 105%; } .postcard-grammar strong { color: #400; font-weight: normal; } .postcard-grammar td { vertical-align: top; @@ -204,7 +209,7 @@ table.postcard-grammar { background: #e9f0f9; } .postcard-grammar pre, .postcard-grammar code { color: black; display: inline-block; - font-size: 1rem; + font-size: 100%; padding: 0 0.33rem; } .postcard-grammar .outputish { background: #eee; color: black; }