Create a block of data suitable to be passed to the help_list.html template
188889
function getMatchingCommands(context, prefix) {
  var commands = cli.getMapping(context).requisition.system.commands;
  var reply = commands.getAll().filter(function(command) {
    if (command.hidden) {
      return false;
    }

    if (prefix && command.name.indexOf(prefix) !== 0) {
      // Filtered out because they don't match the search
      return false;
    }
    if (!prefix && command.name.indexOf(' ') != -1) {
      // We don't show sub commands with plain 'help'
      return false;
    }
    return true;
  });

  reply.sort(function(c1, c2) {
    return c1.name.localeCompare(c2.name);
  });

  reply = reply.map(function(command) {
    return command.toJson();
  });

  return reply;
}
1026106
def create(*params, &block)
      options = {:query => {}}
      options[:query] = params[0] if params.length > 0
      response = self.class.post '/projects/jobs', options
      yield(response) if block_given?
      response
    end
1103283
def prepare(self, context):
        
        self.params = {}

        # no params, not even a newline
        if not self.nodelist:
            return

        # just static text, no vars, assume one TextNode
        if not self.nodelist.contains_nontext:
            text = self.nodelist[0].s.strip()

        # vars in params, we have to render
        else:
            context.push()
            context['object'] = self.obj
            text = self.nodelist.render(context)
            context.pop()

        if text:
            self.params = self.resolve_params(text)

        # override the default template from the parameters
        if 'template_name' in self.params:
            self.template_name = self.params['template_name']
895498
def partial_jinja_template(template_name, name='data', mimetype="text/html"):
    
    def partial_jinja_renderer(result, errors):
        template = get_jinja_template(template_name)
        old = template.environment.undefined
        template.environment.undefined = DebugUndefined
        context = {name: result or Mock(), 'errors': errors}
        rendered = template.render(**context)
        template.environment.undefined = old
        return {'body': rendered, 'mimetype': mimetype}
    return partial_jinja_renderer
1035050
def glue(data, options = {})
      template = partial_or_block(data, options) { yield }
      @template.add_node Nodes::Glue.new(template)
    end
810868
def __write_list_tmpl(html_tpl):
    '''
    
    '''
    out_dir = os.path.join(os.getcwd(), CRUD_PATH, 'infolist')
    if os.path.exists(out_dir):
        pass
    else:
        os.mkdir(out_dir)
    # for var_name in VAR_NAMES:
    for var_name, bl_val in SWITCH_DICS.items():
        if var_name.startswith('dic_'):
            outfile = os.path.join(out_dir, 'infolist' + '_' + var_name.split('_')[1] + '.html')
            html_view_str_arr = []
            # tview_var = eval('dic_vars.' + var_name)
            subdir = ''
            for the_val2 in bl_val:
                # sig = eval('html_vars.html_' + x)

                sig = HTML_DICS['html_' + the_val2]
                if sig['type'] == 'select':
                    html_view_str_arr.append(func_gen_html.gen_select_list(sig))
                elif sig['type'] == 'radio':
                    html_view_str_arr.append(func_gen_html.gen_radio_list(sig))
                elif sig['type'] == 'checkbox':
                    html_view_str_arr.append(func_gen_html.gen_checkbox_list(sig))

            with open(outfile, 'w') as outfileo:
                outstr = minify(
                    html_tpl.replace(
                        'xxxxxx',
                        ''.join(html_view_str_arr)
                    ).replace(
                        'yyyyyy',
                        var_name.split('_')[1][:2]
                    ).replace(
                        'ssssss',
                        subdir
                    ).replace(
                        'kkkk',
                        KIND_DICS['kind_' + var_name.split('_')[-1]]
                    )
                )
                outfileo.write(outstr)
1084073
def template(ctx, url, no_input, role_name):  # pragma: no cover
    
    command_args = {
        'role_name': role_name,
        'subcommand': __name__,
        'url': url,
        'no_input': no_input,
    }

    t = Template(command_args)
    t.execute()
1004251
function() {
    if (this.itemCount_ && this.getInput('EMPTY')) {
      this.removeInput('EMPTY');
    } else if (!this.itemCount_ && !this.getInput('EMPTY')) {
      this.appendDummyInput('EMPTY')
          .appendField(Blockly.Msg.LISTS_CREATE_EMPTY_TITLE);
    }
    // Add new inputs.
    for (var i = 0; i < this.itemCount_; i++) {
      if (!this.getInput('ADD' + i)) {
        var input = this.appendValueInput('ADD' + i);
        if (i == 0) {
          input.appendField(Blockly.Msg.LISTS_CREATE_WITH_INPUT_WITH);
        }
      }
    }
    // Remove deleted inputs.
    while (this.getInput('ADD' + i)) {
      this.removeInput('ADD' + i);
      i++;
    }
  }
385048
def page_list(
    request, template_name='wakawaka/page_list.html', extra_context=None
):
    
    page_list = WikiPage.objects.all()
    page_list = page_list.order_by('slug')

    template_context = {
        'page_list': page_list,
        'index_slug': getattr(settings, 'WAKAWAKA_DEFAULT_INDEX', 'WikiIndex'),
    }
    template_context.update(extra_context or {})
    return render(request, template_name, template_context)
855169
def template_scope
      Object.new.extend(Massimo::Helpers).tap do |scope|
        add_template_scope_blocks(scope)
        add_template_scope_extensions(scope)
        add_template_scope_helpers(scope)
      end
    end
1203718
def _render_list(data):
  
  return IPython.core.display.HTML(google.datalab.utils.commands.HtmlBuilder.render_list(data))
849729
def button_to(*arguments, &block)
      if block_given?
        body = block
        url = arguments[0]
        html_options = arguments[1] || {}
      else
        body = arguments[0]
        url = arguments[1]
        html_options = arguments[2] || {}
      end

      if block_given?
        super(url, html_options, &body)
      else
        super(url, html_options) { body }
      end
    end
820492
def _build_block_context(template, context):
    """"""

    # Ensure there's a BlockContext before rendering. This allows blocks in
    # ExtendsNodes to be found by sub-templates (allowing {{ block.super }} and
    # overriding sub-blocks to work).
    if BLOCK_CONTEXT_KEY not in context.render_context:
        context.render_context[BLOCK_CONTEXT_KEY] = BlockContext()
    block_context = context.render_context[BLOCK_CONTEXT_KEY]

    for node in template.nodelist:
        if isinstance(node, ExtendsNode):
            compiled_parent = node.get_parent(context)

            # Add the parent node's blocks to the context. (This ends up being
            # similar logic to ExtendsNode.render(), where we're adding the
            # parent's blocks to the context so a child can find them.)
            block_context.add_blocks(
                {n.name: n for n in compiled_parent.nodelist.get_nodes_by_type(BlockNode)})

            _build_block_context(compiled_parent, context)
            return compiled_parent

        # The ExtendsNode has to be the first non-text node.
        if not isinstance(node, TextNode):
            break
770274
def get_template_data(self, request, *args, **kwargs):
        ''''''

        # little tricky with vertical centering
        dimension = int(self.get_size().split('x')[0])

        data = {}

        if dimension <= 356:
            data['image_dimension'] = "row-md-13"

        if self.get_template_name().name.split("/")[-1] == "directories.html":
            data['directories'] = self.get_directories(request)

        return data
1365969
def generate_help(self):
        
        result = []
        result.append(self.__class__.__name__)
        result.append(re.sub(r'.', '=', self.__class__.__name__))
        result.append("")
        result.append("DESCRIPTION")
        result.append(self.description())
        result.append("")
        result.append("OPTIONS")
        opts = sorted(self.config.keys())
        for opt in opts:
            result.append(opt)
            helpstr = self.help[opt]
            if helpstr is None:
                helpstr = "-missing help-"
            result.append("\t" + helpstr)
            result.append("")
        return '\n'.join(result)
661359
def create_template_from_upload(create_template_data, opts = {})
      data, _status_code, _headers = create_template_from_upload_with_http_info(create_template_data, opts)
      data
    end
490404
def html(self, data=None, template=None):
        
        if data is None:
            data = {}
        if template:
            return render(self.request, template, data)
        return HttpResponse(data)