document-metaprogrammer
v1.0.0
Published
A small document meta-programming app in node
Downloads
1
Readme
Document Metaprogrammer
A small document meta-programming app in node.
Setup
Install:
npm i -g document-metaprogrammer
Run:
document-metaprogrammer
This will listen to .meta.*
files below your working directory and continuously process them.
Example
The basic idea is:
- Define a
.meta.*
file:
example-0.meta.py
# < @number=[3,4,5]
def multiply_by_number(value):
return number * value
# >
Let the document-metaprogrammer run! This should continuously build the finished file in the background.
Expected output is:
example-0.py
def multiply_by_3(value):
return 3 * value
def multiply_by_4(value):
return 4 * value
def multiply_by_5(value):
return 5 * value
Another example:
example-1.meta.js
// < @value=[foo, bar, baz]
const say_value = () => {
console.log('value')
}
// >
module.exports = {
// < @value=[foo, bar, baz]
say_value,
// >
}
example-1.js
const say_foo = () => {
console.log('foo')
}
const say_bar = () => {
console.log('bar')
}
const say_baz = () => {
console.log('baz')
}
module.exports = {
say_foo,
say_bar,
say_baz,
}
More Details
See inside the examples
folder for more details of whats possible!