Skip to content

Commit

Permalink
Add computed filename measure
Browse files Browse the repository at this point in the history
  • Loading branch information
Breck Yunits authored and Breck Yunits committed May 10, 2024
1 parent f7e83a2 commit a19358f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion grammar/concepts.grammar
Expand Up @@ -10,7 +10,7 @@ loadConceptsParser
const path = require("path")
const {file} = this.parent
const folder = path.join(file.folderPath, this.getWord(1))
const ONE_BIG_FILE = Disk.getFiles(folder).filter(file => file.endsWith(".scroll")).map(fullPath => Disk.read(fullPath)).join("\n\n").replace(/import .+/g, "")
const ONE_BIG_FILE = Disk.getFiles(folder).filter(file => file.endsWith(".scroll")).map(fullPath => Disk.read(fullPath) + `\nfilename ${path.basename(fullPath)}\n`).join("\n\n").replace(/import .+/g, "")
this.parent.concat(ONE_BIG_FILE)
//console.log(ONE_BIG_FILE)
return ""
Expand Down
11 changes: 11 additions & 0 deletions grammar/measures.grammar
Expand Up @@ -67,6 +67,17 @@ idParser
extends abstractStringMeasureParser
int sortIndex 0

filenameParser
// Added by the loadConcepts keyword
description What is the name of the file holding this concept?
extends abstractStringMeasureParser
boolean isComputed true
int sortIndex 1
javascript
computeValue(concept, measureName, parsedProgram) {
return concept.get("filename") || parsedProgram.file.filename
}

// Numeric Measures
abstractNumericMeasureParser
string typeForCsvDocs number
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "scroll-cli",
"version": "85.3.0",
"version": "85.4.0",
"description": "A language for bloggers. A curated collection of tools for thoughts.",
"main": "scroll.js",
"engines": {
Expand Down
3 changes: 3 additions & 0 deletions releaseNotes.scroll
Expand Up @@ -4,6 +4,9 @@ title Scroll Release Notes

thinColumns

# 85.4.0 5/10/2024
- 🎉 Scroll now auto-adds a "filename" measure as to which file the concept appears in.

# 85.3.0 5/10/2024
- 🎉 Scroll now only wraps compiler output with html tags if permalink ends in "html" or "htm". Makes it easier to use Scroll to compile files to different language targets.

Expand Down

0 comments on commit a19358f

Please sign in to comment.