Generate genuine django inlines for registered content types.
485673
def get_feincms_inlines(self, model, request):
        
        model._needs_content_types()

        inlines = []
        for content_type in model._feincms_content_types:
            if not self.can_add_content(request, content_type):
                continue

            attrs = {
                '__module__': model.__module__,
                'model': content_type,
            }

            if hasattr(content_type, 'feincms_item_editor_inline'):
                inline = content_type.feincms_item_editor_inline
                attrs['form'] = inline.form

                #if hasattr(content_type, 'feincms_item_editor_form'):
                #    warnings.warn(
                #        'feincms_item_editor_form on %s is ignored because '
                #        'feincms_item_editor_inline is set too' % content_type,
                #        RuntimeWarning)

            else:
                inline = FeinCMSInline
                attrs['form'] = getattr(
                    content_type, 'feincms_item_editor_form', inline.form)

            name = '%sFeinCMSInline' % content_type.__name__
            # TODO: We generate a new class every time. Is that really wanted?
            inline_class = type(str(name), (inline,), attrs)
            inlines.append(inline_class)
        return inlines
585506
def inline_inputs(self):
        
        self.text = texutils.inline(self.text,
                                    os.path.dirname(self._filepath))
        # Remove children
        self._children = {}
245179
def _make_resource_from_inline(reference):
    """"""
    uri = DataURI(reference.uri)
    data = io.BytesIO(uri.data)
    mimetype = uri.mimetype
    res = Resource('dummy', data, mimetype)
    res.id = res.filename
    return res
802181
def wrap_with type, content, options = {} #:nodoc:
      type_tag, type_html_options = apply_html type, options
      if type_tag
        @template.content_tag type_tag, content, type_html_options
      else
        content
      end
    end
87452
def generate_template(template_name, **context):
    """"""
    context.update(href=href, format_datetime=format_datetime)
    return template_loader.load(template_name).generate(**context)
670479
def parse_content_type(header):
    """"""
    typ = subtyp = None; options = {}
    typ, pos = expect_re(re_token, header, 0)
    _, pos = expect_lit('/', header, pos)
    subtyp, pos = expect_re(re_token, header, pos)
    ctype = header[:pos] if subtyp else ''
    while pos < len(header):
        _, pos = accept_ws(header, pos)
        _, pos = expect_lit(';', header, pos)
        _, pos = accept_ws(header, pos)
        name, pos = expect_re(re_token, header, pos)
        _, pos = expect_lit('=', header, pos)
        char = lookahead(header, pos)
        if char == '"':
            value, pos = expect_re(re_qstring, header, pos)
            value = re_qpair.sub('\\1', value)
        elif char:
            value, pos = expect_re(re_token, header, pos)
        if name and value is not None:
            options[name] = value
    return ctype, options
756944
def generate_code(meta, prefix=None, node=False, min=False):
    
    if isinstance(meta, dict):
        url_prefix, auth_header, resources = parse_meta(meta)
    else:
        url_prefix, auth_header, resources = meta
    if prefix is not None:
        url_prefix = prefix
    core = render_core(url_prefix, auth_header, resources)
    if min:
        filename = 'res.web.min.js'
    else:
        filename = 'res.web.js'
    if node:
        filename = 'res.node.js'
    base = read_file(filename)
    return base.replace('"#res.core.js#"', core)
336090
def gen_repr(cls, template, *args, **kwargs):
    """"""
    buf = io.StringIO()
    buf.write(u'<')
    buf.write(cls.__module__.decode() if kwargs.pop('full', False) else u'etc')
    buf.write(u'.')
    buf.write(cls.__name__.decode())
    if not kwargs.pop('dense', False):
        buf.write(u' ')
    buf.write(template.format(*args, **kwargs))
    options = kwargs.pop('options', [])
    for attr, value in options:
        if value is not None:
            buf.write(u' %s=%s' % (attr, value))
    buf.write(u'>')
    return buf.getvalue()
472538
def zotero_inline_tags(parser, token):
    
    
    args = token.split_contents()
    length = len(args)
    if length == 2:
        rendered_node = RenderedAllNode(args[1])
    elif length == 3 and args[2].lower() == u'all':
        rendered_node = RenderedAllNode(args[1])
    elif length == 3 and args[2].lower() == u'media':
        rendered_node = RenderedMediaNode(args[1])
    elif length == 3 and args[2].lower() == u'formset':
        rendered_node = RenderedFormsetNode(args[1])
    else:
        raise t.TemplateSyntaxError('Incorrect arguments in %s.' % args[0])
    
    return rendered_node
1184453
function inlineLinks (text, options) {
  if (text) {
    var links = ddata.parseLink(text)
    links.forEach(function (link) {
      var linked = ddata._link(link.url, options)
      if (link.caption === link.url) link.caption = linked.name
      if (linked.url) link.url = linked.url
      text = text.replace(link.original, '[' + link.caption + '](' + link.url + ')')
    })
  }
  return text
}
305331
def _repr_html_(self, **kwargs):
        """"""
        from jinja2 import Template
        from markdown import markdown as convert_markdown

        extensions = [
            'markdown.extensions.extra',
            'markdown.extensions.admonition'
        ]

        return convert_markdown(self.markdown, extensions)
983553
def _monkey_inline(model, admin_class_instance, metadata_class, inline_class, admin_site):
    
    if model in metadata_class._meta.seo_models:
        # *Not* adding to the class attribute "inlines", as this will affect
        # all instances from this class. Explicitly adding to instance attribute.
        admin_class_instance.__dict__['inlines'] = admin_class_instance.inlines + [inline_class]

        # Because we've missed the registration, we need to perform actions
        # that were done then (on admin class instantiation)
        inline_instance = inline_class(admin_class_instance.model, admin_site)
        admin_class_instance.inline_instances.append(inline_instance)
1172269
def generate_html_files(*args):
    '''
    
    '''
    _ = args
    for tag_key, tag_list in SWITCH_DICS.items():
        if tag_key.startswith('dic_') and (not tag_key.endswith('00')):
            __write_add_tmpl(tag_key, tag_list)
            __write_edit_tmpl(tag_key, tag_list)
            __write_view_tmpl(tag_key, tag_list)

    __write_filter_tmpl(TPL_LIST)
    __write_list_tmpl(TPL_LISTINFO)
1028209
def _get_content_type_queryset(models_list):
    
    content_type_ids = {c.id for c in ContentType.objects.get_for_models(*models_list).values()}
    return ContentType.objects.filter(id__in=content_type_ids)
1141717
function generateTypeDefs(models) {

    types = Object.assign({}, types, getCustomTypeDefs());

    _.forEach(models, (model) => {
        mapType(model);
        mapInputType(model);
    });

    return types;
}
786472
def generate_py():
    """"""
    model = {}

    vk = init()
    format_vk(vk)
    model_alias(vk, model)
    model_typedefs(vk, model)
    model_enums(vk, model)
    model_macros(vk, model)
    model_funcpointers(vk, model)
    model_exceptions(vk, model)
    model_constructors(vk, model)
    model_functions(vk, model)
    model_ext_functions(vk, model)

    env = jinja2.Environment(
        autoescape=False,
        trim_blocks=True,
        lstrip_blocks=True,
        loader=jinja2.FileSystemLoader(HERE)
    )

    out_file = path.join(HERE, path.pardir, 'vulkan', '_vulkan.py')
    with open(out_file, 'w') as out:
        out.write(env.get_template('vulkan.template.py').render(model=model))
170777
def html(content, **kwargs):
    """"""
    if hasattr(content, 'read'):
        return content
    elif hasattr(content, 'render'):
        return content.render().encode('utf8')

    return str(content).encode('utf8')