Comments (5)
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.
Currently my definition looks like this, except using c++ http://gist.github.com/vexorian/8177600
from topcoder-greed.
@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:
- '#', means the same as
${key}
$x(y,z)
, means take the previous output as a key namek
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.)- 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.
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.
- 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)
- Cannot configure pathPattern and fileNamePattern HOT 7
- Not recognizing config file HOT 1
- Config error: Config object needed, ConfigString found HOT 3
- The return value of long[] is attached with "L" in testcase.sample HOT 3
- Question: Is it possible to detect "practice room"? HOT 5
- Allow camelCase properties in templates
- Ecosystems for community-created contents (templates) HOT 5
- Code generation fails on SRM 627 Div 2 500 point problem HOT 3
- Is it possible to get a hook when the contest starts or to get contest time when generating code?
- Is it possible to get a raw string of the problem description? HOT 3
- Is there a support to generate the tests by supplying the problem statement offline?
- Grid containing whitespaces are not displayed in HTML properly HOT 1
- Submission from terminal without going to arena HOT 1
- Tests are not working in Xcode 6.1 (Passed : 0/0 cases) HOT 1
- About Release and Roadmap plans HOT 1
- OverWrite existing workspace
- SRM 676 div2 Farmville the test code does not work
- Filtering source code before submit
- Is the default language configurable?
- "data" causes compile error in C++17
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from topcoder-greed.