Renders the calendar body.
@method renderBody
@param {Date} workingDate The current working Date being used for the render process
@param {Array} html The current working HTML array
@return {Array} The current working HTML array
976147
function(workingDate, html) {

        var startDay = this.cfg.getProperty(DEF_CFG.START_WEEKDAY.key);

        this.preMonthDays = workingDate.getDay();
        if (startDay > 0) {
            this.preMonthDays -= startDay;
        }
        if (this.preMonthDays < 0) {
            this.preMonthDays += 7;
        }

        this.monthDays = DateMath.findMonthEnd(workingDate).getDate();
        this.postMonthDays = Calendar.DISPLAY_DAYS-this.preMonthDays-this.monthDays;


        workingDate = DateMath.subtract(workingDate, DateMath.DAY, this.preMonthDays);
    
        var weekNum,
            weekClass,
            weekPrefix = "w",
            cellPrefix = "_cell",
            workingDayPrefix = "wd",
            dayPrefix = "d",
            cellRenderers,
            renderer,
            t = this.today,
            cfg = this.cfg,
            todayYear = t.getFullYear(),
            todayMonth = t.getMonth(),
            todayDate = t.getDate(),
            useDate = cfg.getProperty(DEF_CFG.PAGEDATE.key),
            hideBlankWeeks = cfg.getProperty(DEF_CFG.HIDE_BLANK_WEEKS.key),
            showWeekFooter = cfg.getProperty(DEF_CFG.SHOW_WEEK_FOOTER.key),
            showWeekHeader = cfg.getProperty(DEF_CFG.SHOW_WEEK_HEADER.key),
            mindate = cfg.getProperty(DEF_CFG.MINDATE.key),
            maxdate = cfg.getProperty(DEF_CFG.MAXDATE.key),
            yearOffset = this.Locale.YEAR_OFFSET;

        if (mindate) {
            mindate = DateMath.clearTime(mindate);
        }
        if (maxdate) {
            maxdate = DateMath.clearTime(maxdate);
        }

        html[html.length] = '<tbody class="m' + (useDate.getMonth()+1) + ' ' + this.Style.CSS_BODY + '">';

        var i = 0,
            tempDiv = document.createElement("div"),
            cell = document.createElement("td");

        tempDiv.appendChild(cell);

        var cal = this.parent || this;

        for (var r=0;r<6;r++) {
            weekNum = DateMath.getWeekNumber(workingDate, startDay);
            weekClass = weekPrefix + weekNum;

            // Local OOM check for performance, since we already have pagedate
            if (r !== 0 && hideBlankWeeks === true && workingDate.getMonth() != useDate.getMonth()) {
                break;
            } else {
                html[html.length] = '<tr class="' + weekClass + '">';

                if (showWeekHeader) { html = this.renderRowHeader(weekNum, html); }

                for (var d=0; d < 7; d++){ // Render actual days

                    cellRenderers = [];

                    this.clearElement(cell);
                    cell.className = this.Style.CSS_CELL;
                    cell.id = this.id + cellPrefix + i;

                    if (workingDate.getDate()  == todayDate && 
                        workingDate.getMonth()  == todayMonth &&
                        workingDate.getFullYear() == todayYear) {
                        cellRenderers[cellRenderers.length]=cal.renderCellStyleToday;
                    }

                    var workingArray = [workingDate.getFullYear(),workingDate.getMonth()+1,workingDate.getDate()];
                    this.cellDates[this.cellDates.length] = workingArray; // Add this date to cellDates

                    // Local OOM check for performance, since we already have pagedate
                    if (workingDate.getMonth() != useDate.getMonth()) {
                        cellRenderers[cellRenderers.length]=cal.renderCellNotThisMonth;
                    } else {
                        Dom.addClass(cell, workingDayPrefix + workingDate.getDay());
                        Dom.addClass(cell, dayPrefix + workingDate.getDate());

                        for (var s=0;s<this.renderStack.length;++s) {

                            renderer = null;

                            var rArray = this.renderStack[s],
                                type = rArray[0],
                                month,
                                day,
                                year;

                            switch (type) {
                                case Calendar.DATE:
                                    month = rArray[1][1];
                                    day = rArray[1][2];
                                    year = rArray[1][0];

                                    if (workingDate.getMonth()+1 == month && workingDate.getDate() == day && workingDate.getFullYear() == year) {
                                        renderer = rArray[2];
                                        this.renderStack.splice(s,1);
                                    }
                                    break;
                                case Calendar.MONTH_DAY:
                                    month = rArray[1][0];
                                    day = rArray[1][1];

                                    if (workingDate.getMonth()+1 == month && workingDate.getDate() == day) {
                                        renderer = rArray[2];
                                        this.renderStack.splice(s,1);
                                    }
                                    break;
                                case Calendar.RANGE:
                                    var date1 = rArray[1][0],
                                        date2 = rArray[1][1],
                                        d1month = date1[1],
                                        d1day = date1[2],
                                        d1year = date1[0],
                                        d1 = DateMath.getDate(d1year, d1month-1, d1day),
                                        d2month = date2[1],
                                        d2day = date2[2],
                                        d2year = date2[0],
                                        d2 = DateMath.getDate(d2year, d2month-1, d2day);

                                    if (workingDate.getTime() >= d1.getTime() && workingDate.getTime() <= d2.getTime()) {
                                        renderer = rArray[2];

                                        if (workingDate.getTime()==d2.getTime()) { 
                                            this.renderStack.splice(s,1);
                                        }
                                    }
                                    break;
                                case Calendar.WEEKDAY:
                                    var weekday = rArray[1][0];
                                    if (workingDate.getDay()+1 == weekday) {
                                        renderer = rArray[2];
                                    }
                                    break;
                                case Calendar.MONTH:
                                    month = rArray[1][0];
                                    if (workingDate.getMonth()+1 == month) {
                                        renderer = rArray[2];
                                    }
                                    break;
                            }

                            if (renderer) {
                                cellRenderers[cellRenderers.length]=renderer;
                            }
                        }

                    }

                    if (this._indexOfSelectedFieldArray(workingArray) > -1) {
                        cellRenderers[cellRenderers.length]=cal.renderCellStyleSelected; 
                    }

                    if ((mindate && (workingDate.getTime() < mindate.getTime())) ||
                        (maxdate && (workingDate.getTime() > maxdate.getTime()))
                    ) {
                        cellRenderers[cellRenderers.length]=cal.renderOutOfBoundsDate;
                    } else {
                        cellRenderers[cellRenderers.length]=cal.styleCellDefault;
                        cellRenderers[cellRenderers.length]=cal.renderCellDefault; 
                    }

                    for (var x=0; x < cellRenderers.length; ++x) {
                        if (cellRenderers[x].call(cal, workingDate, cell) == Calendar.STOP_RENDER) {
                            break;
                        }
                    }

                    workingDate.setTime(workingDate.getTime() + DateMath.ONE_DAY_MS);
                    // Just in case we crossed DST/Summertime boundaries
                    workingDate = DateMath.clearTime(workingDate);

                    if (i >= 0 && i <= 6) {
                        Dom.addClass(cell, this.Style.CSS_CELL_TOP);
                    }
                    if ((i % 7) === 0) {
                        Dom.addClass(cell, this.Style.CSS_CELL_LEFT);
                    }
                    if (((i+1) % 7) === 0) {
                        Dom.addClass(cell, this.Style.CSS_CELL_RIGHT);
                    }

                    var postDays = this.postMonthDays; 
                    if (hideBlankWeeks && postDays >= 7) {
                        var blankWeeks = Math.floor(postDays/7);
                        for (var p=0;p<blankWeeks;++p) {
                            postDays -= 7;
                        }
                    }
                    
                    if (i >= ((this.preMonthDays+postDays+this.monthDays)-7)) {
                        Dom.addClass(cell, this.Style.CSS_CELL_BOTTOM);
                    }
    
                    html[html.length] = tempDiv.innerHTML;
                    i++;
                }
    
                if (showWeekFooter) { html = this.renderRowFooter(weekNum, html); }
    
                html[html.length] = '</tr>';
            }
        }
    
        html[html.length] = '</tbody>';
    
        return html;
    }
495588
function (data, callback) {
            var html = '';
            var self = this;
            var fn = self.fn;
            callback = callback || function (error, ret) {
                html = ret;
            };
            var name = self.config.name;
            if (!name && fn.TPL_NAME) {
                name = fn.TPL_NAME;
            }
            var scope = new Scope(data), buffer = new LinkedBuffer(callback).head;
            renderTpl({
                name: name,
                fn: fn,
                session: {},
                root: self
            }, scope, buffer);
            return html;
        }
1049208
function createTableHtml(renderData) {
  const thead = [renderData[0]];
  const tbody = renderData.slice(1);
  const theadHtml = _createTheadOrTbodyHtml(thead, 'THEAD');
  const tbodyHtml = _createTheadOrTbodyHtml(tbody, 'TBODY');
  const className = renderData.className ? ` class="${renderData.className}"` : '';

  return `<table${className}>${theadHtml + tbodyHtml}</renderData>`;
}
400483
def render_workflow_html_template(filename, subtemplate, filelists, **kwargs):
    

    dirnam = os.path.dirname(filename)
    makedir(dirnam)

    try:
        filenames = [f.name for filelist in filelists for f in filelist if f is not None]
    except TypeError:
        filenames = []

    # render subtemplate
    subtemplate_dir = pycbc.results.__path__[0] + '/templates/wells'
    env = Environment(loader=FileSystemLoader(subtemplate_dir))
    env.globals.update(get_embedded_config=get_embedded_config)
    env.globals.update(path_exists=os.path.exists)
    env.globals.update(len=len)
    subtemplate = env.get_template(subtemplate)
    context = {'filelists' : filelists,
               'dir' : dirnam}
    context.update(kwargs)
    output = subtemplate.render(context)

    # save as html page
    kwds = {'render-function' : 'render_tmplt',
            'filenames' : ','.join(filenames)}
    save_html_with_metadata(str(output), filename, None, kwds)
519669
function renderTemplate(template, css, data={}){
  
    // assign css
    data.inlinecss = css;

    // render template - use custom escape function to handle linebreaks!
    return _ejs.render(template, data, {
        escape: function(text){
            if (!text){
                return '';
            }

            // apply generic escape function
            text = _ejs.escapeXML(text);

            // linebreaks
            text = text.replace(/\n/g, '<br />');

            return text;
        }
    });
}
454182
def render(*args, &block)
      options = _normalize_render(*args, &block)
      rendered_body = render_to_body(options)
      if options[:html]
        _set_html_content_type
      else
        _set_rendered_content_type rendered_format
      end
      self.response_body = rendered_body
    end
216797
function renderDayOverlay(overlayStart, overlayEnd, refreshCoordinateGrid) { // overlayEnd is exclusive

		if (refreshCoordinateGrid) {
			coordinateGrid.build();
		}

		var segments = rangeToSegments(overlayStart, overlayEnd);

		for (var i=0; i<segments.length; i++) {
			var segment = segments[i];
			dayBind(
				renderCellOverlay(
					segment.row,
					segment.leftCol,
					segment.row,
					segment.rightCol
				)
			);
		}
	}
796279
function render(data) {
                if (!this._rendered) {
                    if (this.template) {
                        if (data) {
                            this.data = data;
                        }
                        var options = this._options,
                            parentChildren = this._parentChildren,
                            decoder = new Decoder(this.template),
                            template = decoder.render(this.data);
                        if (this.el) {
                            var parent = this.el.parentNode;
                            if (parent) {
                                parent.replaceChild(template.fragment, this.el);
                            }
                            if (this.elGroup && this.elGroup.get(this.el)) {
                                this.elGroup.delete(this.el);
                                this.el = template.fragment;
                                this.elGroup.set(template.fragment, this);
                            }
                        } else {
                            this.el = template.fragment;
                        }

                        this.root = new dom.Element(template.fragment, {
                            name: 'root',
                            data: {}
                        });

                        this.children = applyElement(template.children, options);
                        applyParent(this, parentChildren, this.data);
                        this.bindings = setBinders(this.children, true);

                        if (this.data) {
                            this.applyBinders(this.data, this);
                        }

                        setRoutes(this.children, this.context);
                        addChildren(this, this.root);
                        this.rendered.apply(this, _toConsumableArray(this._arguments));
                        this._rendered = true;
                    } else {
                        var HTMLelement = document.createElement('div');
                        this.root = new dom.Element(HTMLelement, {
                            name: 'root',
                            data: {}
                        });
                        if (this.el) {
                            var _parent = this.el.parentNode;
                            if (_parent) {
                                _parent.replaceChild(HTMLelement, this.el);
                            }
                        }
                        this.el = HTMLelement;
                        this.children = {};
                        addChildren(this, this.root);

                        this.rendered.apply(this, _toConsumableArray(this._arguments));
                        this._rendered = true;
                    }
                }
            }
86177
function _createTheadOrTbodyHtml(trs, wrapperNodeName) {
  let html = '';

  if (trs.length) {
    html = trs.map(tr => {
      const tdHtml = tr.map(_createCellHtml).join('');

      return `<tr>${tdHtml}</tr>`;
    }).join('');
    html = `<${wrapperNodeName}>${html}</${wrapperNodeName}>`;
  }

  return html;
}
855101
function generateSpecialWorkdayOrHolidayRender(dayMap, lang = 'zh-cn') {
  return function render(data, locale, current) {
    const currentDate = formatter(new Date(current), 'YYYY-MM-DD');
    const type = data[currentDate];
    if (type) {
      if (type === 'work') {
        return (
          <span className="workday-label">{localeMap[locale] && localeMap[locale].workday}</span>
        );
      }
      return (
        <span className="holiday-label">{localeMap[locale] && localeMap[locale].holiday}</span>
      );
    }
    return null;
  }.bind(null, dayMap, lang);
}
266565
def draw_date(f, col_or_sym, options={})
      col_name  = get_column_name(col_or_sym)
      dom_id    = sprintf("%s_%s", f.object_name, col_name)
      f.text_field(col_name, id: dom_id, size: 14) +
      javascript_tag(<<-EOJS)
        $(function(){
          $('##{dom_id}').datepicker({buttonImageOnly: true}).
              datepicker('option', {
                dateFormat:       'yy/mm/dd'
              });
        });
      EOJS
    end
632323
def render(self, **kwargs):
        """"""
        self.json = json.dumps(self.data)

        self._parent.html.add_child(Element(Template("""
            <div id="{{this.get_name()}}"></div>
            """).render(this=self, kwargs=kwargs)), name=self.get_name())

        self._parent.script.add_child(Element(Template("""
            vega_parse({{this.json}},{{this.get_name()}});
            """).render(this=self)), name=self.get_name())

        figure = self.get_root()
        assert isinstance(figure, Figure), ('You cannot render this Element '
                                            'if it is not in a Figure.')

        figure.header.add_child(Element(Template("""
            <style> #{{this.get_name()}} {
                position : {{this.position}};
                width : {{this.width[0]}}{{this.width[1]}};
                height: {{this.height[0]}}{{this.height[1]}};
                left: {{this.left[0]}}{{this.left[1]}};
                top: {{this.top[0]}}{{this.top[1]}};
            </style>
            """).render(this=self, **kwargs)), name=self.get_name())

        figure.header.add_child(
            JavascriptLink('https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js'),  # noqa
            name='d3')

        figure.header.add_child(
            JavascriptLink('https://cdnjs.cloudflare.com/ajax/libs/vega/1.4.3/vega.min.js'),  # noqa
            name='vega')

        figure.header.add_child(
            JavascriptLink('https://code.jquery.com/jquery-2.1.0.min.js'),
            name='jquery')

        figure.script.add_child(
            Template("""function vega_parse(spec, div) {
            vg.parse.spec(spec, function(chart) { chart({el:div}).update(); });}"""),  # noqa
            name='vega_parse')
1368969
function showInputCalendar (el, date) {
  var cal = $('#koyomiCalendar');
  if (cal) {
    cal.remove();
  }

  var input = $(el);
  var v = input.val();
  date = date || koyomi.toDate(v) || new Date();

  var html = '<table id="koyomiCalendar">\n';
  var caption = '<a class="prev" href="#">&#x226A;</a>' +
                koyomi.format(date, 'Y年M月') +
                '<a class="next" href="#">&#x226B;</a>';

  html += '<caption>' + caption + '</caption>';
  html += '<tr>' +
          '<th class="sun">日</th>' +
          '<th class="weekday">月</th>' +
          '<th class="weekday">火</th>' +
          '<th class="weekday">水</th>' +
          '<th class="weekday">木</th>' +
          '<th class="weekday">金</th>' +
          '<th class="sat">土</th>' +
          '</tr>';


  var days = koyomi.getCalendarData(date);

  days.forEach(function(day){

    if (day.sow) {
      html += '<tr>';
    }

    var cname = day.ghost      ? 'ghost'       :
                day.holiday    ? 'day holiday' :
                day.week === 0 ? 'day sun'     :
                day.week === 6 ? 'day sat'     :
                'day weekday';

    var title = day.close;

    if (title) {
      html += '<td class="' + cname + '" title="' + title + '">' + day.day + '</td>';
    } else {
      html += '<td class="' + cname + '">' + day.day + '</td>';
    }

    if (day.eow) {
      html += '</tr>\n';
    }
  });

  html += '<tr><th colspan="7" class="close">閉じる</th></tr>\n';
  html += '</table>';

  input.after(html);
  cal = $(input.next()[0]);
  cal.click(function (e) {
    var target = $(e.target);

    // 日付入力
    if (target.hasClass('day')) {
      input.val(date.getFullYear() + '/' + (date.getMonth() + 1) + '/' + target.text());
      cal.remove();

    // 前月
    } else if (target.hasClass('prev')) {
      cal.remove();
      showInputCalendar(el, koyomi.add(date, '-1m'));

    // 来月
    } else if (target.hasClass('next')) {
      cal.remove();
      showInputCalendar(el, koyomi.add(date, '1m'));

    // 閉じる
    } else if (target.hasClass('close')) {
      cal.remove();
    }
  });
}
255268
async function _html(req, res) {
  const { queueName, queueHost, state } = req.params;
  const {Queues} = req.app.locals;
  const queue = await Queues.get(queueName, queueHost);
  const basePath = req.baseUrl;
  if (!queue) return res.status(404).render('dashboard/templates/queueNotFound', {basePath, queueName, queueHost});

  if (!isValidState(state, queue.IS_BEE)) return res.status(400).json({ message: `Invalid state requested: ${state}` });

  let jobCounts;
  if (queue.IS_BEE) {
    jobCounts = await queue.checkHealth();
    delete jobCounts.newestJob;
  } else {
    jobCounts = await queue.getJobCounts();
  }

  const page = parseInt(req.query.page, 10) || 1;
  const pageSize = parseInt(req.query.pageSize, 10) || 100;

  const startId = (page - 1) * pageSize;
  const endId = startId + pageSize - 1;

  let jobs;
  if (queue.IS_BEE) {
    const page = {};

    if (['failed', 'succeeded'].includes(state)) {
      page.size = pageSize;
    } else {
      page.start = startId;
      page.end = endId;
    }

    jobs = await queue.getJobs(state, page);

    // Filter out Bee jobs that have already been removed by the time the promise resolves
    jobs = jobs.filter((job) => job);
  } else {
    jobs = await queue[`get${_.capitalize(state)}`](startId, endId);
  }

  let pages = _.range(page - 6, page + 7)
    .filter((page) => page >= 1);
  while (pages.length < 12) {
    pages.push(_.last(pages) + 1);
  }
  pages = pages.filter((page) => page <= _.ceil(jobCounts[state] / pageSize));

  return res.render('dashboard/templates/queueJobsByState', {
    basePath,
    queueName,
    queueHost,
    state,
    jobs,
    jobsInStateCount: jobCounts[state],
    disablePagination: queue.IS_BEE && (state === 'succeeded' || state === 'failed'),
    currentPage: page,
    pages,
    pageSize,
    lastPage: _.last(pages)
  });
}
99700
function(){
      // dates
      var now = new Date();

      this.selectedDate = new Value({ value: new Date(this.date || now) });
      this.date = new Value({ value: new Date(this.date || now) });

      // insert sections
      this.isPeriodEnabled = this.isPeriodEnabled.bind(this);

      // inherit
      Node.prototype.init.call(this);

      if (this.sections)
      {
        // deprecated in 1.3.0
        /** @cut */ basis.dev.warn('basis.ui.calendar.Calendar#sections is deprecated, use childNodes instead');
        this.setChildNodes(this.sections);
      }
    }
231608
function(year, month)
        {
            var opts   = this._o,
                now    = new Date(),
                days   = getDaysInMonth(year, month),
                before = new Date(year, month, 1).getDay(),
                data   = [],
                row    = [];
            setToStartOfDay(now);
            if (opts.firstDay > 0) {
                before -= opts.firstDay;
                if (before < 0) {
                    before += 7;
                }
            }
            var cells = days + before,
                after = cells;
            while(after > 7) {
                after -= 7;
            }
            cells += 7 - after;
            for (var i = 0, r = 0; i < cells; i++)
            {
                var day = new Date(year, month, 1 + (i - before)),
                    isDisabled = (opts.minDate && day < opts.minDate) || (opts.maxDate && day > opts.maxDate),
                    isSelected = isDate(this._d) ? compareDates(day, this._d) : false,
                    isToday = compareDates(day, now),
                    isEmpty = i < before || i >= (days + before);

                row.push(renderDay(1 + (i - before), isSelected, isToday, isDisabled, isEmpty));

                if (++r === 7) {
                    data.push(renderRow(row, opts.isRTL));
                    row = [];
                    r = 0;
                }
            }
            return renderTable(opts, data);
        }
490404
def html(self, data=None, template=None):
        
        if data is None:
            data = {}
        if template:
            return render(self.request, template, data)
        return HttpResponse(data)