Include a partial template in the current page.
An error message will be included when partial does not exist.

@param {String} partial: partial template file to include
@param {Function} cb: jazz cb(data) callback
326602
function include(partial, cb) {
    cb((params.partials && params.partials[partial]) ?
      params.partials[partial] :
      '[error] partial ' + partial + ' does not exist');
  }
438537
function getPartialRenderFn(partial, partialName) {
    var jangularDeps = this.getJangularDeps();
    var me = this;

    return function renderPartial(model, elem, attrs) {
        me.isolateScope(model, partial.scope, attrs);

        // throw error if onScopeChange values not in the scope {} definition
        me.checkOnScopeChangeVals(partial, partialName);

        // set defaults before the modify model
        me.setDefaults(model, partial.defaults, partial.scope);

        // set the presets if they exist
        me.applyPresets(model, partial.defaults, partial.presets);

        // if model is injection function, just use that
        me.evalModel(model, partial.scope, partial.model, partialName);

        // this is similar to both jng.pages renderPage()
        // as well as ng.uipart.template (for client side pages and partials)
        me.attachToScope(model, partial.attachToScope);

        // generate the partial view
        var dependencies = _.extend({ subviews: me.getSubviews(partial.subviews) }, jangularDeps);
        return me.pancakes.cook(partial.view, { dependencies: dependencies });
    };
}
1020004
function(name, context, partials) {
        name = this.trim(name);
        if(!partials || partials[name] === undefined) {
          throw({message: "unknown_partial '" + name + "'"});
        }
        if(typeof(context[name]) != "object") {
          return this.render(partials[name], context, partials, true);
        }
        return this.render(partials[name], context[name], partials, true);
      }
49588
function (str, options, cb) {
    var ECT = this.engine;
    var tmpl = this.cache(options) || this.cache(options, new ECT({ root: { page: str }}));
    tmpl.render('page', options, cb);
  }
584944
function renderTemplate(template, context) {
			try {
				var func = _.template(template.template);
				return func(context);
			}
			catch (e) {
				grunt.fail.fatal('Error while rendering template ' + template.filename + ': ' + e.message);
			}
		}
792053
function render(template, locals, layoutTemplates, cb) {
    if (!layoutTemplates) layoutTemplates = [];

    // We'll render templates from bottom to top of the stack, each template
    // being passed the rendered string of the previous ones as `body`
    var i = layoutTemplates.length - 1;

    var _stackRenderer = function(err, htmlStr) {
      if (err) return cb(err);

      if (i >= 0) {
        locals.body = htmlStr;
        renderTemplate(layoutTemplates[i--], locals, _stackRenderer);
      } else {
        cb(null, htmlStr);
      }
    };

    // Start the rendering with the innermost page template
    renderTemplate(template, locals, _stackRenderer);
  }
433698
function middleware(filename, options, cb) {
  var self = this;
  var cache = self.cache;
  var handlebars = self.handlebars;

  self.async = async();

  // grab extension from filename
  // if we need a layout, we will look for one matching out extension
  var extension = path.extname(filename);

  // If passing the locals as data, create the handlebars options object now
  var handlebarsOpts = (self.__localsAsData) ? { data: options._locals } : undefined;

  // render the original file
  // cb(err, str)
  function render_file(locals, cb) {
    // cached?
    var template = cache[filename];
    if (template) {
      return cb(null, template(locals, handlebarsOpts));
    }

    fs.readFile(filename, 'utf8', function(err, str){
      if (err) {
        return cb(err);
      }

      var template = handlebars.compile(str);
      if (locals.cache) {
        cache[filename] = template;
      }

      try {
        var res = template(locals, handlebarsOpts);
        self.async.done(function(values) {
          Object.keys(values).forEach(function(id) {
            res = res.replace(id, values[id]);
          });

          cb(null, res);
        });
      } catch (err) {
        err.message = filename + ': ' + err.message;
        cb(err);
      }
    });
  }

  // render with a layout
  function render_with_layout(template, locals, cb) {
    render_file(locals, function(err, str) {
      if (err) {
        return cb(err);
      }

      locals.body = str;

      var res = template(locals, handlebarsOpts);
      self.async.done(function(values) {
        Object.keys(values).forEach(function(id) {
          res = res.replace(id, values[id]);
        });

        cb(null, res);
      });
    });
  }

  var layout = options.layout;

  // user did not specify a layout in the locals
  // check global layout state
  if (layout === undefined && options.settings && options.settings['view options']) {
    layout = options.settings['view options'].layout;
  }

  // user explicitly request no layout
  // either by specifying false for layout: false in locals
  // or by settings the false view options
  if (layout !== undefined && !layout) {
    return render_file(options, cb);
  }

  var view_dirs = options.settings.views;

  var layout_filename = [].concat(view_dirs).map(function (view_dir) {
    var view_path = path.join(view_dir, layout || 'layout');

    if (!path.extname(view_path)) {
      view_path += extension;
    }

    return view_path;
  });

  var layout_template = layout_filename.reduce(function (cached, filename) {
    if (cached) {
      return cached;
    }

    var cached_file = cache[filename];

    if (cached_file) {
      return cache[filename];
    }

    return undefined;
  }, undefined);

  if (layout_template) {
    return render_with_layout(layout_template, options, cb);
  }

  // TODO check if layout path has .hbs extension

  function cacheAndCompile(filename, str) {
    var layout_template = handlebars.compile(str);
    if (options.cache) {
      cache[filename] = layout_template;
    }

    render_with_layout(layout_template, options, cb);
  }

  function tryReadFileAndCache(templates) {
    var template = templates.shift();

    fs.readFile(template, 'utf8', function(err, str) {
      if (err) {
        if (layout && templates.length === 0) {
          // Only return error if user explicitly asked for layout.
          return cb(err);
        }

        if (templates.length > 0) {
          return tryReadFileAndCache(templates);
        }

        return render_file(options, cb);
      }

      cacheAndCompile(template, str);
    });
  }

  tryReadFileAndCache(layout_filename);
}
137335
function addPartial(filename, done) {
      // Create a copy of the file and delete it from the database.
      const file = clone(files[filename])
      delete files[filename]

      // Compile the partial.
      const info = path.parse(filename)
      const transform = info.ext ? info.ext.substring(1) : null
      const transformer = getTransformer(transform)
      if (transformer) {
        // Construct the options.
        const options = extend({}, metalsmith.metadata(), file, {
          filename: path.join(metalsmith.source(), filename)
        })

        // Compile the partial.
        transformer.compileAsync(file.contents.toString(), options).then(template => {
          /**
           * Define the partial as a function.
           */
          metalsmith.metadata().partials[info.name] = locals => {
            const opt = extend({}, options, locals)
            return template.fn.apply(file, [opt])
          }
          metalsmith.metadata().partials[info.name].file = file
          done()
        }, done)
      } else {
        // Do not error out when the Transformer is not found.
        done()
      }
    }
764422
def partial( template, data={} )
            context = self.class.new( @directory, data )
            ErbLatex::File.evaluate(Pathname.new(template), context.getBinding, @directory)
        end
522040
function run(cb) {
  // check if template is local
  if (/^[./]|(\w:)/.test(template)) {
    var templatePath = template.charAt(0) === '/' || /^\w:/.test(template)
      ? template
      : path.normalize(path.join(process.cwd(), template))
    if (exists(templatePath)) {
      generate(name, templatePath, to, cb)
    } else {
      logger.fatal('Local template "%s" not found.', template)
    }
  } else {
    checkVersion(function () {
      if (!hasSlash) {
        // use official templates
        var officialTemplate = 'vuejs-templates/' + template
        if (template.indexOf('#') !== -1) {
          downloadAndGenerate(officialTemplate, cb)
        } else {
          if (template.indexOf('-2.0') !== -1) {
            warnings.v2SuffixTemplatesDeprecated(template, inPlace ? '' : name)
            return
          }

          warnings.v2BranchIsNowDefault(template, inPlace ? '' : name)
          downloadAndGenerate(officialTemplate, cb)
        }
      } else {
        downloadAndGenerate(template, cb)
      }
    })
  }
}
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();
}
1279231
function (tmpCfg, callback) {
            var div = tmpCfg.div;
            // check if the div is still in the dom
            // (because it could be inside a template which was refreshed, so no longer in the dom)
            if (!ariaUtilsDom.isInDom(div)) {
                this.$callback(callback);
                return;
            }
            var tplWidget = div.__widget;
            Aria.loadTemplate(tmpCfg, function (args) {
                // remap widget content
                if (args.success && tplWidget) {
                    var tplCtxt = args.tplCtxt;
                    var tplCtxtManager = ariaTemplatesTemplateCtxtManager;
                    // TODO: find a cleaner way to do this
                    // as this template is inside a template widget, it is not a root template
                    // (even if we reloaded it with Aria.loadTemplate)
                    // This is necessary for the inspector not to display the template twice:
                    tplCtxtManager.remove(tplCtxt); // remove the template from the list of root templates
                    args.tplCtxt._cfg.isRootTemplate = false; // remove the root template flag
                    tplCtxtManager.add(tplCtxt); // add the template back to the list of templates
                    tplWidget.subTplCtxt = tplCtxt; // add the reference to the template context in the template
                    // widget
                }

                if (callback != null) {
                    this.$callback(callback);
                }
            });
        }
175884
def __partial(source, data={})
      if source.kind_of?(Source)
        Undies::Template.new(source, data, @_undies_io)
      else
        @_undies_io.current.partial(source.to_s)
      end
    end
1026829
function partial(fn) {
  var preset=_slice.call(arguments, 1), self=this
  return function(){ return fn.apply(self, arrfill(preset, arguments)) }
}
748351
function load(cb) {
    var timer = u.timer();
    generator.getSources(opts.sources, opts, function(err, fragments) {

      if (err) return cb && cb(err);

      generator.fragments = fragments;
      generator.fragment$ = u.indexBy(generator.fragments, '_href');

      var pageFragments = u.filter(fragments, function(fragment) {
        return !fragment._compile;
      });
      compilePages(pageFragments);

      var templateFragments = u.where(fragments, { _compile: 'handlebars' } );
      compileTemplates(templateFragments);

      generator.emit('load');    // hook custom loaders
      generator.emit('loaded');  // then announce loaded

      debug('loaded %sms', timer());
      cb && cb();
    });
  }
434341
function(template, context, partials, in_recursion) {
        // tit for tat
        var that = this;

        var new_regex = function() {
          return new RegExp(that.otag + "(=|!|>|\\{|%)?([^\\/#\\^]+?)\\1?" +
            that.ctag + "+", "g");
        };

        var regex = new_regex();
        var tag_replace_callback = function(match, operator, name) {
          switch(operator) {
          case "!": // ignore comments
            return "";
          case "=": // set new delimiters, rebuild the replace regexp
            that.set_delimiters(name);
            regex = new_regex();
            return "";
          case ">": // render partial
            return that.render_partial(name, context, partials);
          case "{": // the triple mustache is unescaped
            return that.find(name, context);
          default: // escape the value
            return that.escape(that.find(name, context));
          }
        };
        var lines = template.split("\n");
        for(var i = 0; i < lines.length; i++) {
          lines[i] = lines[i].replace(regex, tag_replace_callback, this);
          if(!in_recursion) {
            this.send(lines[i]);
          }
        }

        if(in_recursion) {
          return lines.join("\n");
        }
      }
1083842
public function partial( $partial, $child = '', $context = [] ) {
		if ( is_array( $child ) ) {
			// Optional argument $child not specified, flip input around.
			$context = $child;
			$child = '';
		}

		$templates = [];

		if ( $child ) {
			$templates[] = "partials/${partial}-${child}.php";
		}

		$templates[] = "partials/${partial}.php";

		app_render( $templates, $context );
	}