Giter Club home page Giter Club logo

Comments (8)

GoogleCodeExporter avatar GoogleCodeExporter commented on June 12, 2024
Wow fantastic!  I patched it in and was able to get all the tests to pass.

Slight nit: add a second argument to getenv, so that the os.path.join() doesn't 
fail
when joining with None (the default value):

os.getenv('JAVA_HOME', '')

I would like to do a couple things before "releasing" it:

1) Make sure the public Java API is consistent with the Python/JavaScript 
versions. 
It looks like it is, but does the package export any symbols that are 
implementation
details, for example?  (e.g. _ScopedContext and such are private in both Python 
and
JavaScript)

I'm not a Java expert, but something I've seen recently in the Java world is to 
have
this chaining:

TemplateCompileOptions().setMeta('{}').setMoreFormatters()

This is like the optional named arguments in Python.  So just return 'this' from
each.  Not sure if that's desirable or not.


2) A short README about the requirements to use it?  (Java version, platform). 
Although I suspect there is not much to know here -- I just downloaded the 
default
sun-java6-jre for my Ubuntu and it worked fine.  (And I need to do the same for
Python, 2.4+ is the goal, but I think it should probably work 2.2+ easily)

I'll add you as a member of the project, and since the tests all pass you 
commit it
now if you like.  I would like to get some more feedback and tweak it before 
releasing.

Also, how does it handle Unicode?  I wrote a note that for Python, it's 
transparent
(it just depends on the inputs), which I think is the right behavior.

Thanks a lot!

Original comment by [email protected] on 5 Apr 2009 at 8:04

  • Changed state: Accepted

from json-template.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 12, 2024
OK, committed.

I deleted a few "public" tokens, added a README and TODO to the java directory.

Here are the public classes/interfaces currently exported by the package:

BadFormatterError.java
9:public class BadFormatterError extends CompilationError {
CompilationError.java
8:public class CompilationError extends JSONTemplateError {
ConfigurationError.java
4:public class ConfigurationError extends CompilationError {
DefaultFormatters.java
5:public class DefaultFormatters {
DefaultProgramBuilder.java
5:public class DefaultProgramBuilder implements IProgramBuilder {
EvaluationError.java
4:public class EvaluationError extends JSONTemplateError {
IFormatter.java
3:public interface IFormatter {
IFormatterResolver.java
3:public interface IFormatterResolver {
IProgramBuilder.java
4:public interface IProgramBuilder {
ITemplateRenderCallback.java
3:public interface ITemplateRenderCallback {
JSONTemplateError.java
8:public class JSONTemplateError extends RuntimeException {
MissingFormatter.java
4:public class MissingFormatter extends CompilationError {
Template.java
23:public class Template {
TemplateCompileOptions.java
3:public class TemplateCompileOptions {
TemplateCompiler.java
8:public class TemplateCompiler {
TemplateSyntaxError.java
4:public class TemplateSyntaxError extends CompilationError {
UndefinedVariable.java
4:public class UndefinedVariable extends EvaluationError {

So, basically the errors, TemplateCompiler, TemplateCompilerOptions, 
ProgramBuilder, 
and for extensibility, the interfaces IProgramBuilder, IFormatter, 
IFormatterResolver, and ITemplateRenderCallback.

The requirements are documented in the README. It's been tested with Apple's 
Java 5 
and 6. 

About Unicode, I must admit that I have no experience dealing with it. Do you 
have 
any test cases that check Unicode handling?

Original comment by [email protected] on 6 Apr 2009 at 12:31

from json-template.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 12, 2024
I'm closing this issue since it's in... I haven't seen as much feedback as I'd 
like
on the Java version though.  Are you using it for any of your personal projects 
that
you could share as examples?

And I opened up a separate bug about unicode test cases.  We definitely need 
those.

In Python there are 2 different string types -- str() and unicode(), and it 
matters
to the *internal* API too.  The testy.py tests can unfortunately only test a 
byte
stream really.

Thanks again.

Original comment by [email protected] on 10 Apr 2009 at 12:28

from json-template.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 12, 2024

Original comment by [email protected] on 10 Apr 2009 at 12:28

  • Changed state: Fixed

from json-template.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 12, 2024
I'm not actually using it for any personal projects (although the recently 
released 
GAE/Java seems like a nice place to use it), just did it for fun. I'll try to 
restructure the directories / build process first then make some examples 
(probably 
as jUnit tests and some webapp/JSP example). 

Original comment by [email protected] on 10 Apr 2009 at 1:30

from json-template.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 12, 2024
Hi, I just downloaded the Java implementation and I plan to start using it on a 
real project.
If you don't mind, I would like to reorganize the package structure and I'm 
happy to contribute with the TODOs.

I'll let you know how it goes.

Cheers!

Original comment by [email protected] on 19 Jan 2011 at 11:22

from json-template.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 12, 2024
I tried to run Test.java using the attached file and I got the following 
Exception:

EXCEPTION: EvaluationError
jsontemplate.EvaluationError: pushSection called when current cursor value is 
not a map (is: {   "url-base": "http://example.com/music/",    "playlist-name": 
"Epic Playlist",    "songs": [     {       "url": "1.mp3",        "artist": 
"Grayceon",        "title": "Sounds Like Thunder"     },      {       "url": 
"2.mp3",        "artist": "Thou",        "title": "Their Hooves Carve Craters 
in the Earth"     }   ] })
    at jsontemplate.ScopedContext.pushSection(ScopedContext.java:22)
    at jsontemplate.SectionStatement.execute(SectionStatement.java:14)
    at jsontemplate.TemplateExecutor.execute(TemplateExecutor.java:10)
    at jsontemplate.Template.render(Template.java:52)
    at jsontemplate.Template.expand(Template.java:65)
    at jsontemplate_test.Test.main(Test.java:65)


The contents of the template and the dictionary are exactly what is shown as 
example in the intro page.
Can you give me a hint on what I am doing wrong?

Thanks!

Original comment by [email protected] on 19 Jan 2011 at 12:24

Attachments:

from json-template.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 12, 2024
Hi Matias, the dictionary's value is supposed to be an actual dictionary, not a 
string representation of a dictionary, so:

"dictionary": {"url-base": "...", "playlist-name": "...", "songs": [ {...} ] }

that should work.

Hope this helps,
William

Original comment by [email protected] on 24 Jan 2011 at 6:48

from json-template.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.