Giter Site home page Giter Site logo

conflict with ejs about clndr HOT 8 CLOSED

kylestetz avatar kylestetz commented on May 5, 2024
conflict with ejs

from clndr.

Comments (8)

kylestetz avatar kylestetz commented on May 5, 2024

Yes, as long as you're using underscore to render your CLNDR templates you can change the delimiters. Call this before you instantiate CLNDR:

_.templateSettings = {
  interpolate: /\{\{(.+?)\}\}/g,
  escape: /\{\{\-(.+?)\}\}/g,
  evaluate: /\{\%(.+?)\%\}/g
};

Now the templates will look like this:

{% for(var i = 0; i < daysOfTheWeek; i++) { %}
  <div class="header">{{ daysOfTheWeek[i] }}</div>
{% } %}

from clndr.

kylestetz avatar kylestetz commented on May 5, 2024

More info in the docs:

https://github.com/kylestetz/CLNDR#underscore-template-delimiters

Hope that helps!

from clndr.

janchrist avatar janchrist commented on May 5, 2024

Hi kylestetz
We use <% for ASP with VbScript. In a sandbox HTML-only Website CLNDR works perfectly. But in the ASP-Page we have to change the delimiters and since this time i doesn't create the CLNDR anymore. Maybe we set the _.templateSettings not at the correct place in the code or didn't adapt the clndr template right? After hours of trying I hope you could give us a piece of advice.

<script type="text/template" id="calendar-template">
Vormonat
{%= month %} {%= year %}
nächster Monat
{% _.each(daysOfTheWeek, function(day) { %}
{%= day %}
{% }); %}
{% _.each(days, function(day) { %}
{%= day.day %}
{% }); %}
</script>
    <script type="text/javascript">
    _.templateSettings = {
      interpolate: /\{\{(.+?)\}\}/g,
      escape: /\{\{\-(.+?)\}\}/g,
      evaluate: /\{\%(.+?)\%\}/g
    };
    jQuery('#Calendar').clndr({
        template: jQuery('#calendar-template').html(),
        showAdjacentMonths: false,
    });

from clndr.

kylestetz avatar kylestetz commented on May 5, 2024

@janchrist would you mind sharing the template you wrote as well? This looks correct so far.

from clndr.

janchrist avatar janchrist commented on May 5, 2024

Wow, thanks for the quick reply kylestetz
template

from clndr.

kylestetz avatar kylestetz commented on May 5, 2024

You're really close! The delimiters are TWO brackets with no %, so it should look like this:

{{ _.each(daysOfTheWeek, function(day) { }}
  <div class="header-day">{{= day }}</div>
{{ }); }}

from clndr.

janchrist avatar janchrist commented on May 5, 2024

I tried so many different alternitives that even don't know anymore, if I hadn't tried this before.
At least i have now a specific error in the webdeveloper-console:

Fehler: SyntaxError: syntax error
Quelldatei: http://www......org/library/clndr/underscore-min-1.6.0.js
Zeile: 10, Spalte: 46
Quelltext:
((__t=( _.each(daysOfTheWeek, function(day) { ))==null?'':__t)+
-------------------------------------------------------------î

As soon I have a solution I will post it here, for developers with the same problem.

from clndr.

janchrist avatar janchrist commented on May 5, 2024

I didn't get it to run with {{ and }}
I went back to <% and %>, but I used ASP-Code <%= chr(60) & "%" %> and <%="%" & chr(62)%>

Now I look for an additional tooltip for the events and I am done.

Cheers

from clndr.

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.