Mustache.jl
Mustache.jl copied to clipboard
Type-specific rendering
Is there currently a way to specify how we'd like Mustache to render a certain type? From a quick look at the code it seems like the method being called is print(io, val). Could Mustache have its own to_string(x)::String function to be overridden perhaps, then replace the existing print with print(io, to_string(val))?
I don’t see why not. Did you want to try a PR to see if there are issues?
On Fri, Feb 14, 2020 at 1:07 PM Chris de Graaf [email protected] wrote:
Is there currently a way to specify how we'd like Mustache to render a certain type? From a quick look at the code it seems like the method being called is print(io, val). Could Mustache have its own to_string(x)::String function to be overridden perhaps, then replace the existing print with print(io, to_string(val))?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/jverzani/Mustache.jl/issues/109?email_source=notifications&email_token=AADG6TGJWR4ALH2DBOZUZJ3RC3MW3A5CNFSM4KVNCZEKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4INUQMYQ, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADG6TBK2XJ3MG7R474KX6LRC3MW3ANCNFSM4KVNCZEA .
-- John Verzani Department of Mathematics College of Staten Island, CUNY [email protected]
Sure thing!
On Sat, Feb 15, 2020, 1:10 AM john verzani, [email protected] wrote:
I don’t see why not. Did you want to try a PR to see if there are issues?
On Fri, Feb 14, 2020 at 1:07 PM Chris de Graaf [email protected] wrote:
Is there currently a way to specify how we'd like Mustache to render a certain type? From a quick look at the code it seems like the method being called is print(io, val). Could Mustache have its own to_string(x)::String function to be overridden perhaps, then replace the existing print with print(io, to_string(val))?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub < https://github.com/jverzani/Mustache.jl/issues/109?email_source=notifications&email_token=AADG6TGJWR4ALH2DBOZUZJ3RC3MW3A5CNFSM4KVNCZEKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4INUQMYQ , or unsubscribe < https://github.com/notifications/unsubscribe-auth/AADG6TBK2XJ3MG7R474KX6LRC3MW3ANCNFSM4KVNCZEA
.
-- John Verzani Department of Mathematics College of Staten Island, CUNY [email protected]
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jverzani/Mustache.jl/issues/109?email_source=notifications&email_token=AEDOH6YMQX5ZOC7AJKHVODTRC3NABA5CNFSM4KVNCZEKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOELZ5HWQ#issuecomment-586404826, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEDOH66X6PATXQ7GKXTZ6EDRC3NABANCNFSM4KVNCZEA .
That's a valid point. I would use render(io, object) for the naming with Mustache.render(io, object) defaulting to print.