Code Monkey home page Code Monkey logo

clabango's People

Contributors

cgmartin avatar danlarkin avatar jszakmeister avatar yogthos avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

clabango's Issues

Unable to resolve symbol: context-lookup in this context, compiling:(clabango/tags.clj:67)

added [clabango "0.5"] to my project.clj
did lein deps, no problems
did lein repl
entered:

(ns example.core (:require [clabango.filters :refer [deftemplatefilter]] [clabango.parser :refer [render]]))

got:
CompilerException java.lang.RuntimeException: Unable to resolve symbol: context-lookup in this context, compiling:(clabango/tags.clj:67)

same error in any namespace:
(require '[clabango.parser :refer [render]])

Recursion detection

When I mentioned this on #clojure, @bitemyapp suggested I file an issue, although I don't see this as a real bug.

When doing silly things with includes and extends, I get a 500 server error after a long loading period (and a huge stacktrace.)

Easiest steps to reproduce:
$ lein new luminus foo cd foo && vi src/foo/views/templates/about.html

insert into ~line 3 (after extends)

{% include "foo/views/templates/about.html" %}

then
lein ring server-headless
and surf to localhost:3000/about

This also works the other way round iirc, if you extend something that's including the file you work on - maybe it would make sense to add an arbitrary recursion limit of ~10 levels deep.

parse-filters is really, really slow

I don't know if this was the case before, but parse-filters is really slow.

The best way I can think to optimize this is to move as much of the template parsing into the pre-context-aware section and turn the filters into memoizable call-sites for injecting the data after the fact.

This would probably require writing a chunk of the parser into something that does as little as possible at the context-aware stage.

It also seems like a lot of time is being spent in the lazy-seq operations.

Do you know anything about this @danlarkin?

handling the servlet context

Currently if the application is deployed on an application server, such as tomcat, with a context other than root then static resources will not be served correctly.

Would it be possible to add something for handling the servlet context when serving static resources. For example, Hiccup provides wrap-base-url middleware and uses it when parsing the templates.

The workaround right now would be to do something like this in the template

<link href="{{context}}/css/screen.css" rel="stylesheet" type="text/css"></link>

and then pass the context in to the template

(render-file "mytemplate.html" {:context (:context *request*)})

it gets kinda tedious to do :)

Custom template example

Not sure why (I did try some type conversion but the parser doesn't like anything besides string and boon or what not. So doing (repeat (Integer. repeat-times) body-nodes) doesn't work and I don't really know a.t.m. how you'd fix it. Anyway here is a little demonstration screen:

selection_017

Custom filters don't render properly

Thank you for writing a template engine similar to Django's and Jinja. I've been trying to incorporate it into a prototype application, and discovered an interesting behavior. If I create a new template tag that is identical to upper, but with a different name, I end up with the result being rendered as a map.

The function is this:

(deftemplatefilter "my-upper" [node body arg]
  (when body
    {:body (.toUpperCase body)}))

If I use this, I end up with the value being rendered as a map with a :body entry: {:body "JOHN"}. If I change it to not wrap in a map, then it renders correctly. But that seems to go against the precedent set in clabango. Is there something broken here?

addition of else

Would it be possible to add else in addition to if as in Django?

{% if athlete_list %}
    Number of athletes: {{ athlete_list|length }}
{% else %}
    No athletes.
{% endif %}

Include doesn't seem to work

I've tried everything I could in Luminus but no way "include" will work. Any other magic required that didn't get mentioned perhaps? Am I missing something?

update: It still doesn't work like expected, but now I just rendered it (a menu to plug in) as a key of the object sent to the template and it includes the menu I wanted.

Anyhow it seems to be a lack of understanding / Luminus perhaps on my part. Either their guide is missing information or it's broken.

extends inline
This tag is also used in template inheritance -- It defines the current template as inheriting from another.

Note use of the word also. For what other purposes is it used then?

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.