JADE + EXPRESS: l'Itération sur l'objet dans inline code JS (côté client)?

je veux mettre en œuvre une carte google basé sur son api. je veux ajouter un chemin d'accès basé sur les coordonnées. donc je obtenir mes coordonnées à partir de mon modèle et que vous souhaitez effectuer une itération sur l'objet pour fille la carte avec cette points. dans mon modèle jade-je inclure l'api js code comme ceci:

script(type='text/javascript')
    function initialize() {
      var myLatLng = new google.maps.LatLng(0, -180);
      var myOptions = {
        zoom: 3,
        center: myLatLng,
        mapTypeId: google.maps.MapTypeId.TERRAIN
      };

      var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
      var flightPlanCoordinates = [

       - if (typeof(pins) != null)
           - var.pins.forEach(function(pin) {
                new google.maps.LatLng(pin.latitude, pin.longitude),
           - })
           new google.maps.LatLng(0,0)
      ];
      var flightPath = new google.maps.Polyline({
        path: flightPlanCoordinates,
        strokeColor: "#FF0000",
        strokeOpacity: 1.0,
        strokeWeight: 2
      });

      flightPath.setMap(map);
    }

div#map_canvas(style='height: 500px; background-color: #990000;')

le problème est: jade rend cet extrait

var flightPlanCoordinates = [

       - if (typeof(pins) != null)
           - var.pins.forEach(function(pin) {
                new google.maps.LatLng(pin.latitude, pin.longitude),
           - })
           new google.maps.LatLng(0,0)
      ];

comme elle l'est dans le modèle jade source... l' - si etc. ne pas obtenir analysé! des idées?

merci!

OriginalL'auteur Tronic | 2011-06-07