Comments (5)
As you mentioned on #29, this is a direct result of not explicitly specifying the -t mustache
parameter. There's unfortunately no easy way for the tool to infer which templating language you want to use.
The makeVariableTrackerProxy
function is ultimately a hack (and an ugly one at that), and one that should eventually rather be replaced by proper parsing of the template to expose its variables.
In the meantime, it should suffice to just catch this type of error during the execution of the new
command and add a hint to the effect of: (did you perhaps forget to specify the template type?)
.
from themis-contract.
Perhaps this bit of code in https://github.com/informalsystems/neat-contract/tree/master/src/shared/template-helpers.ts is responsible:
Seems likely to be originating in this function:
const makeVariableTrackerProxy = (parentObj: object, parents: string[], trackedVars: Map<string, any>): object => {
return new Proxy(parentObj, {
get: (target, name) => {
if (typeof name === 'symbol') {
return ''
}
if (name === 'toHTML') {
return (): string => ''
}
const varName = String(name)
logger.debug(`Found potential template variable: ${varName}`)
trackVariable(trackedVars, parents, varName)
return makeVariableTrackerProxy(target, [...parents, varName], trackedVars)
},
})
}
Both due to the log locations, and due to the fact this function can return either a string
or a function string -> string
. At some point, a consumer of the values from this function is getting that empty string out and trying to apply it as a function
from themis-contract.
Cool, I'll add that fix when I get a moment. Thanks!
from themis-contract.
What about changing the default templating language to be mustache too? It seems to me preferable, both because we are using it more pervasively, and because it's more constrained.
from themis-contract.
Sure, let's make Mustache the default 👍 I'll open an issue.
from themis-contract.
Related Issues (20)
- compile needs a sanity check for variables typos, etc. HOT 3
- do comments in the markdown get included as metadata in the rendered PDF ? HOT 2
- error when no upstream set in `contract.dhall` and running `themis-contract upstream diff`
- compile should have option to commit & push
- compile should bind the: signature+underline+name together HOT 2
- explore & document how to best use pandoc for optimizing .docx -> .md conversions
- compile panics when there is error in the mustache templating
- compile: change `dhall-to-json output` verbosity (on error) from DBG to ERR
- signing should insert the current date/time/hash alongside the signature
- Identify logical unit tags from commit messages as well as github issues and pull requests HOT 1
- [TRC-IMPL.2::PREFIX.2] Record tag implementatino relationships HOT 1
- compile will sign if the signature files are present in the directory HOT 2
- create an invoicing template
- `new` command fails when attempting to create Git repo
- Dockerfile
- Get rid of IDs for signatures/signatories and just use e-mail addresses HOT 2
- General project context/history questions HOT 4
- themis-contract new [path/to/template.md] HOT 2
- auto push & auto commit should be off by default HOT 1
- themis-contract compile [--update] flag HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from themis-contract.