Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Stamp: A Mini-Language for Templates (scroll.pub)
46 points by breck on June 26, 2024 | hide | past | favorite | 10 comments


A good first step would be writing some real documentation for this. The example is not sufficient.


"We will start with the firemen, then the math teachers and so on in that fashion until everyone is eaten"


Very... confusing?

I'm assuming you define a file system structure using filenames and indentation, with names ending with a / meaning a directory, and content indented under a filename meaning the file contents. But it actually took me several takes to correctly read the indentation.

The result is a kind of text-only zip archive? That's not very helpful.

Actual templates have substitutions, like you enter the name of your project and that's used in the text of the files. You could do that as a preprocessing step, I guess, but what's the point? Also it will be hard to ensure the integrity of the archive if you do simple textual substitutions.

Also I'm pretty sure from the code that you can just make an archive like this:

    ~/.ssh/config
     let me overwrite your file!


> Actual templates have substitutions, like you enter the name of your project and that's used in the text of the files.

You could have a settings file in your template for those substitutions. For example:

    stamp
     settings.scroll
      replace TITLE My Blog
      replace AUTHOR Breck Yunits
     index.scroll
      import settings.scroll
      title TITLE
      author AUTHOR
      import footer.scroll
     footer.scroll
      import settings.scroll
      You are reading TITLE


[deleted] - i was wrong!


They aren't making something for the JS ecosystem: they're defining a new data serialization format built on explicitly defined input parsers (Scroll), and for one reason or another, its current implementation is in JS.

It turns out that creating a data serialization format built on explicitly defined parsers has uses beyond the ontological use cases, and there are several expressions of Scroll that are useful for technical use cases, such as Stamp for templating and ScrollSets[1] for structured data. The ScrollSets page is an excellent demonstration of how Scroll can be used to serialize data for human- and machine-consumption.

[1]: https://scroll.pub/blog/scrollsets.html


Discussed here (122 comments): "Storing knowledge in a single long plain text file" https://news.ycombinator.com/item?id=40432834


The first paragraph seems self-explanatory, and the templating language is simple enough that you can infer what it does when it runs. There's nothing about this that seems JS ecosystem specific, other than being implemented in a language that itself is implemented in javascript. I can imagine building a stamp interpreter in Python for example, it's not doing very much other than touching and catting text into files.


> Regardless if you specialize in React, Rails, Django, Next, Java, C#, or ObjectiveC, you probably use templates to start new projects.

Java, C#, or ObjectiveC devs are unlikely to want their first command at the shell to start with `npm`, or the software supply chain fiasco npm drags in.

That said, to jump in, here's a better starting point than this HN post link:

- Overview: https://scroll.pub/

- Not helpful: https://notation.scroll.pub/

- More helpful: https://scroll.pub/tutorial.html

- Source: https://github.com/breck7/scroll

If you want more, you can sponsor breckyunits lab for $499,999 a year:

https://breckyunits.com/lab.html


- Very helpful: your ratings of all the current docs.

Made some updates. Thank you.

> If you want more, you can sponsor breckyunits lab for

There's an easter egg there ;).

And there's a cheaper option: https://scroll.pub/wws.html ($100 for 10 years :) )




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: