From 5654578da4b5caeb278b7abf9790b8f24a0205e9 Mon Sep 17 00:00:00 2001 From: Breck Yunits Date: Wed, 8 Jan 2025 13:30:05 -0800 Subject: [PATCH] More docs --- leetsheet.scroll | 1 + parsers/aftertext.parsers | 2 ++ parsers/assertions.parsers | 6 ++++++ parsers/container.parsers | 2 ++ parsers/css.parsers | 11 +++++++++++ parsers/date.parsers | 3 +++ parsers/delimited.parsers | 2 ++ parsers/dinkus.parsers | 6 ++++++ parsers/documentation.parsers | 10 ++++++++++ parsers/headers.parsers | 10 ++++++++++ parsers/html.parsers | 6 ++++++ parsers/images.parsers | 5 +++++ parsers/javascript.parsers | 2 ++ parsers/leetsheet.parsers | 14 +++++++++++--- parsers/music.parsers | 4 +++- parsers/permalinks.parsers | 2 ++ parsers/theme.parsers | 2 ++ parsers/video.parsers | 2 ++ 18 files changed, 86 insertions(+), 4 deletions(-) diff --git a/leetsheet.scroll b/leetsheet.scroll index 0e245d44c..303e1f25c 100644 --- a/leetsheet.scroll +++ b/leetsheet.scroll @@ -1,4 +1,5 @@ buildCsv +buildJson title Scroll LeetSheet header.scroll diff --git a/parsers/aftertext.parsers b/parsers/aftertext.parsers index eed77c8ee..156ec3707 100644 --- a/parsers/aftertext.parsers +++ b/parsers/aftertext.parsers @@ -344,6 +344,8 @@ aftertextColorParser extends aftertextStyleParser catchAllAtomType cssAnyAtom string property color + example + color blue aftertextOnclickParser popularity 0.000217 diff --git a/parsers/assertions.parsers b/parsers/assertions.parsers index 86d2c7a7f..6f13fd521 100644 --- a/parsers/assertions.parsers +++ b/parsers/assertions.parsers @@ -34,6 +34,9 @@ assertIgnoreBelowErrorsParser assertHtmlEqualsParser extends abstractAssertionParser string kind equal + example + + assertHtmlEquals javascript areEqual(actual, expected) { return actual === expected @@ -44,6 +47,9 @@ assertHtmlEqualsParser assertBuildIncludesParser extends abstractAssertionParser string kind include + example + buildCsv + assertBuildIncludes virginica javascript areEqual(actual, expected) { return actual.includes(expected) diff --git a/parsers/container.parsers b/parsers/container.parsers index b99f8a37a..5898b4582 100644 --- a/parsers/container.parsers +++ b/parsers/container.parsers @@ -2,6 +2,8 @@ scrollContainerParser popularity 0.000096 cue container description A centered HTML div. + example + container 600px catchAllAtomType cssLengthAtom extends abstractAftertextParser boolean isHtml true diff --git a/parsers/css.parsers b/parsers/css.parsers index 054da631a..a4edec5e0 100644 --- a/parsers/css.parsers +++ b/parsers/css.parsers @@ -2,6 +2,8 @@ buildCssParser popularity 0.000048 description Compile to CSS file. extends abstractBuildTwoCommandParser + example + buildCss cssAnyAtom extends codeAtom @@ -15,6 +17,9 @@ cssParser popularity 0.007211 extends abstractScrollParser description A style tag. + example + css + body { color: red;} cueFromId catchAllParser cssLineParser catchAllAtomType cssAnyAtom @@ -47,6 +52,8 @@ scrollBackgroundColorParser extends abstractScrollParser cue background catchAllAtomType cssAnyAtom + example + background red javascript buildHtml() { return `` @@ -70,6 +77,8 @@ scrollFontParser cue font atoms cueAtom fontFamilyAtom catchAllAtomType cssAnyAtom + example + font Slim javascript buildHtml() { const font = this.content === "Slim" ? "Helvetica Neue; font-weight:100;" : this.content @@ -80,6 +89,8 @@ quickCssParser popularity 0.007524 description Make a CSS tag. extends abstractQuickIncludeParser + example + style.css atoms urlAtom pattern ^[^\s]+\.(css)$ javascript diff --git a/parsers/date.parsers b/parsers/date.parsers index fc96b58ec..1451ce410 100644 --- a/parsers/date.parsers +++ b/parsers/date.parsers @@ -35,6 +35,9 @@ printDateParser // If not present computes the date from the file's ctime. description Print published date. boolean isPopular true + example + date 1/11/2019 + printDate javascript buildHtml() { return `
${this.day}
` diff --git a/parsers/delimited.parsers b/parsers/delimited.parsers index dc8fda2bd..21c2a0a24 100644 --- a/parsers/delimited.parsers +++ b/parsers/delimited.parsers @@ -1,5 +1,7 @@ buildCsvParser popularity 0.000096 + example + buildCsv description Compile to CSV file. extends abstractBuildOneCommandParser diff --git a/parsers/dinkus.parsers b/parsers/dinkus.parsers index 5809c5139..92cc705b0 100644 --- a/parsers/dinkus.parsers +++ b/parsers/dinkus.parsers @@ -18,6 +18,8 @@ horizontalRuleParser cue --- description A horizontal rule. extends abstractDinkusParser + example + --- javascript buildHtml() { return `
` @@ -28,6 +30,8 @@ scrollDinkusParser cue *** description A dinkus. Breaks section. boolean isPopular true + example + *** extends abstractDinkusParser javascript dinkus = "*" @@ -43,5 +47,7 @@ endOfPostDinkusParser description End of post dinkus. boolean isPopular true cue **** + example + **** javascript dinkus = "⁂" \ No newline at end of file diff --git a/parsers/documentation.parsers b/parsers/documentation.parsers index 17711bb04..c5dce884e 100644 --- a/parsers/documentation.parsers +++ b/parsers/documentation.parsers @@ -4,6 +4,10 @@ belowAsCodeParser string bindTo next extends abstractScrollParser catchAllAtomType integerAtom + example + belowAsCode + iris + printTable cueFromId javascript method = "next" @@ -71,6 +75,9 @@ belowAsHtmlParser extends belowAsCodeParser description Displays html output of next particle in a code block. cueFromId + example + belowAsHtml + # Hello world javascript get code() { return this.selectedParticles.filter(p => p.buildHtml).map(p => p.buildHtml()).join("\n") @@ -79,6 +86,9 @@ belowAsHtmlParser aboveAsHtmlParser description Displays html output of previous particle in a code block. extends belowAsHtmlParser + example + # Hello world + aboveAsHtml javascript method = "previous" reverse = true diff --git a/parsers/headers.parsers b/parsers/headers.parsers index 39bb88fe0..8b2ccf8f2 100644 --- a/parsers/headers.parsers +++ b/parsers/headers.parsers @@ -19,6 +19,8 @@ h1Parser popularity 0.017918 description An html h1 tag. extends abstractHeaderParser + example + # Hello world boolean isArticleContent true cue # boolean isPopular true @@ -29,6 +31,8 @@ h2Parser popularity 0.005257 description An html h2 tag. extends abstractHeaderParser + example + ## Hello world boolean isArticleContent true cue ## boolean isPopular true @@ -39,6 +43,8 @@ h3Parser popularity 0.001085 description An html h3 tag. extends abstractHeaderParser + example + ### Hello world boolean isArticleContent true cue ### javascript @@ -47,6 +53,8 @@ h3Parser h4Parser popularity 0.000289 description An html h4 tag. + example + #### Hello world extends abstractHeaderParser cue #### javascript @@ -55,6 +63,8 @@ h4Parser h5Parser description An html h5 tag. extends abstractHeaderParser + example + ##### Hello world cue ##### javascript tag = "h5" \ No newline at end of file diff --git a/parsers/html.parsers b/parsers/html.parsers index ee641a1cd..e5955b659 100644 --- a/parsers/html.parsers +++ b/parsers/html.parsers @@ -37,6 +37,8 @@ quickIncludeHtmlParser popularity 0.007524 description Include an HTML file. extends abstractQuickIncludeParser + example + body.html atoms urlAtom pattern ^[^\s]+\.(html|htm)$ javascript @@ -59,6 +61,8 @@ abstractHtmlParser scrollBrParser popularity 0.000096 cue br + example + br 2 description A break. extends abstractScrollParser catchAllAtomType integerAtom @@ -84,6 +88,8 @@ htmlInlineParser extends abstractHtmlParser atoms htmlAnyAtom boolean isHtml true + example +

Inline HTML

pattern ^< description Inline HTML. boolean isPopular true diff --git a/parsers/images.parsers b/parsers/images.parsers index 15f87c6ca..0c4304019 100644 --- a/parsers/images.parsers +++ b/parsers/images.parsers @@ -2,6 +2,9 @@ captionAftertextParser popularity 0.003207 description An image caption. cue caption + example + map.png + caption A map. extends scrollParagraphParser boolean isPopular true @@ -91,6 +94,8 @@ scrollImageParser quickImageParser popularity 0.005788 extends scrollImageParser + example + screenshot.png atoms urlAtom pattern ^[^\s]+\.(jpg|jpeg|png|gif|webp|svg|bmp) int atomIndex 0 \ No newline at end of file diff --git a/parsers/javascript.parsers b/parsers/javascript.parsers index 9363fb2a2..50d67f4c3 100644 --- a/parsers/javascript.parsers +++ b/parsers/javascript.parsers @@ -3,6 +3,8 @@ quickScriptParser description Make a Javascript tag. extends abstractQuickIncludeParser atoms urlAtom + example + script.js pattern ^[^\s]+\.(js)$ javascript buildHtml() { diff --git a/parsers/leetsheet.parsers b/parsers/leetsheet.parsers index ab8d754b9..55c271d4f 100644 --- a/parsers/leetsheet.parsers +++ b/parsers/leetsheet.parsers @@ -86,18 +86,26 @@ printScrollLeetSheetParser getNote() { return "" } - buildCsv() { + get docs() { const rows = this.sortDocs(this.parsersToDocument).map(obj => { - const {id, isPopular, description, popularity, category} = obj + const {id, isPopular, description, popularity, category, examples, cue} = obj + const example = examples.length ? examples[0].subparticlesToString() : cue return { id, isPopular, description, popularity, + example, category } }) - return new Particle(this.root.lodash.sortBy(rows, "isPopular")).asCsv + return this.root.lodash.sortBy(rows, "isPopular") + } + buildJson() { + return JSON.stringify(this.docs, undefined, 2) + } + buildCsv() { + return new Particle(this.docs).asCsv } printparsersLeetSheetParser diff --git a/parsers/music.parsers b/parsers/music.parsers index be12c41d0..a2bf86135 100644 --- a/parsers/music.parsers +++ b/parsers/music.parsers @@ -15,4 +15,6 @@ quickSoundParser extends scrollMusicParser atoms urlAtom pattern ^[^\s]+\.(mp3|wav|ogg|aac|m4a|flac) - int atomIndex 0 \ No newline at end of file + int atomIndex 0 + example + sipOfCoffee.m4a \ No newline at end of file diff --git a/parsers/permalinks.parsers b/parsers/permalinks.parsers index 373ad6a24..e8b7384f3 100644 --- a/parsers/permalinks.parsers +++ b/parsers/permalinks.parsers @@ -2,6 +2,8 @@ baseUrlParser popularity 0.009188 description Required for RSS and OpenGraph. extends abstractUrlSettingParser + example + baseUrl https://hub.scroll.pub/ permalinkParser popularity 0.000265 diff --git a/parsers/theme.parsers b/parsers/theme.parsers index fa3a74c92..8552526bb 100644 --- a/parsers/theme.parsers +++ b/parsers/theme.parsers @@ -6,6 +6,8 @@ scrollThemeParser popularity 0.007524 boolean isPopular true cue theme + example + theme gazette extends abstractScrollParser catchAllAtomType scrollThemeAtom description A collection of simple themes. diff --git a/parsers/video.parsers b/parsers/video.parsers index d1a87dab9..1b7f1ced2 100644 --- a/parsers/video.parsers +++ b/parsers/video.parsers @@ -17,6 +17,8 @@ scrollVideoParser quickVideoParser popularity 0.000024 extends scrollVideoParser + example + spirit.mp4 atoms urlAtom pattern ^[^\s]+\.(mp4|webm|avi|mov) int atomIndex 0 \ No newline at end of file