expects pages/:name/template.hbs
497
function (id) {
    var o = this.options;
    return path.resolve(o.root, o.viewsDir, id, "template" + o.extension);
  }
674486
def new(path='.', template=None):
    
    path = abspath(path.rstrip(sep))
    template = template or DEFAULT_TEMPLATE_URL
    render_skeleton(
        template, path,
        include_this=['.gitignore'],
        filter_this=[
            '~*', '*.py[co]',
            '__pycache__', '__pycache__/*',
            '.git', '.git/*',
            '.hg', '.hg/*',
            '.svn', '.svn/*',
        ]
    )
    print(HELP_MSG % (path,))
499394
def permission_denied(request, template_name='403.html'):
    

    response = render_in_page(request, template_name)

    if response:
        return response

    try:
        template = loader.get_template(template_name)
    except TemplateDoesNotExist:
        return http.HttpResponseForbidden('<h1>403 Forbidden</h1>', content_type='text/html')
    return http.HttpResponseForbidden(template.render(RequestContext(request)))
781103
async function createDispatcher(options={}){

    // merge options
    const opt = {
        template: options.template || _path.join(__dirname, '../assets/template.ejs'),
        css: options.css || _path.join(__dirname, '../assets/layout.css'),
        lang: options.lang || 'en_US',
        footer: options.footer || null
    };

    // load page template
    const tpl = await _fs.readFile(opt.template, 'utf8');

    // load styles
    const css = await _fs.readFile(opt.css, 'utf8');
    
    // load page definitions
    const pages = await _jsonReader(_path.join(__dirname, '../i18n/pages-' + opt.lang + '.json'));

    // multi-type support
    // @see https://github.com/expressjs/express/blob/master/examples/error-pages/index.js
    return function dispatchRequest(page, httpStatusCode, req, res){
        // page available ?
        if (!pages[page]){
            // use "internal server error" as default
            page = '500';
            httpStatusCode = null;
        }

        // set http status code
        res.status(httpStatusCode || 500);

        // extract page date
        const pageData = pages[page];

        // multiple response formats
        res.format({
            // standard http-error-pages
            html: function(){
                res.type('.html');
                res.send(_render(tpl, css, {
                    code: httpStatusCode,
                    title: pageData.title,
                    message: pageData.message,
                    footer: opt.footer
                }))
            },

            // json
            json: function(){
                res.json({
                    error: pageData.title + ' - ' + pageData.message
                })
            },

            // text response
            default: function(){
                // plain text
                res.type('.txt').send(pageData.title + ' - ' + pageData.message);
            }
        })
    }
}
591714
def _create_template(self, name):
        
        url = '%s/%s' % (self._base_url, escape.url_escape(name))
        LOGGER.debug('Making HTTP GET request to %s', url)
        response = self._http_client.fetch(url)
        data = json.loads(response.body, ensure_ascii=False)
        return template.Template(data['template'], name=name, loader=self)
472036
function renderPage(uri, req, res, hrStart) {
  const locals = res.locals,
    extension = getExtension(req),
    renderer = findRenderer(extension);

  // Add request route params, request query params
  // and the request extension to the locals object
  locals.params = req.params;
  locals.query = req.query;
  locals.extension = extension;

  // look up page alias' component instance
  return getDBObject(uri)
    .then(formDataFromLayout(locals, uri))
    .then(data => {
      logTime(hrStart, uri);
      return data;
    })
    .then(({ data, options }) => renderer.render(data, options, res))
    .catch(responses.handleError(res));
}
780298
def update(self, name, html_url, zip_url):
        """"""
        body = {
            "Name": name,
            "HtmlPageURL": html_url,
            "ZipFileURL": zip_url}
        response = self._put("/templates/%s.json" %
                             self.template_id, json.dumps(body))
130165
function wxappEntry() {

  const regex = /src\/pages\/([^\/]+)\/[^\.]+.js/;
  
  return {
    entry: () => {

      let pages = {}
      let core = []

      glob.sync(`./src/pages/**/*.js`).forEach(x => {
        const name = x.match(regex)[1]
        const key = `pages/${name}/${name}`
        pages[key] = x
      })

      return Object.assign({}, pages, {
        app: [
          //'webpack-dev-server/client',
          //'webpack/hot/only-dev-server',
          './src/app.js'
        ]
      })
    }
  }
}
753299
function loadTemplate(template, name, callback) {
  async.waterfall([
    cb => source(template.path, template.filter, template.readMode, cb),
    (files, cb) => asDataMap(files, template.mapping, cb),
  ], (error, result) => {
    async.nextTick(callback, error, result);
  });
}
192880
def create_page(pagename):
    
    page = pagename.lstrip("/").rstrip("/")
    _, _ext = os.path.splitext(pagename)

    # If the file doesn't have an extension, we'll just create one
    if not _ext or _ext == "":
        page += ".jade"

    if not page.endswith(PAGE_FORMAT):
        error("Can't create '%s'" % page)
        print("Invalid filename format")
        print("Filename must be in: '%s'" % " | ".join(PAGE_FORMAT))
    else:
        engine = Yass(CWD)
        markup = "jade"
        if page.endswith(".md"):
            markup = "md"
        if page.endswith(".html"):
            markup = "html"

        dest_file = os.path.join(engine.pages_dir, page)
        dest_dir = os.path.dirname(dest_file)

        content = TPL_HEADER
        content += TPL_BODY[markup]

        if os.path.isfile(dest_file):
            error("File exists already")
            print("Location: %s" % dest_file)

        else:
            if not os.path.isdir(dest_dir):
                os.makedirs(dest_dir)
            with open(dest_file, "w") as f:
                f.write(content)

            print("New page created: '%s'" % page)
            print("Location: %s" % dest_file)


    footer()
831802
function _processHeaders(siteDesc, prefix) {

    if (!siteDesc.headers) {
        return;
    }
    //console.log('headers', siteDesc.headers, 'prefix', prefix);
    let headers = siteDesc.headers;
    let isInSiteStructure = false;
    if (siteDescriptionReader.checkParams(siteDesc.requiredParams)) {
        isInSiteStructure = true;
    }
    for (let i in headers) {
        _processElement(headers[i], prefix, { isInSiteStructure: isInSiteStructure });
    }
}
1128146
def create
      @page = Humpyard::config.page_types[params[:type]].new params[:page]
      @page.title_for_url = @page.page.suggested_title_for_url
      
      authorize! :create, @page.page
      
      if @page.save
        @prev = Humpyard::Page.find_by_id(params[:prev_id])
        @next = Humpyard::Page.find_by_id(params[:next_id])
        
        #do_move(@page, @prev, @next)
      
        # insert_options = {
        #   :element => "hy-id-#{@page.id}",
        #   :url => @page.page.human_url,
        #   :parent => @page.parent ? "hy-page-dialog-item-#{@page.id}" : "hy-page-dialog-pages"
        # }
        
        # insert_options[:before] = "hy-page-dialog-item-#{@next.id}" if @next
        # insert_options[:after] = "hy-page-dialog-item-#{@prev.id}" if not @next and @prev

        # just reload the tree
      
        replace_options = {
          :element => "hy-page-treeview",
          :content => render_to_string(:partial => "tree.html", :locals => {:page => @page})
        }
      
        render :json => {
          :status => :ok,
          #:dialog => :close,
          # :insert => [insert_options],
          :replace => [replace_options],
          :flash => {
            :level => 'info',
            :content => I18n.t('humpyard_form.flashes.create_success', :model => Humpyard::Page.model_name.human)
          }
        }
      else
        render :json => {
          :status => :failed, 
          :errors => @page.errors,
          :flash => {
            :level => 'error',
            :content => I18n.t('humpyard_form.flashes.create_fail', :model => Humpyard::Page.model_name.human)
          }
        }
      end
    end
1371846
function compileTemplates() {
  const mainHtml = fs.readFileSync(path.resolve(docsDir, 'src/template.html'), {
    encoding: 'utf8',
  });
  const mainTemplate = Handlebars.compile(mainHtml);

  function createPage(fileName, tab, content) {
    const html = mainTemplate({
      tabs: [{
        title: 'Get started',
        url: 'get-started.html',
        selected: tab === 'get-started',
      }, {
        title: 'Components',
        url: 'components.html',
        selected: tab === 'components',
      }],
      content,
      luiVersion: LUI_VERSION,
    });
    fileUtil.writeFile(path.resolve(docsDir, 'dist', fileName), html);
  }

  function createIndexPage() {
    const content = fs.readFileSync(path.resolve(docsDir, 'src/pages/index.html'), {
      encoding: 'utf8',
    });
    const template = Handlebars.compile(content);
    const html = template();
    return createPage('index.html', 'index', html);
  }

  function createGetStartedPage() {
    const content = fs.readFileSync(path.resolve(docsDir, 'src/pages/get-started.html'), {
      encoding: 'utf8',
    });
    const template = Handlebars.compile(content);
    const html = template({
      luiVersion: LUI_VERSION,
    });
    return createPage('get-started.html', 'get-started', html);
  }

  function createComponentPage(templateName, template, tab, content) {
    return createPage(templateName, tab, template({
      content,
      sections: sections.map(section => ({
        name: section.name,
        pages: section.pages.map(page => ({
          name: page.name,
          template: page.template,
          selected: page.template === templateName,
        })),
      })),
    }));
  }

  function createComponentPages() {
    const componentHtml = fs.readFileSync(path.resolve(docsDir, 'src/component-template.html'), {
      encoding: 'utf8',
    });
    const componentTemplate = Handlebars.compile(componentHtml);

    sections.forEach((section) => {
      section.pages.forEach((page) => {
        const file = `src/pages/${page.template}`;
        const fileContent = fs.readFileSync(path.resolve(docsDir, file), {
          encoding: 'utf8',
        });

        const template = Handlebars.compile(fileContent);
        const html = template();

        createComponentPage(page.template, componentTemplate, 'components', html);
      });
    });

    const file = 'src/pages/components.html';
    const fileContent = fs.readFileSync(path.resolve(docsDir, file), {
      encoding: 'utf8',
    });
    createComponentPage('components.html', componentTemplate, 'components', fileContent);
  }

  createIndexPage();
  createGetStartedPage();
  createComponentPages();
}
223200
def get_template_names(self):
        """"""
        request = self.request
        querystring_key = request.REQUEST.get('querystring_key', PAGE_LABEL)
        if request.is_ajax() and querystring_key == self.key:
            return [self.page_template]
        return super(
            AjaxMultipleObjectTemplateResponseMixin, self).get_template_names()
739122
function setupPage( pageName ) {
         assert( pageName ).hasType( String ).isNotNull();

         publishDebugInfo( 'willLoad.page', { page: pageName } );

         return pageLoader.load( pageName )
            .then( page => {
               areaHelper = createAreaHelper( page, log );
               visibilityManager.setAreaHelper( areaHelper );

               const layoutPromise = layoutLoader.load( page.layout )
                  .then( layoutInfo => {
                     cleanUpLayout = renderLayout( pageElement, areaHelper, layoutInfo );
                  } );

               localeManager.subscribe();
               const layoutWidget = widget => layoutWidgetAdapterFor( areaHelper, widget );

               // instantiate controllers wrapped by widget adapters
               const widgetPromises = widgetsForPage( page )
                  .map( widget => 'layout' in widget ?
                     layoutWidget( widget ) :
                     widgetLoader.load( widget, {}, instanceContext ) );

               return Promise.all( [ ...widgetPromises, layoutPromise ] )
                  .then( results => results.slice( 0, -1 ) );
            } )
            .then( widgetAdapterWrappers => {
               publishDebugInfo( 'didLoad.page', { page: pageName } );

               activePage = pageName;
               activeWidgetAdapterWrappers = widgetAdapterWrappers;
            } )
            .then( localeManager.initialize )
            .then( () => {
               return eventBus.publishAndGatherReplies(
                  'beginLifecycleRequest.default', LIFECYCLE_EVENT, EVENT_OPTIONS
               );
            } )
            .then( visibilityManager.initialize )
            // Give the widgets (a little) time to settle on the event bus before $digesting and painting:
            .then( () => delay( WIDGET_ATTACH_DELAY_MS ) )
            .then( () => areaHelper.attachWidgets( activeWidgetAdapterWrappers ) );
      }
863159
def call_html_page_context(cls, kb_app, sphinx_app: Sphinx,
                               pagename: str,
                               templatename: str,
                               context,
                               doctree: doctree
                               ):
        

        # We need to let one, and only one, callback return the name of
        # the template. Detect multiple and raise an exception.
        new_templatename = None

        for callback in EventAction.get_callbacks(kb_app,
                                                  SphinxEvent.HPC):
            # The protocol: the one controlling callback will return a value
            # with a dictionary of {'templatename': 'sometemplate'}
            result = callback(kb_app, sphinx_app, pagename, templatename,
                              context,
                              doctree)
            if result and isinstance(result,
                                     dict) and 'templatename' in result:
                if new_templatename is not None:
                    raise AssertionError('Multiple handlers returning')
                new_templatename = result['templatename']

        return new_templatename
710363
def get_page_templates():
    """"""
    PAGE_TEMPLATES = get_setting('PAGE_TEMPLATES',
        default_value=())
    if isinstance(PAGE_TEMPLATES, collections.Callable):
        return PAGE_TEMPLATES()
    else:
        return PAGE_TEMPLATES