orfon / reinhardt Goto Github PK
View Code? Open in Web Editor NEWDjango templates for RingoJS
Django templates for RingoJS
only set to "INVALID" if debug=true
configuring a template loader is very verbose and akward (see example) and adding custom filters/tags per "project" is impossible.
investigate how jinj2 "Envinronments" solve this problem: http://jinja.pocoo.org/docs/api/#jinja2.Environment
they too are standalone and can't rely on "settings.py" and a project folder, like django does.
Some applications (like on Google App Engine) have to use java.util.Date
to store dates. At the moment the following code will not work without a prior conversion of story.created into a JavaScript Date object:
{{ story.created | date:"dd.MM.yyyy" }}
templates with string escaping do not work:
basic-syntax26': ['{{ "\"fred\"" }}', {}, "\"fred\""],
{{ ""|add:"simon" }}`
another thing which doesnt work but which i dont plan on addinɡ too soon: translation strings
__("translation string")__
filterexpression regex
there is no way to specify the encoding when loading templates. it defaults to utf8.
django has three functions: simpleTag, assignmentTag and inclusionTag, which take a function as an argument, which they use to create a complete Tag class. Basically those three functions relieve you subclassing the Tag class for specific but common use cases. you only need to write the render
function and all the rest - parameter parsing, variable resolving with filter support as well as all interaction with the template parser - is handled automatically.
the three use cases support by django are:
I have implemented the SimpleTag and - I think - all helpers required to
implement the other Tags.
unit tests in my branch:
https://github.com/oberhamsi/reinhardt/blob/tag-filter-helpers/test/library/tags.js
A problem I noticed is that in JavaScript we can't support an indefinite number of arguments because I can't detect rest parameters in the function signature yet https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions_and_function_scope/rest_parameters This means we have to think of a different way to support an unknown number of arguments. Just parsing the function signature isn't going to get us there.
a RequestContext
takes the request as the first argument and automatically populates the Context with a few variables according to the TEMPLATE_CONTEXT_PROCESSORS
this is how they get things like user
, permissions
, mediaUrl
/staticUrl
, messages
and csrf protection into their templates.
see:
url tag only makes sense if a routing framework is used to generate URLs.
stick supports url resolving https://github.com/ringo/stick/blob/master/lib/helpers.js#L44
urlFor(app, {action: "edit", id: 5})
urlFor("index", {do: "search"})
this bug collects all commits we should/could port from django
as of 14/3:
improve {% include %} .. support recursion among other things
django/django@e2f0622
widthratio: Inf/Nan
django/django@07ae47f
widthratio: allow "as" param
django/django@ff41056
Fix #20745: Don't silence TypeError raised inside templates.
django/django@28a5713
simplify filterExpression.args_check
django/django@7c6f2dd
Fixed #7557 -- Added type checking to Variable initialization.
django/django@7fec5a2
cache missing templates
django/django@b785a80
currently it's a mess of lowercamelCase under_score and sometimes just words bashed together ("capfirst").
i think we should go all camelCase
before 1.0
At the moment it renders three dots and not a horizontal ellipse …
The filters: ...
and tags: ...
properties are not documented here:
https://github.com/orfon/reinhardt/blob/master/docs/custom-template-filters.md
It's not clear how to enable custom filters.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.