[racket] Ensuring data fed to web-server/templates is textual
On Thu, Feb 9, 2012 at 11:45 AM, Jordan Johnson <jmj at fellowhuman.com> wrote:
>
> On Feb 8, 2012, at 10:17 AM, Jay McCarthy <jay.mccarthy at gmail.com> wrote:
> web-server/templates uses scribble/text
>>
>> So, if you return a function, then it will be called.
>
> I'm not sure I understand the implication: that I could achieve what I'm after by wrapping the images in a function? I'm not clear on how that would work.
If a template includes a function, then the function gets called to
produce the value to display. So rather than having "image" you'd have
"(lambda () (convert-to-what-i-want image))"
>
>> We could also change scribble/text to support a struct/class property
>> for JIT transformation. Does that sound good?
>
> This sounds like it might be the kind of thing I'm after. Given that I don't necessarily know how the images are being created, could attaching such a property be done without changing how the image%s are instantiated?
>
> Thanks,
> Jordan
>
>> Is that okay with you, Eli?
>>
>> Jay
>>
>> On Tue, Feb 7, 2012 at 4:50 PM, Jordan Johnson <jmj at fellowhuman.com> wrote:
>>> Hi all,
>>>
>>> I'm using web-server/templates to generate text, and the data in variables I reference in the template include s-exps that may, in some cases, contain image% objects. I want it to render the image%s as plain text; even just the string "<IMAGE>" or similar would be adequate.
>>>
>>> So, my question is: how (via the template system or other libraries) can I best make racket perform this translation, ideally without writing code to walk the s-exp trees? It seems there must be a way someplace to tweak the output function used by the template library, but I don't know where that would be.
>>>
>>> Best,
>>> Jordan
>>> ____________________
>>> Racket Users list:
>>> http://lists.racket-lang.org/users
>>
>>
>>
>> --
>> Jay McCarthy <jay at cs.byu.edu>
>> Assistant Professor / Brigham Young University
>> http://faculty.cs.byu.edu/~jay
>>
>> "The glory of God is Intelligence" - D&C 93
--
Jay McCarthy <jay at cs.byu.edu>
Assistant Professor / Brigham Young University
http://faculty.cs.byu.edu/~jay
"The glory of God is Intelligence" - D&C 93