[HN Gopher] Stamp: A Mini-Language for Templates
       ___________________________________________________________________
        
       Stamp: A Mini-Language for Templates
        
       Author : breck
       Score  : 34 points
       Date   : 2024-06-23 17:07 UTC (3 days ago)
        
 (HTM) web link (scroll.pub)
 (TXT) w3m dump (scroll.pub)
        
       | kkukshtel wrote:
       | [deleted] - i was wrong!
        
         | acmiyaguchi wrote:
         | 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.
        
         | 0perator wrote:
         | 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
        
           | ofrzeta wrote:
           | Discussed here (122 comments): "Storing knowledge in a single
           | long plain text file"
           | https://news.ycombinator.com/item?id=40432834
        
       | noelwelsh wrote:
       | A good first step would be writing some real documentation for
       | this. The example is not sufficient.
        
         | pimlottc wrote:
         | "We will start with the firemen, then the math teachers and so
         | on in that fashion until everyone is eaten"
        
       | ianbicking wrote:
       | 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!
        
       ___________________________________________________________________
       (page generated 2024-06-26 23:02 UTC)