Skip to content

Commit

Permalink
better html gen
Browse files Browse the repository at this point in the history
  • Loading branch information
breck7 committed Jan 14, 2025
1 parent 343c52f commit dad5fd9
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 14 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "scroll-cli",
"version": "166.2.0",
"version": "166.3.0",
"description": "A language for scientists of all ages. A curated collection of tools for refining and sharing thoughts.",
"main": "scroll.js",
"engines": {
Expand Down
9 changes: 8 additions & 1 deletion parsers/aftertext.parsers
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,18 @@ abstractAftertextParser
this.buildSettings = buildSettings
const { className, styles } = this
const classAttr = className ? `class="${this.className}"` : ""
const selfClose = this.isSelfClosing ? " /" : ""
const tag = this.get("tag") || this.tag
if (tag === "none") // Allow no tag for aftertext in tables
return this.text
const id = this.has("id") ? "" : `id="${this.htmlId}" ` // always add an html id
return this.getHtmlRequirements(buildSettings) + `<${tag} ${id}${this.htmlAttributes}${classAttr}${styles}>${this.htmlContents}${this.closingTag}`
return this.getHtmlRequirements(buildSettings) + `<${tag} ${id}${this.htmlAttributes}${classAttr}${styles}${selfClose}>${this.htmlContents}${this.closingTag}`
}
get htmlContents() {
return this.text
}
get closingTag() {
if (this.isSelfClosing) return ""
const tag = this.get("tag") || this.tag
return `</${tag}>`
}
Expand Down Expand Up @@ -357,6 +359,11 @@ aftertextHrefParser
extends abstractAftertextAttributeParser
atoms cueAtom urlAtom

aftertextSrcParser
extends aftertextHrefParser
cue src
description Set HTML src attribute.

aftertextOnclickParser
popularity 0.000217
cue onclick
Expand Down
28 changes: 17 additions & 11 deletions parsers/html.parsers
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,14 @@ htmlInlineParser
return `${this.getLine() ?? ""}${this.subparticlesToString()}`
}

abstractHtmlElementParser
extends abstractIndentableParagraphParser
javascript
defaultClassName = ""

htmlSectionParser
description HTML section tag.
extends abstractIndentableParagraphParser
extends abstractHtmlElementParser
cue section
example
section
Expand All @@ -113,7 +118,7 @@ htmlSectionParser

htmlHeaderParser
description HTML header tag.
extends abstractIndentableParagraphParser
extends abstractHtmlElementParser
cue header
example
header
Expand All @@ -123,7 +128,7 @@ htmlHeaderParser

htmlFooterParser
description HTML footer tag.
extends abstractIndentableParagraphParser
extends abstractHtmlElementParser
cue footer
example
footer
Expand All @@ -133,7 +138,7 @@ htmlFooterParser

htmlMainParser
description HTML main tag.
extends abstractIndentableParagraphParser
extends abstractHtmlElementParser
cue main
example
main
Expand All @@ -143,7 +148,7 @@ htmlMainParser

htmlNavParser
description HTML nav tag.
extends abstractIndentableParagraphParser
extends abstractHtmlElementParser
cue nav
example
nav
Expand All @@ -154,7 +159,7 @@ htmlNavParser

htmlPreParser
description HTML pre tag.
extends abstractIndentableParagraphParser
extends abstractHtmlElementParser
cue pre
example
pre
Expand All @@ -163,7 +168,7 @@ htmlPreParser

htmlUlParser
description HTML ul tag.
extends abstractIndentableParagraphParser
extends abstractHtmlElementParser
cue ul
example
ul
Expand All @@ -173,7 +178,7 @@ htmlUlParser

htmlOlParser
description HTML ol tag.
extends abstractIndentableParagraphParser
extends abstractHtmlElementParser
cue ol
example
ol
Expand All @@ -183,7 +188,7 @@ htmlOlParser

htmlLiParser
description HTML li tag.
extends abstractIndentableParagraphParser
extends abstractHtmlElementParser
cue li
example
ol
Expand All @@ -193,16 +198,17 @@ htmlLiParser

htmlImgParser
description HTML img tag.
extends abstractIndentableParagraphParser
extends abstractHtmlElementParser
cue img
example
img foo.png
javascript
tag = "img"
isSelfClosing = true

htmlAParser
description HTML a tag.
extends abstractIndentableParagraphParser
extends abstractHtmlElementParser
cue a
example
a Home
Expand Down
2 changes: 1 addition & 1 deletion parsers/root.parsers
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ scrollParser
}
get scrollVersion() {
// currently manually updated
return "166.2.0"
return "166.3.0"
}
// Use the first paragraph for the description
// todo: add a particle method version of get that gets you the first particle. (actulaly make get return array?)
Expand Down
4 changes: 4 additions & 0 deletions releaseNotes.scroll
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ ciBadges.scroll
br
thinColumns

📦 166.3.0 1/14/2025
🎉 added aftertextSrcParser
🏥 remove defaultClass on htmlElements

📦 166.2.0 1/14/2025
🎉 added htmlImgParser

Expand Down

0 comments on commit dad5fd9

Please sign in to comment.