Configurabel Script to create notes depending on folder

I wanted to have my new notes configured with a template depending on the folder. I have many folders. I only wanted to use one template. The template should be not complicated.

Some frontmatter entries or variables for the template are the same for many folders. I wanted to write those only once.

So I wrote a Script (at github MonikaLobinger foty), which fulfills this all.

I think it is good and I would like to give it to persons with the same needs. Problem is, that my English is ok for reading, but not so good for explaining.

Example: You have defined to note types, book and test. book has folder “book” assigned and test folder “test”. Book as attribute “publish” to true and test to false. A first line and a last line for both should be the same.

You create a new note in folder “book” and get one with publish “true”, you create a new not in folder “book/test” and it has publish “false” and in folder “book/comic” it has publish “true”. Both have the same first and last lines

The configuration for this:

let example_configuration3 = {
  SECTION_NOTETYPES: {
    defaults: {
      __SPEC: {REPEAT: true},  
      yaml: {__SPEC: {RENDER: false,},
        publish:          {__SPEC:false, DEFAULT: true, TYPE: "Boolean", },
      },
      show: { __SPEC: {RENDER: true,},
      type:      {__SPEC:false, DEFAULT: cbkNoteType, TYPE: "(String|Function)",},
      firstline: {__SPEC:false, DEFAULT: "First Line", TYPE: "String",},
      lastline: {__SPEC:false, DEFAULT: "##Footnotes", TYPE: "String",},
      },    
    },
    book: { folders: ["book"], },
    test: { folders: ["test"], yaml: { publish: false, }, },
  }
}
user_configuration = example_configuration3

1 Like