Generate relative template pathes.
550031
def gen_template_files(path):
    "  "

    path = path.rstrip(op.sep)
    for root, _, files in walk(path):
        for f in filter(lambda x: not x in (TPLNAME, CFGNAME), files):
            yield op.relpath(op.join(root, f), path)
469255
def generate(args):
    """"""

    source_files = {args.presentation}

    # Parse the template info
    template_info = Template(args.template)
    if args.css:
        presentation_dir = os.path.split(args.presentation)[0]
        target_path = os.path.relpath(args.css, presentation_dir)
        template_info.add_resource(args.css, CSS_RESOURCE, target=target_path, extra_info='all')
        source_files.add(args.css)
    if args.js:
        presentation_dir = os.path.split(args.presentation)[0]
        target_path = os.path.relpath(args.js, presentation_dir)
        template_info.add_resource(args.js, JS_RESOURCE, target=target_path, extra_info=JS_POSITION_BODY)
        source_files.add(args.js)

    # Make the resulting HTML
    htmldata, dependencies = rst2html(args.presentation, template_info,
                                      args.auto_console, args.skip_help,
                                      args.skip_notes, args.mathjax,
                                      args.slide_numbers)
    source_files.update(dependencies)

    # Write the HTML out
    if not os.path.exists(args.targetdir):
        os.makedirs(args.targetdir)
    with open(os.path.join(args.targetdir, 'index.html'), 'wb') as outfile:
        outfile.write(htmldata)

    # Copy supporting files
    source_files.update(template_info.copy_resources(args.targetdir))

    # Copy images from the source:
    sourcedir = os.path.split(os.path.abspath(args.presentation))[0]
    tree = html.fromstring(htmldata)
    for image in tree.iterdescendants('img'):
        filename = image.attrib['src']
        source_files.add(copy_resource(filename, sourcedir, args.targetdir))

    RE_CSS_URL = re.compile(br"""url\(['"]?(.*?)['"]?[\)\?\#]""")

    # Copy any files referenced by url() in the css-files:
    for resource in template_info.resources:
        if resource.resource_type != CSS_RESOURCE:
            continue
        # path in CSS is relative to CSS file; construct source/dest accordingly
        css_base = template_info.template_root if resource.is_in_template else sourcedir
        css_sourcedir = os.path.dirname(os.path.join(css_base, resource.filepath))
        css_targetdir = os.path.dirname(os.path.join(args.targetdir, resource.final_path()))
        uris = RE_CSS_URL.findall(template_info.read_data(resource))
        uris = [uri.decode() for uri in uris]
        if resource.is_in_template and template_info.builtin_template:
            for filename in uris:
                template_info.add_resource(filename, OTHER_RESOURCE, target=css_targetdir,
                                           is_in_template=True)
        else:
            for filename in uris:
                source_files.add(copy_resource(filename, css_sourcedir, css_targetdir))

    # All done!

    return {os.path.abspath(f) for f in source_files if f}
380
function generatePath(path = "/", params = {}) {
  return path === "/" ? path : compilePath(path)(params, { pretty: true });
}
706381
def split_template_path(template):
    
    pieces = []
    for piece in template.split('/'):
        if path.sep in piece \
           or (path.altsep and path.altsep in piece) or \
           piece == path.pardir:
            raise TemplateNotFound(template)
        elif piece and piece != '.':
            pieces.append(piece)
    return pieces
420041
def autogen(project_path):
    """"""
    generate_quickstart(project_path)

    project = StatikProject(project_path)
    project.config = StatikConfig(project.config_file_path)

    models = list(project.load_models().values())

    logger.info('Creating view and template for home page (index.html).')
    generate_yaml_file(os.path.join(project_path, StatikProject.VIEWS_DIR, 'index.yaml'),
                        {   
                            'path': '/',
                            'template': 'index'
                        }
    )
    generate_index_file(os.path.join(project_path, StatikProject.TEMPLATES_DIR, 'index.jinja2'))

    for model in models:
        logger.info('Creating view and template for model: %s' % model.name)
        generate_yaml_file(os.path.join(project_path, StatikProject.VIEWS_DIR, '%s.yaml' % model.name),
                            {   
                                'path': {
                                    'template': '/%s/{{ %s.pk }}' % (model.name, model.name),
                                    'for-each': {
                                        '%s' % model.name: 'session.query(%s).all()' % model.name
                                    }
                                },
                                'template': ('%s' % model.name),
                            }
        )
        generate_model_file(os.path.join(project_path, StatikProject.TEMPLATES_DIR, '%s.jinja2' % model.name),
                            project,
                            model,
                            model.fields.values())
254081
def templates_for_host(templates):
    
    if not isinstance(templates, (list, tuple)):
        templates = [templates]
    theme_dir = host_theme_path()
    host_templates = []
    if theme_dir:
        for template in templates:
            host_templates.append("%s/templates/%s" % (theme_dir, template))
            host_templates.append(template)
        return host_templates
    return templates
220255
def get_base_templates():
    "  "

    return sorted(filter(
                  lambda x: op.isdir(op.join(TPL_DIR, x)),
                  listdir(TPL_DIR)))
96573
def getpaths(self,libname):
        """"""
        if os.path.isabs(libname):
            yield libname
        else:
            # FIXME / TODO return '.' and os.path.dirname(__file__)
            for path in self.getplatformpaths(libname):
                yield path

            path = ctypes.util.find_library(libname)
            if path: yield path
637129
def get_project_templates(path):
    "  "

    try:
        return open(op.join(path, TPLNAME)).read().strip().split(',')
    except IOError:
        raise MakesiteException("Invalid makesite-project: %s" % path)
1327801
def project_inspect_template_path(cls, project, inspect_template):
        """"""
        return google.api_core.path_template.expand(
            "projects/{project}/inspectTemplates/{inspect_template}",
            project=project,
            inspect_template=inspect_template,
        )
929131
def _items_to_rela_paths(self, items):
        """"""
        paths = []
        for item in items:
            if isinstance(item, (BaseIndexEntry, (Blob, Submodule))):
                paths.append(self._to_relative_path(item.path))
            elif isinstance(item, string_types):
                paths.append(self._to_relative_path(item))
            else:
                raise TypeError("Invalid item type: %r" % item)
        # END for each item
        return paths
735612
def generate_steps_templates
      Bebox::PROVISION_STEPS.each do |step|
        ssh_key = ''
        step_dir = Bebox::Provision.step_name(step)
        templates_path = Bebox::Project::templates_path
        # Generate site.pp template
        generate_file_from_template("#{templates_path}/puppet/#{step}/manifests/site.pp.erb", "#{self.path}/puppet/steps/#{step_dir}/manifests/site.pp", {nodes: []})
        # Generate hiera.yaml template
        generate_file_from_template("#{templates_path}/puppet/#{step}/hiera/hiera.yaml.erb", "#{self.path}/puppet/steps/#{step_dir}/hiera/hiera.yaml", {step_dir: step_dir})
        # Generate common.yaml template
        generate_file_from_template("#{templates_path}/puppet/#{step}/hiera/data/common.yaml.erb", "#{self.path}/puppet/steps/#{step_dir}/hiera/data/common.yaml", {step_dir: step_dir, ssh_key: ssh_key, project_name: self.shortname})
      end
    end
1285724
def iter_paths(src_dir):
    
    for x in scandir(os.path.join(src_dir)):
        if x.is_dir(follow_symlinks=False):
            for x in iter_paths(x.path):
                yield x
        else:
            yield x
299058
function generatePath(route, params) {
    return route.pattern.replace(nameOrSplatParam, function(_, name) { return params[name]; });
  }
792960
def get_template_options():
        
        template_root = turrentine_settings.TURRENTINE_TEMPLATE_ROOT
        turrentine_dir = turrentine_settings.TURRENTINE_TEMPLATE_SUBDIR
        output = []
        for root, dirs, files in os.walk(turrentine_dir):
            for file_name in files: 
                full_path = os.path.join(root, file_name)
                relative_path = os.path.relpath(full_path, template_root)
                output.append(relative_path)
        return output
950816
def _set_relative_pythonpath(self, value):
        """"""
        self.pythonpath = [osp.abspath(osp.join(self.root_path, path))
                           for path in value]
1145595
def template_name(self, path, base):
        """"""
        if not base:
            path = os.path.basename(path)
        if path == base:
            base = os.path.dirname(path)
        name = re.sub(r"^%s[\/\\]?(.*)%s$" % (
            re.escape(base), re.escape(settings.TEMPLATE_EXT)
        ), r"\1", path)
        return re.sub(r"[\/\\]", settings.TEMPLATE_SEPARATOR, name)