Method that parse the contactplaceholder template tag.
504073
def do_jsonplaceholder(parser, token):
    
    name, params = parse_placeholder(parser, token)
    return JsonPlaceholderNode(name, **params)
1120802
function parseUnnamedCondition( $funcName, &$args, $tpl, &$text, &$text_len, &$cur_pos,
                                    $relatedTemplateName, $startLine, $startColumn, $rootNamespace )
    {
        $cond = $this->ElementParser->parseVariableTag( $tpl, $relatedTemplateName, $text, $cur_pos, $cur_pos, $text_len, $rootNamespace );
        if ( !count( $cond ) )
        {
            $this->showParseErrorMessage( $tpl, $text, $text_len, $cur_pos, $relatedTemplateName, $startLine, $startColumn,
                                          $funcName, 'Not enough arguments' );
            return;

        }
        $args['condition'] = $cond;
    }
937538
private Template parseTemplate(Resource resource, String name, Locale locale, String encoding, Object args) throws IOException, ParseException {
        if (resource == null) {
            resource = loadResource(name, locale, encoding);
        }
        long start = logger != null && logger.isDebugEnabled() ? System.currentTimeMillis() : 0;
        String source = resource.getSource();
        try {
            if (templateFilter != null) {
                source = templateFilter.filter(resource.getName(), source);
            }
            Node root = templateParser.parse(source, 0);
            Map<String, Class<?>> parameterTypes = useRenderVariableType && args != null ? new DelegateMap<String, Class<?>>(new TypeMap(convertMap(args))) : null;
            Template template = translator.translate(resource, root, parameterTypes);
            if (logger != null && logger.isDebugEnabled()) {
                logger.debug("Parsed the template " + name + ", eslapsed: " + (System.currentTimeMillis() - start) + "ms.");
            }
            return template;
        } catch (ParseException e) {
            throw AbstractTemplate.toLocatedParseException(e, resource);
        }
    }
245688
private ContentElement parseContentElement(SpanManager sm,
			ContentElementParsingParameters cepp, LinkedList<Span> lineSpans,
			ContentElement result)
	{

		List<Link> localLinks = new ArrayList<Link>();
		List<Template> localTemplates = new ArrayList<Template>();

		List<Span> boldSpans = new ArrayList<Span>();
		List<Span> italicSpans = new ArrayList<Span>();
		sm.manageList(boldSpans);
		sm.manageList(italicSpans);

		List<Span> managedSpans = new ArrayList<Span>();
		sm.manageList(managedSpans);

		Span contentElementRange = new Span(lineSpans.getFirst().getStart(),
				lineSpans.getLast().getEnd()).trim(sm);
		managedSpans.add(contentElementRange);

		// set the SrcSpan
		if (calculateSrcSpans)
		{
			result.setSrcSpan(new SrcSpan(sm.getSrcPos(contentElementRange
					.getStart()), sm.getSrcPos(contentElementRange.getEnd())));
		}

		sm.manageList(lineSpans);
		while (!lineSpans.isEmpty())
		{
			Span line = lineSpans.getFirst();

			parseBoldAndItalicSpans(sm, line, boldSpans, italicSpans);

			// External links
			parseExternalLinks(sm, line, "http://", managedSpans, localLinks,
					result);
			parseExternalLinks(sm, line, "https://", managedSpans, localLinks,
					result);
			parseExternalLinks(sm, line, "ftp://", managedSpans, localLinks,
					result);
			parseExternalLinks(sm, line, "mailto:", managedSpans, localLinks,
					result);

			// end of linewhise opperations
			lineSpans.removeFirst();
		}
		sm.removeManagedList(lineSpans);

		// Links
		int i;
		i = 0;
		while (i < cepp.linkSpans.size())
		{
			if (contentElementRange.hits(cepp.linkSpans.get(i)))
			{
				Span linkSpan = cepp.linkSpans.remove(i);
				managedSpans.add(linkSpan);
				Link l = cepp.links.remove(i).setHomeElement(result);
				localLinks.add(l);
				if (!showImageText && l.getType() == Link.type.IMAGE)
				{
					// deletes the Image Text from the ContentElement Text.
					sm.delete(linkSpan);
				}
			}
			else
			{
				i++;
			}
		}

		// Templates
		i = 0;
		while (i < cepp.templateSpans.size())
		{
			Span ts = cepp.templateSpans.get(i);
			if (contentElementRange.hits(ts))
			{
				ResolvedTemplate rt = cepp.templates.remove(i);

				if (rt.getPostParseReplacement() != null)
				{
					sm.replace(ts, rt.getPostParseReplacement());
				}
				cepp.templateSpans.remove(i);

				Object parsedObject = rt.getParsedObject();
				if (parsedObject != null)
				{
					managedSpans.add(ts);

					Class parsedObjectClass = parsedObject.getClass();
					if (parsedObjectClass == Template.class)
					{
						localTemplates.add((Template) parsedObject);
					}
					else if (parsedObjectClass == Link.class)
					{
						localLinks.add(((Link) parsedObject)
								.setHomeElement(result));
					}
					else
					{
						localTemplates.add(rt.getTemplate());
					}
				}
			}
			else
			{
				i++;
			}
		}

		// HTML/XML Tags
		i = 0;
		List<Span> tags = new ArrayList<Span>();
		while (i < cepp.tagSpans.size())
		{
			Span s = cepp.tagSpans.get(i);
			if (contentElementRange.hits(s))
			{
				cepp.tagSpans.remove(i);
				if (deleteTags)
				{
					sm.delete(s);
				}
				else
				{
					tags.add(s);
					managedSpans.add(s);
				}
			}
			else
			{
				i++;
			}
		}

		// noWiki
		i = 0;
		List<Span> localNoWikiSpans = new ArrayList<Span>();
		while (i < cepp.noWikiSpans.size())
		{
			Span s = cepp.noWikiSpans.get(i);
			if (contentElementRange.hits(s))
			{
				cepp.noWikiSpans.remove(i);
				sm.replace(s, cepp.noWikiStrings.remove(i));
				localNoWikiSpans.add(s);
				managedSpans.add(s);
			}
			else
			{
				i++;
			}
		}

		// MATH Tags
		i = 0;
		List<Span> mathSpans = new ArrayList<Span>();
		while (i < cepp.mathSpans.size())
		{
			Span s = cepp.mathSpans.get(i);
			if (contentElementRange.hits(s))
			{
				cepp.mathSpans.remove(i);

				if (showMathTagContent)
				{
					mathSpans.add(s);
					managedSpans.add(s);
					sm.replace(s, cepp.mathStrings.remove(i));
				}
				else
				{
					sm.delete(s);
				}
			}
			else
			{
				i++;
			}
		}

		result.setText(sm.substring(contentElementRange));

		// managed spans must be removed here and not earlier, because every
		// change in the SpanManager affects the Spans!
		sm.removeManagedList(boldSpans);
		sm.removeManagedList(italicSpans);
		sm.removeManagedList(managedSpans);

		// contentElementRange ist auch noch in managedSpans !!! deswegen:
		final int adjust = -contentElementRange.getStart();
		for (Span s : boldSpans)
		{
			s.adjust(adjust);
		}
		for (Span s : italicSpans)
		{
			s.adjust(adjust);
		}
		for (Span s : managedSpans)
		{
			s.adjust(adjust);
		}

		result.setFormatSpans(FormatType.BOLD, boldSpans);
		result.setFormatSpans(FormatType.ITALIC, italicSpans);
		result.setFormatSpans(FormatType.TAG, tags);
		result.setFormatSpans(FormatType.MATH, mathSpans);
		result.setFormatSpans(FormatType.NOWIKI, localNoWikiSpans);

		result.setLinks(sortLinks(localLinks));
		result.setTemplates(sortTemplates(localTemplates));

		return result;
	}
531594
function(apiKey, contactList, fromAddress,
        toAddress, ccAddresses, bccAddresses, contentType, subject, htmlBody,
        textBody, _templateId) {}
394168
def from_string(self, template_code):
        '''
        
        '''
        dmp = apps.get_app_config('django_mako_plus')
        mako_template = Template(template_code, imports=dmp.template_imports, input_encoding=dmp.options['DEFAULT_TEMPLATE_ENCODING'])
        return MakoTemplateAdapter(mako_template)
535242
def respond_to_contact_info(self, message):
        """"""
        contacts = self.load("contact_info", {})
        context = {
            "contacts": contacts,
        }
        contact_html = rendered_template("contact_info.html", context)
        self.say(contact_html, message=message)
381328
public void invokeTemplate(int line, String name, ITemplate caller, ITag.__ParameterList params, ITag.__Body body, ITag.__Body context, boolean ignoreNonExistsTag) {
        if (_nonExistsTags.contains(name)) return;

        Sandbox.enterSafeZone(secureCode);
        RythmEvents.ENTER_INVOKE_TEMPLATE.trigger(this, (TemplateBase) caller);
        try {
            // try tag registry first
            ITemplate t = _tags.get(name);
            if (null == t) {
                t = _templates.get(name);
            }
            if (null == t && S.isEqual(name, caller.__getName())) {
                // is calling self
                t = caller;
            }

            if (null == t) {
                // try imported path
                TemplateClass tc = caller.__getTemplateClass(true);
                if (null != tc.importPaths) {
                    for (String s : tc.importPaths) {
                        if (s.startsWith("java")) {
                            continue;
                        }
                        String name0 = s + "." + name;
                        t = _tags.get(name0);
                        if (null == t) t = _templates.get(name0);
                        if (null != t) break;
                    }
                }

                // try relative path
                if (null == t) {
                    String callerName = tc.getTagName();
                    int pos = -1;
                    if (null != callerName) pos = callerName.lastIndexOf(".");
                    if (-1 != pos) {
                        String name0 = callerName.substring(0, pos) + "." + name;
                        t = _tags.get(name0);
                        if (null == t) t = _templates.get(name0);
                    }
                }

                // try load the tag from resource
                if (null == t) {
                    tc = resourceManager().tryLoadTemplate(name, tc, caller.__curCodeType());
                    if (null != tc) t = _templates.get(tc.getTagName());
                    if (null == t) {
                        if (ignoreNonExistsTag) {
                            if (logger.isDebugEnabled()) {
                                logger.debug("cannot find tag: " + name);
                            }
                            _nonExistsTags.add(name);
                            if (isDevMode() && nonExistsTemplatesChecker == null) {
                                nonExistsTemplatesChecker = new NonExistsTemplatesChecker();
                            }
                            return;
                        } else {
                            throw new NullPointerException("cannot find tag: " + name);
                        }
                    }
                    t = t.__cloneMe(this, caller);
                }
            }

            if (!(t instanceof JavaTagBase)) {
                // try refresh the tag loaded from template file under tag root
                // note Java source tags are not reloaded here
                String cn = t.getClass().getName();
                TemplateClass tc0 = classes().getByClassName(cn);
                if (null == tc0) {
                    throw new NullPointerException(String.format("null tc0 found. t.class: %s, name: %s, caller.class: %s", cn, name, caller.getClass()));
                }
                t = tc0.asTemplate(caller, this);
            } else {
                t = t.__cloneMe(this, caller);
            }

            if (null != params) {
                if (t instanceof JavaTagBase) {
                    ((JavaTagBase) t).__setRenderArgs0(params);
                } else {
                    for (int i = 0; i < params.size(); ++i) {
                        ITag.__Parameter param = params.get(i);
                        if (null != param.name) t.__setRenderArg(param.name, param.value);
                        else t.__setRenderArg(i, param.value);
                    }
                }
            }
            if (null == body && null != params) {
                body = (ITag.__Body) params.getByName("__body");
                if (null == body) {
                    body = (ITag.__Body) params.getByName("_body");
                }
            }
            if (null != body) {
                t.__setRenderArg("__body", body);
                t.__setRenderArg("_body", body); // for compatibility
            }
            RythmEvents.ON_TAG_INVOCATION.trigger(this, F.T2((TemplateBase) caller, t));
            try {
                if (null != context) {
                    t.__setBodyContext(context);
                }
                t.__setSecureCode(secureCode).__call(line);
            } finally {
                RythmEvents.TAG_INVOKED.trigger(this, F.T2((TemplateBase) caller, t));
            }
        } finally {
            RythmEvents.EXIT_INVOKE_TEMPLATE.trigger(this, (TemplateBase) caller);
            Sandbox.leaveCurZone(secureCode);
        }
    }
815218
def _parse(self, context=0, push=True):
        """"""
        if push:
            self._push(context)
        while True:
            this = self._read()
            if self._context & contexts.UNSAFE:
                if not self._verify_safe(this):
                    if self._context & contexts.DOUBLE:
                        self._pop()
                    self._fail_route()
            if this not in self.MARKERS:
                self._emit_text(this)
                self._head += 1
                continue
            if this is self.END:
                return self._handle_end()
            next = self._read(1)
            if this == next == "{":
                if self._can_recurse():
                    self._parse_template_or_argument()
                else:
                    self._emit_text("{")
            elif this == "|" and self._context & contexts.TEMPLATE:
                self._handle_template_param()
            elif this == "=" and self._context & contexts.TEMPLATE_PARAM_KEY:
                self._handle_template_param_value()
            elif this == next == "}" and self._context & contexts.TEMPLATE:
                return self._handle_template_end()
            elif this == "|" and self._context & contexts.ARGUMENT_NAME:
                self._handle_argument_separator()
            elif this == next == "}" and self._context & contexts.ARGUMENT:
                if self._read(2) == "}":
                    return self._handle_argument_end()
                else:
                    self._emit_text("}")
            elif this == next == "[" and self._can_recurse():
                if not self._context & contexts.NO_WIKILINKS:
                    self._parse_wikilink()
                else:
                    self._emit_text("[")
            elif this == "|" and self._context & contexts.WIKILINK_TITLE:
                self._handle_wikilink_separator()
            elif this == next == "]" and self._context & contexts.WIKILINK:
                return self._handle_wikilink_end()
            elif this == "[":
                self._parse_external_link(True)
            elif this == ":" and self._read(-1) not in self.MARKERS:
                self._parse_external_link(False)
            elif this == "]" and self._context & contexts.EXT_LINK_TITLE:
                return self._pop()
            elif this == "=" and not self._global & contexts.GL_HEADING:
                if self._read(-1) in ("\n", self.START):
                    self._parse_heading()
                else:
                    self._emit_text("=")
            elif this == "=" and self._context & contexts.HEADING:
                return self._handle_heading_end()
            elif this == "\n" and self._context & contexts.HEADING:
                self._fail_route()
            elif this == "&":
                self._parse_entity()
            elif this == "<" and next == "!":
                if self._read(2) == self._read(3) == "-":
                    self._parse_comment()
                else:
                    self._emit_text(this)
            elif this == "<" and next == "/" and self._read(2) is not self.END:
                if self._context & contexts.TAG_BODY:
                    self._handle_tag_open_close()
                else:
                    self._handle_invalid_tag_start()
            elif this == "<" and not self._context & contexts.TAG_CLOSE:
                if self._can_recurse():
                    self._parse_tag()
                else:
                    self._emit_text("<")
            elif this == ">" and self._context & contexts.TAG_CLOSE:
                return self._handle_tag_close_close()
            elif this == next == "'" and not self._skip_style_tags:
                result = self._parse_style()
                if result is not None:
                    return result
            elif self._read(-1) in ("\n", self.START) and this in ("#", "*", ";", ":"):
                self._handle_list()
            elif self._read(-1) in ("\n", self.START) and (
                    this == next == self._read(2) == self._read(3) == "-"):
                self._handle_hr()
            elif this in ("\n", ":") and self._context & contexts.DL_TERM:
                self._handle_dl_term()
                if this == "\n":
                    # Kill potential table contexts
                    self._context &= ~contexts.TABLE_CELL_LINE_CONTEXTS
            # Start of table parsing
            elif this == "{" and next == "|" and (
                    self._read(-1) in ("\n", self.START) or
                    (self._read(-2) in ("\n", self.START) and self._read(-1).isspace())):
                if self._can_recurse():
                    self._parse_table()
                else:
                    self._emit_text("{")
            elif self._context & contexts.TABLE_OPEN:
                if this == next == "|" and self._context & contexts.TABLE_TD_LINE:
                    if self._context & contexts.TABLE_CELL_OPEN:
                        return self._handle_table_cell_end()
                    self._handle_table_cell("||", "td", contexts.TABLE_TD_LINE)
                elif this == next == "|" and self._context & contexts.TABLE_TH_LINE:
                    if self._context & contexts.TABLE_CELL_OPEN:
                        return self._handle_table_cell_end()
                    self._handle_table_cell("||", "th", contexts.TABLE_TH_LINE)
                elif this == next == "!" and self._context & contexts.TABLE_TH_LINE:
                    if self._context & contexts.TABLE_CELL_OPEN:
                        return self._handle_table_cell_end()
                    self._handle_table_cell("!!", "th", contexts.TABLE_TH_LINE)
                elif this == "|" and self._context & contexts.TABLE_CELL_STYLE:
                    return self._handle_table_cell_end(reset_for_style=True)
                # on newline, clear out cell line contexts
                elif this == "\n" and self._context & contexts.TABLE_CELL_LINE_CONTEXTS:
                    self._context &= ~contexts.TABLE_CELL_LINE_CONTEXTS
                    self._emit_text(this)
                elif (self._read(-1) in ("\n", self.START) or
                      (self._read(-2) in ("\n", self.START) and self._read(-1).isspace())):
                    if this == "|" and next == "}":
                        if self._context & contexts.TABLE_CELL_OPEN:
                            return self._handle_table_cell_end()
                        if self._context & contexts.TABLE_ROW_OPEN:
                            return self._handle_table_row_end()
                        return self._handle_table_end()
                    elif this == "|" and next == "-":
                        if self._context & contexts.TABLE_CELL_OPEN:
                            return self._handle_table_cell_end()
                        if self._context & contexts.TABLE_ROW_OPEN:
                            return self._handle_table_row_end()
                        self._handle_table_row()
                    elif this == "|":
                        if self._context & contexts.TABLE_CELL_OPEN:
                            return self._handle_table_cell_end()
                        self._handle_table_cell("|", "td", contexts.TABLE_TD_LINE)
                    elif this == "!":
                        if self._context & contexts.TABLE_CELL_OPEN:
                            return self._handle_table_cell_end()
                        self._handle_table_cell("!", "th", contexts.TABLE_TH_LINE)
                    else:
                        self._emit_text(this)
                else:
                    self._emit_text(this)

            else:
                self._emit_text(this)
            self._head += 1
1164935
private void parseMatch(I_CmsXmlContentLocation linkFormatterLoc, boolean strict) throws ParseException {

        Set<String> containerTypes = new HashSet<String>();
        I_CmsXmlContentValueLocation typesLoc = linkFormatterLoc.getSubValue(path(N_MATCH, N_TYPES));
        I_CmsXmlContentValueLocation widthLoc = linkFormatterLoc.getSubValue(path(N_MATCH, N_WIDTH));
        if (typesLoc != null) {
            List<I_CmsXmlContentValueLocation> singleTypeLocs = typesLoc.getSubValues(N_CONTAINER_TYPE);
            for (I_CmsXmlContentValueLocation singleTypeLoc : singleTypeLocs) {
                String containerType = singleTypeLoc.getValue().getStringValue(m_cms).trim();
                containerTypes.add(containerType);
            }
            m_containerTypes = containerTypes;
        } else if (widthLoc != null) {
            String widthStr = getString(widthLoc, N_WIDTH, null);
            String maxWidthStr = getString(widthLoc, N_MAX_WIDTH, null);
            try {
                m_width = Integer.parseInt(widthStr);
            } catch (Exception e) {
                throw new ParseException("Invalid container width: [" + widthStr + "]", e);
            }
            try {
                m_maxWidth = Integer.parseInt(maxWidthStr);
            } catch (Exception e) {
                m_maxWidth = Integer.MAX_VALUE;
                LOG.debug(maxWidthStr, e);
            }
        } else {
            if (strict) {
                throw new ParseException("Neither container types nor container widths defined!");
            } else {
                m_width = -1;
                m_maxWidth = Integer.MAX_VALUE;
            }
        }
    }
1205791
protected void parseRootElement() {

    JobExecutorXmlImpl jobExecutor = new JobExecutorXmlImpl();
    List<ProcessEngineXml> processEngines = new ArrayList<ProcessEngineXml>();

    for (Element element : rootElement.elements()) {

      if(JOB_EXECUTOR.equals(element.getTagName())) {
        parseJobExecutor(element, jobExecutor);

      } else if(PROCESS_ENGINE.equals(element.getTagName())) {
        parseProcessEngine(element, processEngines);

      }

    }

    bpmPlatformXml = new BpmPlatformXmlImpl(jobExecutor, processEngines);
  }
907090
def tranz_context(parser, token):
    
    tokens = token.split_contents()

    parameters = {}
    for idx, token in enumerate(tokens[1:], start=1):
        if "=" in token:
            if token[0:token.index('=')] not in ("domain", "prefix", "locale"):
                raise TemplateSyntaxError(
                    "Unexpected token {0} in tag {{tag_name}}".format(token)
                )

            k, v = token[0:token.index('=')], token[token.index('=') + 1:]
            parameters[k] = v
        else:
            raise TemplateSyntaxError(
                "Unexpected token {0} in tag {{tag_name}}".format(token))

    return TranzContextNode(
        parameters.get('prefix', None),
        parameters.get('domain', None),
        parameters.get('locale', None)
    )
809539
def parse_mailcap_nametemplate(tmplate='%s'):
    """"""
    nt_list = tmplate.split('%s')
    template_prefix = ''
    template_suffix = ''
    if len(nt_list) == 2:
        template_suffix = nt_list[1]
        template_prefix = nt_list[0]
    else:
        template_suffix = tmplate
    return (template_prefix, template_suffix)
1153359
private LayoutElement parseElement(Element node, LayoutElement parent) {
        LayoutElement layoutElement = newLayoutElement(node, parent, null);
        parseChildren(node, layoutElement, Tag.ELEMENT, Tag.TRIGGER);
        return layoutElement;
    }
465221
def parse_tag(template, l_del, r_del):
    """"""
    global _CURRENT_LINE
    global _LAST_TAG_LINE

    tag_types = {
        '!': 'comment',
        '#': 'section',
        '^': 'inverted section',
        '/': 'end',
        '>': 'partial',
        '=': 'set delimiter?',
        '{': 'no escape?',
        '&': 'no escape'
    }

    # Get the tag
    try:
        tag, template = template.split(r_del, 1)
    except ValueError:
        raise ChevronError('unclosed tag '
                           'at line {0}'.format(_CURRENT_LINE))

    # Find the type meaning of the first character
    tag_type = tag_types.get(tag[0], 'variable')

    # If the type is not a variable
    if tag_type != 'variable':
        # Then that first character is not needed
        tag = tag[1:]

    # If we might be a set delimiter tag
    if tag_type == 'set delimiter?':
        # Double check to make sure we are
        if tag.endswith('='):
            tag_type = 'set delimiter'
            # Remove the equal sign
            tag = tag[:-1]

        # Otherwise we should complain
        else:
            raise ChevronError('unclosed set delimiter tag\n'
                               'at line {0}'.format(_CURRENT_LINE))

    # If we might be a no html escape tag
    elif tag_type == 'no escape?':
        # And we have a third curly brace
        # (And are using curly braces as delimiters)
        if l_del == '{{' and r_del == '}}' and template.startswith('}'):
            # Then we are a no html escape tag
            template = template[1:]
            tag_type = 'no escape'

    # Strip the whitespace off the key and return
    return ((tag_type, tag.strip()), template)
287591
def _handle_tag_text(self, text):
        """"""
        next = self._read(1)
        if not self._can_recurse() or text not in self.MARKERS:
            self._emit_text(text)
        elif text == next == "{":
            self._parse_template_or_argument()
        elif text == next == "[":
            self._parse_wikilink()
        elif text == "<":
            self._parse_tag()
        else:
            self._emit_text(text)
352864
def do_markdownlaceholder(parser, token):
    
    name, params = parse_placeholder(parser, token)
    return MarkdownPlaceholderNode(name, **params)