hi Jay:<br> Hah, yeah, the last sentence you've put for those patient and serious readers :)<br> Yeah, right, I find it's more frustrated to translate than rewrite it in my own way. So far, I've generally made trac fullblog work with basic features. It's surprising that the texts are much smaller than python ones ,particularly the templates . No doubt , PLT is a powerful choice to do web programming. Thank you !<br>
<br>Nevo<br><br><div class="gmail_quote">2009/12/29 Jay McCarthy <span dir="ltr"><<a href="mailto:jay.mccarthy@gmail.com">jay.mccarthy@gmail.com</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
You could do that with read and eval, but that doesn't mean it would<br>
be a good idea. =) This is a similar thing to what I discuss in the<br>
FAQ:<br>
<br>
<a href="http://docs.plt-scheme.org/web-server/faq.html#%28part._.How_do_.I_use_templates__dynamically__%29" target="_blank">http://docs.plt-scheme.org/web-server/faq.html#(part._.How_do_.I_use_templates__dynamically__)</a><br>
<br>
IMHO, you shouldn't transliterate Genshi but should rewrite. I would<br>
be surprised if there was an interesting reason they are using XPath,<br>
it seems like all they had available; in contrast you have abstraction<br>
power in the form of function, modules, units, macros, etc.<br>
<font color="#888888"><br>
Jay<br>
</font><div><div></div><div class="h5"><br>
On Mon, Dec 28, 2009 at 11:17 PM, Nevo <<a href="mailto:sakur.deagod@gmail.com">sakur.deagod@gmail.com</a>> wrote:<br>
> hi Jay:<br>
> Thanks for your kind suggestion and explanation. I myself have a happy<br>
> time to play with PLT template system just ,you know, still need more<br>
> practice to get into it. The difference between Plt template and Genshi<br>
> template is not my concern. Actually I'm trying to translate the Trac<br>
> template (particular fullblog plugin) to PLT web, and seeing those XPath<br>
> related syntax everywhere in Genshi template files , so just wondering if a<br>
> similar syntax would be supported in PLT template. Now I have more sense<br>
> (compared to my previous usage) about how to deal with PLT template , it's<br>
> handy to treat PLT template as a Scheme program with simple syntax as<br>
> pointed out by you, compared with that traditional template engine like<br>
> Genshi (read, parse, expand, generate). That's great!<br>
> Btw, sorry , I have another (maybe non sense) question that, for example,<br>
> I now have a template file piece like follows:<br>
> <XHTML><br>
> .....<br>
> @select-node["content/title/title1/text()"]<br>
> .....<br>
> </XHTML><br>
><br>
> and "select-node" is defined in another scheme file:<br>
> (define (select-node xpath-textual)<br>
> (let ((q1 (sxpath xpath-textual)))<br>
> (q1 current-xml-template)))<br>
><br>
> and "current-xml-template" is a SXML document representation of :<br>
> <content><br>
> ...<br>
> <title><br>
> <title1> @get-page-1-title[]</title><br>
> ....<br>
> </title><br>
> ...<br>
> </content><br>
><br>
> As you probably see , the @select-node will produce just<br>
> "@get-page-1-title[]" , so is it possible to let template compiler to<br>
> recompile the produced stream second pass so that @get-page-1-title[] will<br>
> also be got expanded ? I knew this question may sound no sense and not a<br>
> problem at all ( I could simply call @get-page-1-title in template instead<br>
> of bothering SXPATH at all), just a silly question though.<br>
><br>
> Nevo<br>
><br>
> 2009/12/29 Jay McCarthy <<a href="mailto:jay.mccarthy@gmail.com">jay.mccarthy@gmail.com</a>><br>
>><br>
>> I think the difference you're getting at is that because the PLT<br>
>> template system is more powerful, there is less that you can do with<br>
>> it externally. The PLT templates are not necessarily XML, so it<br>
>> doesn't make sense to parse them and analyze them as if they were. PLT<br>
>> templates are simple Scheme programs that when run produce the text<br>
>> you want, but they have a convenient syntax (thanks to Eli primarily)<br>
>> for primarily text documents.<br>
>><br>
>> If you wanted you could enforce upon yourself the restriction that<br>
>> your templates were actually XML and parse them, but I'm still not<br>
>> sure what you feel that that (or Genshi) would do for you.<br>
>><br>
>> Jay<br>
>><br>
>> On Sat, Dec 26, 2009 at 10:43 PM, Nevo <<a href="mailto:sakur.deagod@gmail.com">sakur.deagod@gmail.com</a>> wrote:<br>
>> > hi,<br>
>> > Sorry, forgive me not able to clarify more on this topic . Here's the<br>
>> > piece of code from the Genshi template file :<br>
>> > <py:match path="body" once="true" buffer="false"><body><br>
>> > ${select('*|text()')}<br>
>> > </body> </py:match><br>
>> ><br>
>> > The above code is just instructing the template engine to *select* the<br>
>> > text content of node "body" from the XHTML streams. That's the one I<br>
>> > was<br>
>> > asking actually. There's a difference between Genshi and PLT scheme web<br>
>> > template from my point of view , the former separates the template<br>
>> > macros<br>
>> > and the real content streams ,while the latter combines the template<br>
>> > macros<br>
>> > (S-expressions) with the content. As suggested by Jay, I could use<br>
>> > SXML/SXPATH library to parse the XHTML content and select those nodes<br>
>> > which<br>
>> > I'm interested in. Yeah, this is possible , but I havn't used that yet,<br>
>> > on<br>
>> > a quick read of its tutorial<br>
>> > (<a href="http://modis.ispras.ru/Lizorkin/sxml-tutorial.html" target="_blank">http://modis.ispras.ru/Lizorkin/sxml-tutorial.html</a>) , I probably need<br>
>> > to<br>
>> > obtain a SXML representation of a document which means the template file<br>
>> > should be expanded first (using @include-template) and then parse it<br>
>> > using<br>
>> > SXML parser into a SXML document before I can use SXPath on it, am I<br>
>> > right ?<br>
>> > Or is there a way to do it in template file itself ? Thanks.<br>
>> ><br>
>> > Nevo<br>
>> ><br>
>> ><br>
>> > Actually, I think you misunderstood.<br>
>> ><br>
>> > Tell us what you want and it may be pretty easy to do.<br>
>> ><br>
>> > On Sat, Dec 26, 2009 at 11:28 PM, Nevo <<a href="mailto:sakur.deagod@gmail.com">sakur.deagod@gmail.com</a>> wrote:<br>
>> ><br>
>> ><br>
>> > hi Todd:<br>
>> > Yeah... your words sound like a style of education to me but useful<br>
>> > (really appreciate) . Of course I will take the stabs at writing pieces<br>
>> > of<br>
>> > prototype and ask here for review. As currently I'm still on the way to<br>
>> > fully understand and practice with the powerful PLT scheme web framework<br>
>> > by<br>
>> > means of building up my blog service , the quick follow up in this topic<br>
>> > is<br>
>> > just a curious wonder and hope not offending the underlying laws of<br>
>> > this<br>
>> > mailing list. I really want to contribute to this great community and be<br>
>> > able to help others in exchange to the huge helps from here, but as you<br>
>> > know<br>
>> > my numb brain just tells me you should dig in it before you give any<br>
>> > output<br>
>> > ,as emphasized by you. So thanks anyway , I'll see what I would help in<br>
>> > the<br>
>> > future.<br>
>> ><br>
>> > Nevo<br>
>> ><br>
>> > On Sat, Dec 26, 2009 at 10:12 PM, Nevo <<a href="mailto:sakur.deagod@gmail.com">sakur.deagod@gmail.com</a>> wrote:<br>
>> ><br>
>> ><br>
>> ><br>
>> > Yes, it's pretty useful and enjoyable to do web programming in plt<br>
>> > scheme.<br>
>> > But I just wonder any plan to continue to extend the powerness of Plt<br>
>> > scheme<br>
>> > web framework ? Like provide XPath select support in current HTML<br>
>> > template<br>
>> > system which I've been using in Genshi ( a python template component<br>
>> > used<br>
>> > in Trac (<a href="http://trac.edgewall.org" target="_blank">trac.edgewall.org</a>) ? thanks .<br>
>> ><br>
>> > Nevo<br>
>> ><br>
>> ><br>
>> ><br>
>> > Assuming it works the way most other development in PLT has seemed to<br>
>> > work, here's all you need to do:<br>
>> ><br>
>> > Step 1. Find a student who wants a Master's or Ph.D. in Computer<br>
>> > Science.<br>
>> ><br>
>> > Step 2. Interest him/her in what you want.<br>
>> ><br>
>> > Step 3. Get him/her to interest a member of the PLT group as an advisor.<br>
>> ><br>
>> > Step 4. Wait for the goodies. :-)<br>
>> ><br>
>> > But seriously, I'm working with some of my (high school) students on a<br>
>> > couple of PLT web apps and we're seeing things we wish we had and<br>
>> > taking stabs at putting them together. If you can give examples of the<br>
>> > kind of functionality you want and take stabs at writing parts of the<br>
>> > code, this mailing list is incredibly good about helping you along.<br>
>> ><br>
>> > As someone who's gotten huge amounts of help on this list in exchange<br>
>> > for a mere pittance of very basic help for the few people even more<br>
>> > clueless than himself, my suggestion is dig in, start writing, ask for<br>
>> > help, and before you know it, you'll have what you always wanted.<br>
>> ><br>
>> > Todd<br>
>> ><br>
>> ><br>
>> ><br>
>> ><br>
>> ><br>
>> ><br>
>> ><br>
>><br>
>><br>
>><br>
>> --<br>
>> Jay McCarthy <<a href="mailto:jay@cs.byu.edu">jay@cs.byu.edu</a>><br>
>> Assistant Professor / Brigham Young University<br>
>> <a href="http://teammccarthy.org/jay" target="_blank">http://teammccarthy.org/jay</a><br>
>><br>
>> "The glory of God is Intelligence" - D&C 93<br>
><br>
><br>
<br>
<br>
<br>
</div></div>--<br>
<div><div></div><div class="h5">Jay McCarthy <<a href="mailto:jay@cs.byu.edu">jay@cs.byu.edu</a>><br>
Assistant Professor / Brigham Young University<br>
<a href="http://teammccarthy.org/jay" target="_blank">http://teammccarthy.org/jay</a><br>
<br>
"The glory of God is Intelligence" - D&C 93<br>
</div></div></blockquote></div><br>