Comments (9)
I would prefer to see a callback to render rather than an in-place
substitution/expansion, personally. It would be more flexible than in-place
substitution. Your request would be accomplished by handing it a callback that
appends to a file.
Original comment by [email protected]
on 5 Feb 2009 at 12:18
from ctemplate.
Thanks, Foster,
But is there any callback hooking mechanism in current version? could you please
describe it in more detail ?
thanks very much!
Original comment by [email protected]
on 5 Feb 2009 at 5:46
from ctemplate.
There is no such callback that I am aware of, I was simply trying to add to the
discussion. In-place expansion seems fairly unlikely, as the templates are
(ideally)
cached and not read from disk during expansion/render.
So again, this doesn't exist, I was just suggesting an alternative feature that
would
satisfy your requirements and others.
Original comment by [email protected]
on 5 Feb 2009 at 11:24
from ctemplate.
Issue 29 has been merged into this issue.
Original comment by [email protected]
on 6 Feb 2009 at 2:28
from ctemplate.
There are a couple of points here:
As to the fact that adding 10M to the template dictionary requires copying 10M
of
data -- which takes time and space -- I don't disagree. It would be nice to
allow
"pointers" to data elsewhere, but it's hard to guarantee data lifetimes,
thread-safety, etc. I'm not sure the best way to resolve this.
As for writing the template expansion directly to disk rather than to a string,
it's
not supported now, but is easy to add to the code. We'd just define a version
of
Expand() in template.h that takes a FILE* (or whatever) rather than a string.
Then
you'd have to define a new version of Expand() in template.cc that know how to
write
to a file. Internally template.cc uses the concept of an ExpandEmitter; all
you'll
need to do is define an ExpandEmitter that works on FILE*.
It might make sense to expose ExpandEmitter, to make it easier for folks to
Expand to
other data sinks of their own devising; kinda like we do with TemplateString for
input. But hopefully modifying the source code yourself directly should work
well
for your needs.
Original comment by [email protected]
on 6 Feb 2009 at 2:39
- Changed state: Accepted
- Added labels: Type-Enhancement, Priority-Medium
from ctemplate.
thanks very much, that's a good idea.
Original comment by [email protected]
on 6 Feb 2009 at 2:24
from ctemplate.
I read around the template.h/cc, and tried to add a new expand(). for my
specific
purpose at this time, it should be enough, but I don't think it's a good idea
to add
a new expand() in lib file template.h and recompile the lib, each time when a
new
type of stream sink is needed, I really hope I could just inherit from the class
Template or use template specializing to define my specific Template class, in
this
way, it could be more expandable.
for example:
Template<MyEmitter> tpl = Template<MyEmitter>::GetTemplate(...);
Have a good day ...
Original comment by [email protected]
on 6 Feb 2009 at 8:21
from ctemplate.
In the next version, it will be possible for you to write your own
TemplateEmitter
and call Template::Expand(&your_emitter, ...).
Original comment by [email protected]
on 10 Feb 2009 at 7:04
- Changed state: Started
from ctemplate.
This has been added to ctemplate 0.94, just released.
Original comment by [email protected]
on 7 May 2009 at 3:35
- Changed state: Fixed
from ctemplate.
Related Issues (20)
- MSVC2015 support HOT 10
- README missing autogen.sh step for Compilation HOT 4
- python2 does not work with Mac with src/htmlparser/generate_fsm.py HOT 4
- make (dist)check fails HOT 5
- Macro Redefinition and Header Conflicts Causes Issue Installing HOT 5
- Include files *_fsm.h not exist HOT 6
- Not libctemplate.
- Libtool library used but 'LIBTOOL' is undefined HOT 3
- Preview documentation as GitHub Pages HOT 1
- Ctemplate issue while using protoc plugins HOT 3
- VS2017 latest version, build ctemplate failed HOT 11
- build with >=gcc-7.1 failed HOT 10
- Create release that supports Python 3 HOT 12
- How to skip blank field? HOT 1
- ctemplate 2.4 Mac OSX build failed
- How to install Ctemplate in Centos 7?
- when i reboot service, ctemplate produce coredump HOT 3
- `README.md` points to a non-existent file `INSTALL` HOT 1
- ctemplate-2.4 dose not has the configure file๏ผ HOT 6
- A bunch of undefined errors occur when make HOT 1
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 ctemplate.