Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
breck7 committed Sep 14, 2024
1 parent 363b82b commit eff9818
Show file tree
Hide file tree
Showing 29 changed files with 60 additions and 56 deletions.
6 changes: 3 additions & 3 deletions blog/markups.parsers
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ abstractMarkupLangParser
catchAllParser markupLineParser
javascript
compile() {
return this.compiler(this.childrenToString())
return this.compiler(this.subparticlesToString())
}
get compiler() {
try {
Expand Down Expand Up @@ -58,6 +58,6 @@ bbCodeParser
javascript
packageName = "ya-bbcode"
compile() {
if (!this.isPackageInstalled(this.packageName)) return this.childrenToString()
return new this.compiler().parse(this.childrenToString())
if (!this.isPackageInstalled(this.packageName)) return this.subparticlesToString()
return new this.compiler().parse(this.subparticlesToString())
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "scroll-cli",
"version": "131.0.0",
"version": "132.0.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 Expand Up @@ -50,7 +50,7 @@
"image-size": "^1.0.2",
"lodash": "^4.17.21",
"minimist": "^1.2.5",
"scrollsdk": "^85.2.0"
"scrollsdk": "^86.0.0"
},
"devDependencies": {
"tap": "^18.7.2"
Expand Down
2 changes: 1 addition & 1 deletion parsers/chat.parsers
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ chatParser
return this.map((line, index) => line.asString ? `<div style="text-align: ${index % 2 ? "right" : "left"};" class="scrollChat ${index % 2 ? "scrollChatRight" : "scrollChatLeft"}"><span>${line.asString}</span></div>` : "").join("")
}
compileTxt() {
return this.childrenToString()
return this.subparticlesToString()
}
4 changes: 2 additions & 2 deletions parsers/code.parsers
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ codeParser
two = 1 + 1
javascript
compile() {
return `<code class="scrollCodeBlock">${this.childrenToString().replace(/\</g, "&lt;")}</code>`
return `<code class="scrollCodeBlock">${this.subparticlesToString().replace(/\</g, "&lt;")}</code>`
}
compileTxt() {
return this.childrenToString()
return this.subparticlesToString()
}
cruxFromId

Expand Down
2 changes: 1 addition & 1 deletion parsers/css.parsers
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ cssParser
return `<style>${this.css}</style>`
}
get css() {
return this.content ?? this.childrenToString()
return this.content ?? this.subparticlesToString()
}
compileCss() {
return this.css
Expand Down
2 changes: 1 addition & 1 deletion parsers/dashboard.parsers
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ scrollDashboardParser
return `<table class="scrollDashboard">${this.tableBody}</table>`
}
compileTxt() {
return this.childrenToString()
return this.subparticlesToString()
}
12 changes: 6 additions & 6 deletions parsers/heatrix.parsers
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ heatrixParser
compile() {
// A hacky but simple way to do this for now.
const advanced = new Particle("heatrixAdvanced")
advanced.appendLineAndChildren("table", "\n " + this.tableData.replace(/\n/g, "\n "))
const particle = this.appendSibling("heatrixAdvanced", advanced.childrenToString())
advanced.appendLineAndSubparticles("table", "\n " + this.tableData.replace(/\n/g, "\n "))
const particle = this.appendSibling("heatrixAdvanced", advanced.subparticlesToString())
const html = particle.compile()
particle.destroy()
return html
}
get tableData() {
const {coreTable} = this.parent
if (!coreTable)
return this.childrenToString()
return this.subparticlesToString()
let table = new Particle(coreTable).asSsv
if (this.parent.firstWord === "transpose") {
// drop first line after transpose
Expand Down Expand Up @@ -94,8 +94,8 @@ heatrixAdvancedParser
numbers.unshift(0)
return generateColorBinningString(numbers, colors);
}
const table = particle.getParticle("table").childrenToString()
const scale = particle.getParticle("scale")?.childrenToString() || buildScale(table)
const table = particle.getParticle("table").subparticlesToString()
const scale = particle.getParticle("scale")?.subparticlesToString() || buildScale(table)
const thresholds = []
const colors = []
scale.split("\n").map((line) => {
Expand Down Expand Up @@ -221,5 +221,5 @@ heatrixAdvancedParser
).replace(/\n/g, "")
}
}
return new Heatrix(this.childrenToString().trim()).html
return new Heatrix(this.subparticlesToString().trim()).html
}
2 changes: 1 addition & 1 deletion parsers/hoverNote.parsers
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ hoverNoteParser
return [`class="scrollHoverNote"`, `title="${this.hoverNoteText}"`]
}
get hoverNoteText() {
return this.childrenToString().replace(/\n/g, " ")
return this.subparticlesToString().replace(/\n/g, " ")
}
6 changes: 3 additions & 3 deletions parsers/html.parsers
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ abstractHtmlParser
catchAllCellType htmlAnyCell
javascript
compile() {
return `${this.content ?? ""}${this.childrenToString()}`
return `${this.content ?? ""}${this.subparticlesToString()}`
}
compileTxt() {
return ""
Expand Down Expand Up @@ -61,7 +61,7 @@ htmlInlineParser
boolean isPopular true
javascript
compile() {
return `${this.getLine() ?? ""}${this.childrenToString()}`
return `${this.getLine() ?? ""}${this.subparticlesToString()}`
}

stumpContentParser
Expand All @@ -76,7 +76,7 @@ stumpParser
javascript
compile() {
const file = this.parent.file
return file.compileStumpCode(this.childrenToString())
return file.compileStumpCode(this.subparticlesToString())
}

stumpNoSnippetParser
Expand Down
4 changes: 2 additions & 2 deletions parsers/images.parsers
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ scrollImageParser
return `<a href="${clickLink}" target="${target}" ${className} ${id}><img src="${linkRelativeToCompileTarget}" ${dimensionAttributes}loading="lazy"></a>`
}
compileTxt() {
const children = this.filter(particle => particle.compileTxt).map(particle => particle.compileTxt()).filter(i => i).join("\n")
return "[Image Omitted]" + (children ? "\n " + children.replace(/\n/g, "\n ") : "")
const subparticles = this.filter(particle => particle.compileTxt).map(particle => particle.compileTxt()).filter(i => i).join("\n")
return "[Image Omitted]" + (subparticles ? "\n " + subparticles.replace(/\n/g, "\n ") : "")
}

quickImageParser
Expand Down
4 changes: 2 additions & 2 deletions parsers/katex.parsers
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ katexParser
compileInstance() {
const id = this._getUid()
const content = this.content === undefined ? "" : this.content
return `<div class="scrollKatex" id="${id}">${content + this.childrenToString()}</div>`
return `<div class="scrollKatex" id="${id}">${content + this.subparticlesToString()}</div>`
}
compileTxt() {
return ( this.content ? this.content : "" )+ this.childrenToString()
return ( this.content ? this.content : "" )+ this.subparticlesToString()
}
14 changes: 7 additions & 7 deletions parsers/leetsheet.parsers
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ printUsageStatsParser
particle.appendLine("delimiter ")
particle.appendLine("printTable")
const dataParticle = particle.appendLine("data")
dataParticle.setChildren(this.stats)
dataParticle.setSubparticles(this.stats)
const html = particle.compile()
particle.destroy()
return html
Expand All @@ -43,13 +43,13 @@ printScrollLeetSheetParser
javascript
get parsersToDocument() {
const clone = this.root.clone()
clone.setChildren("")
clone.setSubparticles("")
const words = clone.getAutocompleteResultsAt(0,0).matches.map(a => a.text)
words.push("blankline") // manually add blank line
words.push("Catch All Paragraph.") // manually add catch all paragraph
words.push("<h></h>") // manually add html
words.sort()
clone.setChildren(words.join("\n").replace(/blankline/, "")) // insert blank line in right spot
clone.setSubparticles(words.join("\n").replace(/blankline/, "")) // insert blank line in right spot
return clone
}
sortDocs(docs) {
Expand All @@ -66,10 +66,10 @@ printScrollLeetSheetParser
}
makeLink(examples, crux) {
// if (!examples.length) console.log(crux) // find particles that need docs
const example = examples.length ? examples[0].childrenToString() : crux
const example = examples.length ? examples[0].subparticlesToString() : crux
const base = `https://try.scroll.pub/`
const particle = new Particle()
particle.appendLineAndChildren("scroll", "gazetteCss\n" + example)
particle.appendLineAndSubparticles("scroll", "gazetteCss\n" + example)
return base + "#" + encodeURIComponent(particle.asString)
}
docToHtml(doc) {
Expand Down Expand Up @@ -130,7 +130,7 @@ printparsersLeetSheetParser
const parserParticle = clone.getParticle("anyCell")
const words = clone.getAutocompleteResultsAt(1,1).matches.map(a => a.text)
words.sort()
parserParticle.setChildren(words.join("\n"))
parserParticle.setSubparticles(words.join("\n"))
return parserParticle
}
get parsersToDocument() {
Expand All @@ -139,7 +139,7 @@ printparsersLeetSheetParser
const parserParticle = clone.getParticle("latinParser")
const words = clone.getAutocompleteResultsAt(1,1).matches.map(a => a.text)
words.sort()
parserParticle.setChildren(words.join("\n"))
parserParticle.setSubparticles(words.join("\n"))
clone.appendLine("myParser")
clone.appendLine("myCell")
return parserParticle
Expand Down
2 changes: 1 addition & 1 deletion parsers/links.parsers
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ linkParser
catchAllParser programLinkParser
javascript
get encoded() {
return encodeURIComponent(this.childrenToString())
return encodeURIComponent(this.subparticlesToString())
}
cruxFromId
javascript
Expand Down
2 changes: 1 addition & 1 deletion parsers/loops.parsers
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ scrollLoopParser
}
}
get items() {
const provider = this.getChildInstancesOfParserId("abstractItemsProviderParser")[0]
const provider = this.getSubparticleInstancesOfParserId("abstractItemsProviderParser")[0]
if (provider)
return provider.items
if (this.parent.coreTable)
Expand Down
2 changes: 1 addition & 1 deletion parsers/measures.parsers
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ abstractTextareaMeasureParser
baseParser blobParser
javascript
get measureValue() {
return this.childrenToString().replace(/\n/g, "\\n")
return this.subparticlesToString().replace(/\n/g, "\\n")
}

abstractEmailMeasureParser
Expand Down
8 changes: 4 additions & 4 deletions parsers/paragraphs.parsers
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ paragraphParser
return compiled
}
compileTxt() {
const children = this.filter(particle => particle.compileTxt).map(particle => particle.compileTxt()).filter(i => i).join("\n")
const subparticles = this.filter(particle => particle.compileTxt).map(particle => particle.compileTxt()).filter(i => i).join("\n")
const dateline = this.getParticle("dateline")
return (dateline ? dateline.day + "\n\n" : "") + (this.originalText || "") + (children ? "\n " + children.replace(/\n/g, "\n ") : "")
return (dateline ? dateline.day + "\n\n" : "") + (this.originalText || "") + (subparticles ? "\n " + subparticles.replace(/\n/g, "\n ") : "")
}

quickParagraphParser
Expand All @@ -33,13 +33,13 @@ abstractIndentableParagraphParser
extends paragraphParser
inScope abstractAftertextDirectiveParser abstractAftertextAttributeParser abstractIndentableParagraphParser
javascript
compileChildren() {
compileSubparticles() {
return this.map(particle => particle.compile())
.join("\n")
.trim()
}
compile() {
return super.compile() + this.compileChildren()
return super.compile() + this.compileSubparticles()
}
compileTxt() {
return this.getWord(0) + " " + super.compileTxt()
Expand Down
4 changes: 2 additions & 2 deletions parsers/quotes.parsers
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ quoteParser
extends abstractScrollParser
javascript
compile() {
return `<blockquote class="scrollQuote">${this.childrenToString()}</blockquote>`
return `<blockquote class="scrollQuote">${this.subparticlesToString()}</blockquote>`
}
compileTxt() {
return this.childrenToString()
return this.subparticlesToString()
}

quickQuoteParser
Expand Down
4 changes: 2 additions & 2 deletions parsers/root.parsers
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ scrollParser
}
compile(compileSettings) {
this.sectionStack = []
return this.map(child => child.compile(compileSettings)).filter(i => i).join("\n") + this.clearSectionStack()
return this.map(subparticle => subparticle.compile(compileSettings)).filter(i => i).join("\n") + this.clearSectionStack()
}
sectionStack = []
clearSectionStack() {
Expand All @@ -87,7 +87,7 @@ scrollParser
alreadyRequired = new Set()
compileEmbeddedVersion(compileSettings) {
this.sectionStack = []
return this.map(child => (child.compileEmbeddedVersion ? child.compileEmbeddedVersion(compileSettings) : child.compile(compileSettings)))
return this.map(subparticle => (subparticle.compileEmbeddedVersion ? subparticle.compileEmbeddedVersion(compileSettings) : subparticle.compile(compileSettings)))
.filter(i => i)
.join("\n")
.trim() + this.clearSectionStack()
Expand Down
2 changes: 1 addition & 1 deletion parsers/script.parsers
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ scriptParser
return `<script>${this.scriptContent}</script>`
}
get scriptContent() {
return this.content ?? this.childrenToString()
return this.content ?? this.subparticlesToString()
}
compileJs() {
return this.scriptContent
Expand Down
2 changes: 1 addition & 1 deletion parsers/search.parsers
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ printSearchTableParser
particle.appendLine("delimiter ")
particle.appendLine("printTable")
const dataParticle = particle.appendLine("data")
dataParticle.setChildren("title titleLink text date wordCount minutes".replace(/ /g, "\t") + "\n" + data)
dataParticle.setSubparticles("title titleLink text date wordCount minutes".replace(/ /g, "\t") + "\n" + data)
const html = particle.compile()
particle.destroy()
return html
Expand Down
2 changes: 1 addition & 1 deletion parsers/snippets.parsers
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ printSnippetsParser
const linkRelativeToCompileTarget = compileSettings.relativePath + file.permalink
const joinChar = "\n"
const html = scrollProgram
.map((child, index) => (index >= endSnippetIndex ? "" : child.compileEmbeddedVersion ? child.compileEmbeddedVersion(compileSettings) : child.compile(compileSettings)))
.map((subparticle, index) => (index >= endSnippetIndex ? "" : subparticle.compileEmbeddedVersion ? subparticle.compileEmbeddedVersion(compileSettings) : subparticle.compile(compileSettings)))
.filter(i => i)
.join(joinChar)
.trim() +
Expand Down
2 changes: 1 addition & 1 deletion parsers/stamp.parsers
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ stampFileParser
const fullPath = path.join(parentDir, this.getLine())
this.root.file.log(`Creating file ${fullPath}`)
fs.mkdirSync(path.dirname(fullPath), {recursive: true})
const content = this.childrenToString()
const content = this.subparticlesToString()
fs.writeFileSync(fullPath, content, "utf8")
const isExecutable = content.startsWith("#!")
if (isExecutable) fs.chmodSync(fullPath, "755")
Expand Down
2 changes: 1 addition & 1 deletion parsers/tables.parsers
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ scrollTableParser
return this.fileContent
const dataParticle = this.getParticle("data")
if (dataParticle)
return dataParticle.childrenToString()
return dataParticle.subparticlesToString()
// if not dataparticle and no filename, check [permalink].csv
if (this.isNodeJs())
return this.root.readFile(this.root.permalink.replace(".html", "") + ".csv")
Expand Down
2 changes: 1 addition & 1 deletion parsers/test.parsers
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ assertHtmlEqualsParser
}
getErrors() {
const actual = this._getClosestOlderSibling().compile()
const expected = this.childrenToString()
const expected = this.subparticlesToString()
if (actual === expected)
return []
return [this.makeError(`'${actual}' did not match '${expected}'`)]
Expand Down
2 changes: 1 addition & 1 deletion parsers/text.parsers
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ plainTextParser
return this.compileTxt()
}
compileTxt() {
return `${this.content ?? ""}${this.childrenToString()}`
return `${this.content ?? ""}${this.subparticlesToString()}`
}

plainTextOnlyParser
Expand Down
2 changes: 1 addition & 1 deletion particlesLeetsheet.scroll
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ thinColumns 3
- Every line is a particle and every particle is one line.
- Newlines separate particles.
- The words in a particle are separated by a single space.
- An indent of +1 space makes a particle a child particle of the parent line.
- An indent of +1 space makes a particle a subparticle of the parent line.
- Particles has no syntax errors; every document is a valid Particles document.

endColumns
Expand Down
Loading

0 comments on commit eff9818

Please sign in to comment.