diff --git a/.gitignore b/.gitignore index 77157cbf8..3bba35f7e 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,7 @@ scrollNodePerf.cpuprofile tests/importExamples/ tests/kitchenSink/style.css tests/kitchenSink/posts.csv +tests/kitchenSink/prompt.txt # Do not check in files built by Scroll *.html diff --git a/grammar/plainText.grammar b/grammar/plainText.grammar new file mode 100644 index 000000000..61650cef4 --- /dev/null +++ b/grammar/plainText.grammar @@ -0,0 +1,13 @@ +plainTextParser + description Use for plain text one liners and/or blocks of plain text. + cruxFromId + extends abstractScrollParser + catchAllParser plainTextLineParser + catchAllCellType stringCell + javascript + compile() { + return `${this.content ?? ""}${this.childrenToString()}` + } +plainTextLineParser + catchAllCellType stringCell + catchAllParser plainTextLineParser \ No newline at end of file diff --git a/grammar/source.grammar b/grammar/source.grammar new file mode 100644 index 000000000..3c2f943ac --- /dev/null +++ b/grammar/source.grammar @@ -0,0 +1,12 @@ +printSourceParser + description Prints out the source code for each file in a group. + extends printFeedParser + example + printSource index + permalink source.txt + javascript + compile() { + const file = this.root.file + const files = file.getFilesInGroupsForEmbedding(this.getWordsFrom(1)).map(file => file.file) + return `${files.map(file => file.filePath + "\n " + file.originalScrollCode.replace(/\n/g, "\n ") ).join("\n")}` + } \ No newline at end of file diff --git a/package.json b/package.json index 1608d2125..dcf7e630c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "scroll-cli", - "version": "73.0.0", + "version": "73.1.0", "description": "Tools for thoughts.", "main": "scroll.js", "engines": { diff --git a/releaseNotes.scroll b/releaseNotes.scroll index 580040935..2d67161ce 100644 --- a/releaseNotes.scroll +++ b/releaseNotes.scroll @@ -4,6 +4,10 @@ title Scroll Release Notes startColumns +# 73.1.0 4/05/2024 +- 🎉 added `plainText` keyword +- 🎉 added `printSource` keyword to be able to dump the source code for a group of posts to a plain text file. + # 73.0.0 4/03/2024 - 🎉 added `printCsv` keyword to make it as easy to generate a CSV of a blog as it is to generate an RSS feed diff --git a/scroll.js b/scroll.js index b5719b096..bf5c254e2 100755 --- a/scroll.js +++ b/scroll.js @@ -313,7 +313,7 @@ class ScrollFile { const content = this.scrollProgram.compile().trim() // Don't add html tags to XML/RSS/CSV feeds. A little hacky as calling a getter named _html_ to get _xml_ is not ideal. But // <1% of use case so might be good enough. - const wrapWithHtmlTags = permalink.endsWith(".xml") || permalink.endsWith(".rss") || permalink.endsWith(".csv") ? false : true + const wrapWithHtmlTags = permalink.endsWith(".xml") || permalink.endsWith(".rss") || permalink.endsWith(".csv") || permalink.endsWith(".txt") ? false : true this._compiledStandalonePage = wrapWithHtmlTags ? `` + content + "" : content } return this._compiledStandalonePage diff --git a/tests/kitchenSink/source.scroll b/tests/kitchenSink/source.scroll new file mode 100644 index 000000000..0f62bf8f2 --- /dev/null +++ b/tests/kitchenSink/source.scroll @@ -0,0 +1,12 @@ +import settings.scroll +permalink prompt.txt +// Demonstrates a technique for building a big prompt to give to an LLM. + +plainText + Instructions: + Below are the files in a blog. I want you to read them, and then perform the following tasks, and give me your results in the format of a git patch so I can easily apply your changes on my local computer and commit them. + + Tasks: + + The Files: +printSource index