> I still have to figure out exactly what I want in predicates. I don't > think these tests can pass, because you have .if in the code, but no .if > in the tests.
Yes, I need to port my tests to Python. > http://codereview.appspot.com/124104/diff/1/2#newcode83 > Line 83: return context.Lookup('base-url')+'/'+val; > I would like if this behaves like Python and is smart WRT > leading/trailing slashes, but this could bea TODO You know, I didn't look at the Python version. I figured it was just a test case, more to demo than to be useful, so I just had it pass the test. > > Oops.. not needed, was there for firebug at one point... > > So you should upload another snapshot with this removed rather than > replying to yourself :) Heh! Yeah... just that using the command line on Windows sucks, even with PowerShell (which replaces the older command line), and the command line to do the call upload.py is a real long mess, I had closed the window by then so the command line history was toast, and I just wanted to go home. I'll turn it into a function so I'm not so lazy next time. > > $index starting from 1, not zero. Can imagine if the W3C suggested > that for > > <ol><li> items... > > OK. But you must have broken Python too then. Cough, cough. Yeah. I should have changed the Python. This is my first experience with Python, and it seems like the new Perl to me. > Line 228: if (matches && (predicate = DEFAULT_PREDICATES[matches[1]])) { > I will have to think about this stuff... I suggested a more general API > for registering formatters/predicates in one of the bugs. This doesn't > match what's in Python now. It might be better to work in JS first, our common language, then copy back to the other languages. Looking at this, I see I didn't follow what I did with formatters, though it seems that that slip was only in the JS version. > http://codereview.appspot.com/124104/diff/1/2#newcode246 > Line 246: if (predicate_target==null || predicate_target==undefined) > Please keep the style consistent and use spaces around ==, here and > throughout. Big breath... yes, I absolutely agree. <rant> But... I'm guessing you either have a small screen or you love Python with its indentation is a block metaphor, and you use vi. I use Eclipse, and every time I type } it formats the code above. All my stuff is perfectly consistent because of that. But I have to go back and convert tabs to spaces, and do everything by hand, and try and avoid hitting the } character, instead pasting it. And why is the indentation *two* spaces in JS??? It makes me want to cry! Any coder worth their salt deserves at least one 30 inch monitor in each place they work (including home). You can quote me on that. It also demonstrates if a boss is worth *their* salt. </rant> > http://codereview.appspot.com/124104/diff/1/2#newcode253 > Line 253: predicate_target: predicate_target, // public attribute > I think that sections blocks have names and no predicates, while "if" > blocks have predicates but no names. > > If that's the case then we should create a new "class" -- in Python I > created _PredicateSection and _Section, which derive from > _AbstractSection. Yes, but I wasn't sure when I started. I made it so I could do it any way I wanted. So I could even do this: {.section formatter-target|formatter|formatter ?perdicate-target| predicate?} > http://codereview.appspot.com/124104/diff/1/2#newcode372 > Line 372: var _SECTION_RE = > /^(?:(repeated)\s+)?section\s+(@|[A-Za-z0-9$_-]+)\s*$/; > I don't see why these changed. First, see the above comment. I was changing it when I was doing other things. But also, I think your version allowed this: {. section foo} Mine requires {.section foo} I had it in my mind that anything that started with a . was part of the language. Like {.end}. The other option is that it is a start deliminator, which is now what I am guessing you wanted: {. end } Hmm, not sure if you allow newlines or not actually, but {. end } I'm guessing is OK with you. I don't care either way really. > http://codereview.appspot.com/124104/diff/1/2#newcode374 > Line 374: var _CALL_RE = /^([A-Za-z0-9$_-]+)(?:\b\s*(.*?))?\s*$/; > As discussed I don't want to parse any arguments directly in the > template language. This can be left for user code. Perhaps I can come > up with some more examples in Python. Yeah, I want to pass the remainder string as an argument so I can simply have a function list. I can see about moving that out into a subclass... --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "JSON Template" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/json-template?hl=en -~----------~----~----~----~------~----~------~--~---
