Giter Site home page Giter Site logo

Comments (5)

vexorian avatar vexorian commented on September 24, 2024

After some changes to #113 , it is possible to select the language in Type;html(cpp), this way we can actually make the definition always use Java/ c++/ C# syntax in definition. Which is like the problem statement in statistics. So that is an alternative, make problem-desc always use Java by default, allow to change to c++ and maybe C# if it is really that different to Java.

from topcoder-greed.

vexorian avatar vexorian commented on September 24, 2024

Currently my definition looks like this, except using c++ http://gist.github.com/vexorian/8177600

from topcoder-greed.

zen0wu avatar zen0wu commented on September 24, 2024

@vexorian I've reimplemented this functionality, it turns out it's not that complicated.
The workaround is to add a renderMethod method to each language, then the method signature can be successfully rendered, including Python.
About the problem of <> under C++, I rewrote the TemplateEngine to work on this.
Now there's a new named renderer called seq, which is a special one.

Here's a simple description.
It accepts a list of renderers, like ${key;seq(a,b,c)},
it's an iterative renderer, if you see a renderer as a function, then the output is c(b(a(key))).
The form of a could be:

  1. '#', means the same as ${key}
  2. $x(y,z), means take the previous output as a key name k and call ${k;x(y,z)}.
    (Haven't tested this, since there's currently no usage scenario, but seems interesting and powerful,
    also not sure about whether the $ will cause any problems.)
  3. other named renderer like html(grid), just means the same as ${key;html(grid)}.

This renderer allows nested named and normal rendering, which may make the engine more powerful,
although not in a direct way. Then the result of rendering a type in C++ can be further rendered by
writing ${p.type;seq(#, html)}. The language-specific HTML renderer change has been roll backed.

This is a major rewrite, and may cause bugs, please help me test it.

Also, we can remove the showDefinition options in the problem desc template, but it's also OK to leave it there.
I'm also considering to simplify some of the complexity from this template, it seems to be too complex, like the fancy circle on the case number. And it seems to be suffering some aligning problems.

from topcoder-greed.

vexorian avatar vexorian commented on September 24, 2024

hmnn.

  • While it is great to make Greed generate language-specific problem definitions, I actually liked forcing a language (java) on problem definition: This way the HTML file stays the same when I change language and the <type> tags in statement are still using java anyway (unless we managed to fix this somehow). So I would like to keep the ;html(java) renderer or something similar for a custom template :).
  • seq seems complicated but as long as it works and you document it well in the wiki that's fine.
  • As long as we are making changes to the template system. It would be nice to have something to format floating-point values. If you provide 2.0, you could choose to render it as 2.000 or 2.0 .
  • Regarding the HTML template (simplifying, removing the number decorations, let me create a separate issue: #117

from topcoder-greed.

zen0wu avatar zen0wu commented on September 24, 2024
  • A new options called forceDefLanguage is added to force the definition part to some given language, false means no forcing.
  • the format thing could be achieved by custom named renderer I think.

from topcoder-greed.

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.