Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loving Carbone so far. Is there any way to limit which substitutions take place? Aka, only replace specific {d.value} elements. #27

Open
jason-medeiros opened this issue Feb 22, 2019 · 3 comments
Labels
P: Low S: on hold The issue is on hold until further notice T: Feature A new feature

Comments

@jason-medeiros
Copy link

I'm generating massive reports, and want to only replace certain elements at a time. I noticed that if I have {d.value} elements in a document, and don't set a value, carbone just overwrites them with empty strings.

Is there some way to turn off this functionality? I essentially want to load a set of records into memory, run the rendering routine in carbone, produce a report, and have the empty values preserved in the generated report as {d.value} strings.

That way I can just update reports with loaded data instead of storing gigs of data in memory prior to generation.

Thanks! (Carbone is awesome btw, have used it to generate 1000 page+ reports so far with zero issues)

@viincenb
Copy link
Contributor

Interesting usage 🤔, Carbone does not have this kind of feature but this could be implemented.

@jason-medeiros
Copy link
Author

Interesting usage thinking, Carbone does not have this kind of feature but this could be implemented.

If it was just a setting in the render options, I'd absolutely appreciate it. As of right now, I'm working around it by having replacements replace themselves with the same value (aka {d.value} gets replaced with {d.value}), but it doesn't work with values that utilize a formatter routine, so it limits me greatly.

Another request would be async formatters. That way when a formatter is called, I could "await" on remote values pulled from a database/network endpoint and dynamically fill in data. Right now, the formatters are normal functions only which means waiting for async data is a no-go.

@steevepay steevepay added P: Low S: on hold The issue is on hold until further notice T: Feature A new feature labels Oct 8, 2019
@steevepay
Copy link
Member

Hi @jason-medeiros,

First thank for your feedback !
Your main request can be an interesting feature. We are thinking about 2 possible implementations:

  • The way you have described: enable an options to leave missing substitutions markers into the template when the value doesn't exist.
  • Print on the console warning messages when it missing markers values.
    We will investigate soon and come back to you.

About an async formatter, can you open a new issue "feature request" to separate requests ?

Reach me if you need help about carbone.

@steevepay steevepay mentioned this issue May 14, 2020
21 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P: Low S: on hold The issue is on hold until further notice T: Feature A new feature
Projects
None yet
Development

No branches or pull requests

3 participants