Пример #1
0
/* ARGSUSED */
static void
man_root_post(MAN_ARGS)
{
	struct htmlpair	 tag[3];
	struct tag	*t, *tt;

	PAIR_SUMMARY_INIT(&tag[0], "Document Footer");
	PAIR_CLASS_INIT(&tag[1], "foot");
	PAIR_INIT(&tag[2], ATTR_WIDTH, "100%");
	t = print_otag(h, TAG_TABLE, 3, tag);
	PAIR_INIT(&tag[0], ATTR_WIDTH, "50%");
	print_otag(h, TAG_COL, 1, tag);
	print_otag(h, TAG_COL, 1, tag);

	tt = print_otag(h, TAG_TR, 0, NULL);

	PAIR_CLASS_INIT(&tag[0], "foot-date");
	print_otag(h, TAG_TD, 1, tag);

	assert(man->date);
	print_text(h, man->date);
	print_stagq(h, tt);

	PAIR_CLASS_INIT(&tag[0], "foot-os");
	PAIR_INIT(&tag[1], ATTR_ALIGN, "right");
	print_otag(h, TAG_TD, 2, tag);

	if (man->source)
		print_text(h, man->source);
	print_tagq(h, t);
}
Пример #2
0
/* ARGSUSED */
static int
mdoc_root_pre(MDOC_ARGS)
{
	struct htmlpair	 tag[3];
	struct tag	*t, *tt;
	char		 b[BUFSIZ], title[BUFSIZ];

	strlcpy(b, m->vol, BUFSIZ);

	if (m->arch) {
		strlcat(b, " (", BUFSIZ);
		strlcat(b, m->arch, BUFSIZ);
		strlcat(b, ")", BUFSIZ);
	}

	snprintf(title, BUFSIZ - 1, "%s(%s)", m->title, m->msec);

	PAIR_SUMMARY_INIT(&tag[0], "Document Header");
	PAIR_CLASS_INIT(&tag[1], "head");
	if (NULL == h->style) {
		PAIR_INIT(&tag[2], ATTR_WIDTH, "100%");
		t = print_otag(h, TAG_TABLE, 3, tag);
		PAIR_INIT(&tag[0], ATTR_WIDTH, "30%");
		print_otag(h, TAG_COL, 1, tag);
		print_otag(h, TAG_COL, 1, tag);
		print_otag(h, TAG_COL, 1, tag);
	} else
		t = print_otag(h, TAG_TABLE, 2, tag);

	print_otag(h, TAG_TBODY, 0, NULL);

	tt = print_otag(h, TAG_TR, 0, NULL);

	PAIR_CLASS_INIT(&tag[0], "head-ltitle");
	print_otag(h, TAG_TD, 1, tag);

	print_text(h, title);
	print_stagq(h, tt);

	PAIR_CLASS_INIT(&tag[0], "head-vol");
	if (NULL == h->style) {
		PAIR_INIT(&tag[1], ATTR_ALIGN, "center");
		print_otag(h, TAG_TD, 2, tag);
	} else 
		print_otag(h, TAG_TD, 1, tag);

	print_text(h, b);
	print_stagq(h, tt);

	PAIR_CLASS_INIT(&tag[0], "head-rtitle");
	if (NULL == h->style) {
		PAIR_INIT(&tag[1], ATTR_ALIGN, "right");
		print_otag(h, TAG_TD, 2, tag);
	} else 
		print_otag(h, TAG_TD, 1, tag);

	print_text(h, title);
	print_tagq(h, t);
	return(1);
}
Пример #3
0
/* ARGSUSED */
static void
man_root_pre(MAN_ARGS)
{
	struct htmlpair	 tag[3];
	struct tag	*t, *tt;
	char		 b[BUFSIZ], title[BUFSIZ];

	b[0] = 0;
	if (man->vol)
		(void)strlcat(b, man->vol, BUFSIZ);

	assert(man->title);
	assert(man->msec);
	snprintf(title, BUFSIZ - 1, "%s(%s)", man->title, man->msec);

	PAIR_SUMMARY_INIT(&tag[0], "Document Header");
	PAIR_CLASS_INIT(&tag[1], "head");
	PAIR_INIT(&tag[2], ATTR_WIDTH, "100%");
	t = print_otag(h, TAG_TABLE, 3, tag);
	PAIR_INIT(&tag[0], ATTR_WIDTH, "30%");
	print_otag(h, TAG_COL, 1, tag);
	print_otag(h, TAG_COL, 1, tag);
	print_otag(h, TAG_COL, 1, tag);

	print_otag(h, TAG_TBODY, 0, NULL);

	tt = print_otag(h, TAG_TR, 0, NULL);

	PAIR_CLASS_INIT(&tag[0], "head-ltitle");
	print_otag(h, TAG_TD, 1, tag);
	print_text(h, title);
	print_stagq(h, tt);

	PAIR_CLASS_INIT(&tag[0], "head-vol");
	PAIR_INIT(&tag[1], ATTR_ALIGN, "center");
	print_otag(h, TAG_TD, 2, tag);
	print_text(h, b);
	print_stagq(h, tt);

	PAIR_CLASS_INIT(&tag[0], "head-rtitle");
	PAIR_INIT(&tag[1], ATTR_ALIGN, "right");
	print_otag(h, TAG_TD, 2, tag);
	print_text(h, title);
	print_tagq(h, t);
}
Пример #4
0
void
print_tbl(struct html *h, const struct tbl_span *sp)
{
	const struct tbl_head *hp;
	const struct tbl_dat *dp;
	struct htmlpair	 tag;
	struct tag	*tt;

	/* Inhibit printing of spaces: we do padding ourselves. */

	if (NULL == h->tblt)
		html_tblopen(h, sp);

	assert(h->tblt);

	h->flags |= HTML_NONOSPACE;
	h->flags |= HTML_NOSPACE;

	tt = print_otag(h, TAG_TR, 0, NULL);

	switch (sp->pos) {
	case (TBL_SPAN_HORIZ):
		/* FALLTHROUGH */
	case (TBL_SPAN_DHORIZ):
		PAIR_INIT(&tag, ATTR_COLSPAN, "0");
		print_otag(h, TAG_TD, 1, &tag);
		break;
	default:
		dp = sp->first;
		for (hp = sp->head; hp; hp = hp->next) {
			print_stagq(h, tt);
			print_otag(h, TAG_TD, 0, NULL);

			if (NULL == dp)
				break;
			if (TBL_CELL_DOWN != dp->layout->pos)
				if (dp->string)
					print_text(h, dp->string);
			dp = dp->next;
		}
		break;
	}

	print_tagq(h, tt);

	h->flags &= ~HTML_NONOSPACE;

	if (TBL_SPAN_LAST & sp->flags) {
		assert(h->tbl.cols);
		free(h->tbl.cols);
		h->tbl.cols = NULL;
		print_tblclose(h);
	}

}
Пример #5
0
void
print_tbl(struct html *h, const struct tbl_span *sp)
{
	const struct tbl_dat *dp;
	struct htmlpair	 tag;
	struct tag	*tt;
	int		 ic;

	/* Inhibit printing of spaces: we do padding ourselves. */

	if (h->tblt == NULL)
		html_tblopen(h, sp);

	assert(h->tblt);

	h->flags |= HTML_NONOSPACE;
	h->flags |= HTML_NOSPACE;

	tt = print_otag(h, TAG_TR, 0, NULL);

	switch (sp->pos) {
	case TBL_SPAN_HORIZ:
	case TBL_SPAN_DHORIZ:
		PAIR_INIT(&tag, ATTR_COLSPAN, "0");
		print_otag(h, TAG_TD, 1, &tag);
		break;
	default:
		dp = sp->first;
		for (ic = 0; ic < sp->opts->cols; ic++) {
			print_stagq(h, tt);
			print_otag(h, TAG_TD, 0, NULL);

			if (dp == NULL || dp->layout->col > ic)
				continue;
			if (dp->layout->pos != TBL_CELL_DOWN)
				if (dp->string != NULL)
					print_text(h, dp->string);
			dp = dp->next;
		}
		break;
	}

	print_tagq(h, tt);

	h->flags &= ~HTML_NONOSPACE;

	if (sp->next == NULL) {
		assert(h->tbl.cols);
		free(h->tbl.cols);
		h->tbl.cols = NULL;
		print_tblclose(h);
	}

}
Пример #6
0
/* ARGSUSED */
static void
mdoc_root_post(MDOC_ARGS)
{
	struct htmlpair	 tag[3];
	struct tag	*t, *tt;

	PAIR_SUMMARY_INIT(&tag[0], "Document Footer");
	PAIR_CLASS_INIT(&tag[1], "foot");
	if (NULL == h->style) {
		PAIR_INIT(&tag[2], ATTR_WIDTH, "100%");
		t = print_otag(h, TAG_TABLE, 3, tag);
		PAIR_INIT(&tag[0], ATTR_WIDTH, "50%");
		print_otag(h, TAG_COL, 1, tag);
		print_otag(h, TAG_COL, 1, tag);
	} else
		t = print_otag(h, TAG_TABLE, 2, tag);

	t = print_otag(h, TAG_TBODY, 0, NULL);

	tt = print_otag(h, TAG_TR, 0, NULL);

	PAIR_CLASS_INIT(&tag[0], "foot-date");
	print_otag(h, TAG_TD, 1, tag);

	print_text(h, m->date);
	print_stagq(h, tt);

	PAIR_CLASS_INIT(&tag[0], "foot-os");
	if (NULL == h->style) {
		PAIR_INIT(&tag[1], ATTR_ALIGN, "right");
		print_otag(h, TAG_TD, 2, tag);
	} else 
		print_otag(h, TAG_TD, 1, tag);

	print_text(h, m->os);
	print_tagq(h, t);
}
Пример #7
0
static void
eqn_box(struct html *p, const struct eqn_box *bp)
{
	struct tag	*post, *row, *cell, *t;
	struct htmlpair	 tag[2];
	const struct eqn_box *child, *parent;
	size_t		 i, j, rows;

	if (NULL == bp)
		return;

	post = NULL;

	/*
	 * Special handling for a matrix, which is presented to us in
	 * column order, but must be printed in row-order.
	 */
	if (EQN_MATRIX == bp->type) {
		if (NULL == bp->first)
			goto out;
		if (EQN_LIST != bp->first->type) {
			eqn_box(p, bp->first);
			goto out;
		}
		if (NULL == (parent = bp->first->first))
			goto out;
		/* Estimate the number of rows, first. */
		if (NULL == (child = parent->first))
			goto out;
		for (rows = 0; NULL != child; rows++)
			child = child->next;
		/* Print row-by-row. */
		post = print_otag(p, TAG_MTABLE, 0, NULL);
		for (i = 0; i < rows; i++) {
			parent = bp->first->first;
			row = print_otag(p, TAG_MTR, 0, NULL);
			while (NULL != parent) {
				child = parent->first;
				for (j = 0; j < i; j++) {
					if (NULL == child)
						break;
					child = child->next;
				}
				cell = print_otag
					(p, TAG_MTD, 0, NULL);
				/*
				 * If we have no data for this
				 * particular cell, then print a
				 * placeholder and continue--don't puke.
				 */
				if (NULL != child)
					eqn_box(p, child->first);
				print_tagq(p, cell);
				parent = parent->next;
			}
			print_tagq(p, row);
		}
		goto out;
	}

	switch (bp->pos) {
	case (EQNPOS_TO):
		post = print_otag(p, TAG_MOVER, 0, NULL);
		break;
	case (EQNPOS_SUP):
		post = print_otag(p, TAG_MSUP, 0, NULL);
		break;
	case (EQNPOS_FROM):
		post = print_otag(p, TAG_MUNDER, 0, NULL);
		break;
	case (EQNPOS_SUB):
		post = print_otag(p, TAG_MSUB, 0, NULL);
		break;
	case (EQNPOS_OVER):
		post = print_otag(p, TAG_MFRAC, 0, NULL);
		break;
	case (EQNPOS_FROMTO):
		post = print_otag(p, TAG_MUNDEROVER, 0, NULL);
		break;
	case (EQNPOS_SUBSUP):
		post = print_otag(p, TAG_MSUBSUP, 0, NULL);
		break;
	case (EQNPOS_SQRT):
		post = print_otag(p, TAG_MSQRT, 0, NULL);
		break;
	default:
		break;
	}

	if (bp->top || bp->bottom) {
		assert(NULL == post);
		if (bp->top && NULL == bp->bottom)
			post = print_otag(p, TAG_MOVER, 0, NULL);
		else if (bp->top && bp->bottom)
			post = print_otag(p, TAG_MUNDEROVER, 0, NULL);
		else if (bp->bottom)
			post = print_otag(p, TAG_MUNDER, 0, NULL);
	}

	if (EQN_PILE == bp->type) {
		assert(NULL == post);
		if (bp->first != NULL && bp->first->type == EQN_LIST)
			post = print_otag(p, TAG_MTABLE, 0, NULL);
	} else if (bp->type == EQN_LIST &&
	    bp->parent && bp->parent->type == EQN_PILE) {
		assert(NULL == post);
		post = print_otag(p, TAG_MTR, 0, NULL);
		print_otag(p, TAG_MTD, 0, NULL);
	}

	if (NULL != bp->text) {
		assert(NULL == post);
		post = print_otag(p, TAG_MI, 0, NULL);
		print_text(p, bp->text);
	} else if (NULL == post) {
		if (NULL != bp->left || NULL != bp->right) {
			PAIR_INIT(&tag[0], ATTR_OPEN,
			    NULL == bp->left ? "" : bp->left);
			PAIR_INIT(&tag[1], ATTR_CLOSE,
			    NULL == bp->right ? "" : bp->right);
			post = print_otag(p, TAG_MFENCED, 2, tag);
		}
		if (NULL == post)
			post = print_otag(p, TAG_MROW, 0, NULL);
		else
			print_otag(p, TAG_MROW, 0, NULL);
	}

	eqn_box(p, bp->first);

out:
	if (NULL != bp->bottom) {
		t = print_otag(p, TAG_MO, 0, NULL);
		print_text(p, bp->bottom);
		print_tagq(p, t);
	}
	if (NULL != bp->top) {
		t = print_otag(p, TAG_MO, 0, NULL);
		print_text(p, bp->top);
		print_tagq(p, t);
	}

	if (NULL != post)
		print_tagq(p, post);

	eqn_box(p, bp->next);
}
Пример #8
0
/* ARGSUSED */
static int
mdoc_bl_pre(MDOC_ARGS)
{
	int		 i;
	struct htmlpair	 tag[3];
	struct roffsu	 su;
	char		 buf[BUFSIZ];

	if (MDOC_BODY == n->type) {
		if (LIST_column == n->norm->Bl.type)
			print_otag(h, TAG_TBODY, 0, NULL);
		return(1);
	}

	if (MDOC_HEAD == n->type) {
		if (LIST_column != n->norm->Bl.type)
			return(0);

		/*
		 * For each column, print out the <COL> tag with our
		 * suggested width.  The last column gets min-width, as
		 * in terminal mode it auto-sizes to the width of the
		 * screen and we want to preserve that behaviour.
		 */

		for (i = 0; i < (int)n->norm->Bl.ncols; i++) {
			a2width(n->norm->Bl.cols[i], &su);
			bufinit(h);
			if (i < (int)n->norm->Bl.ncols - 1)
				bufcat_su(h, "width", &su);
			else
				bufcat_su(h, "min-width", &su);
			PAIR_STYLE_INIT(&tag[0], h);
			print_otag(h, TAG_COL, 1, tag);
		}

		return(0);
	}

	SCALE_VS_INIT(&su, 0);
	bufcat_su(h, "margin-top", &su);
	bufcat_su(h, "margin-bottom", &su);
	PAIR_STYLE_INIT(&tag[0], h);

	assert(lists[n->norm->Bl.type]);
	strlcpy(buf, "list ", BUFSIZ);
	strlcat(buf, lists[n->norm->Bl.type], BUFSIZ);
	PAIR_INIT(&tag[1], ATTR_CLASS, buf);

	/* Set the block's left-hand margin. */

	if (n->norm->Bl.offs) {
		a2offs(n->norm->Bl.offs, &su);
		bufcat_su(h, "margin-left", &su);
	}

	switch (n->norm->Bl.type) {
	case(LIST_bullet):
		/* FALLTHROUGH */
	case(LIST_dash):
		/* FALLTHROUGH */
	case(LIST_hyphen):
		/* FALLTHROUGH */
	case(LIST_item):
		print_otag(h, TAG_UL, 2, tag);
		break;
	case(LIST_enum):
		print_otag(h, TAG_OL, 2, tag);
		break;
	case(LIST_diag):
		/* FALLTHROUGH */
	case(LIST_hang):
		/* FALLTHROUGH */
	case(LIST_inset):
		/* FALLTHROUGH */
	case(LIST_ohang):
		/* FALLTHROUGH */
	case(LIST_tag):
		print_otag(h, TAG_DL, 2, tag);
		break;
	case(LIST_column):
		print_otag(h, TAG_TABLE, 2, tag);
		break;
	default:
		abort();
		/* NOTREACHED */
	}

	return(1);
}
Пример #9
0
short int php_tmpl_pre_parse(t_template* tmpl) {
ulong_pair		*point;
register uchar	*p;

uchar			*buf;
uint			buf_len, buf_alloc, buf_this;

uint			i, j, len, close_idx;
t_tmpl_tag		*tag, *context;
zval			**ztag;

	if(FAILURE == php_tmpl_pre_parse_config(tmpl)) return FAILURE;

	/* Initialize variables */
	PAIR_INIT(point);
	buf_alloc = TMPL_MAX_TAG_LEN+4;
	buf = (uchar*)emalloc(buf_alloc);
	/* Searching algorythm will require larger buffer */
	(char*)ZV(tmpl->original) = erealloc(ZV(tmpl->original), 
		ZL(tmpl->original) + MAX(
			ZL(tmpl->tag_left), MAX(
				ZL(tmpl->tag_right), MAX(
					ZL(tmpl->ctx_ol), MAX(
						ZL(tmpl->ctx_or), MAX(
							ZL(tmpl->ctx_cl), ZL(tmpl->ctx_cr)
						)
					)
				)
			)
		)
	);

	/* Obtain positions of all tags and contexts */
	php_tmpl_pre_parse_search(tmpl, &point, TMPL_TAG, ZV(tmpl->tag_left), ZL(tmpl->tag_left));
	php_tmpl_pre_parse_search(tmpl, &point, TMPL_TAG_END, ZV(tmpl->tag_right), ZL(tmpl->tag_right));
	php_tmpl_pre_parse_search(tmpl, &point, TMPL_CONTEXT_OPEN_LEFT, ZV(tmpl->ctx_ol), ZL(tmpl->ctx_ol));
	php_tmpl_pre_parse_search(tmpl, &point, TMPL_CONTEXT_OPEN_RIGHT, ZV(tmpl->ctx_or), ZL(tmpl->ctx_or));
	php_tmpl_pre_parse_search(tmpl, &point, TMPL_CONTEXT_CLOSE_LEFT, ZV(tmpl->ctx_cl), ZL(tmpl->ctx_cl));
	if(ZL(tmpl->ctx_cr)) php_tmpl_pre_parse_search(tmpl, &point, TMPL_CONTEXT_CLOSE_RIGHT, ZV(tmpl->ctx_cr), ZL(tmpl->ctx_cr));

	if(0 == point[0].r) { TMPL_PRE_PARSE_CLEANUP; return SUCCESS; }

	qsort(&point[1], point[0].r, sizeof(ulong_pair), ULONG_PAIR_COMPARE);

	strcpy(buf, "/"); buf_len = buf_this = 1;

	/* Add root context */
	TAG_INIT(tag);
 	tag->loff = 0;
	tag->roff = ZL(tmpl->original); 
	tag->typ = TMPL_CONTEXT;
	ZVAL_STRINGL(tag->name, "/", 1, 1);
	add_assoc_stringl(tmpl->tags, buf, (char*)tag, sizeof(t_tmpl_tag), 0);
	context = tag;
	context->size = ZL(tmpl->original);

	/* Pre parse template */
	for(i=1; i <= point[0].r; i++) {
		switch(point[i].r) {
		case TMPL_TAG:
			p = ZV(tmpl->original) + point[i].l + ZL(tmpl->tag_left);

			TMPL_PRE_PARSE_GET_LEN(TMPL_TAG_END, ZL(tmpl->tag_left));

			if(buf_alloc < buf_len+len+1) {
				while(buf_alloc < buf_len+len+1) buf_alloc += TMPL_MAX_TAG_LEN;
				buf = (char*)erealloc(buf, buf_alloc);
			}
			if(buf_len > 1) buf[buf_len++] = '/';
			for(j=0; j < len; j++) buf[buf_len++] = tolower(*(p-len+j));
			buf[buf_len] = 0;

			TAG_INIT(tag);
			tag->loff = point[i].l;
			tag->roff = point[close_idx].l + ZL(tmpl->tag_right);
			tag->size = (tag->roff - tag->loff);
			tag->typ = TMPL_TAG;
			tag->tag_num = 1;
			tag->ctx = context;
			ZVAL_STRINGL(tag->name, buf+buf_len-len, len, 1);

			if(FAILURE == zend_hash_find(Z_ARRVAL_P(tmpl->tags), buf, buf_len+1, (void*)&ztag)) {
				/* There's no the tag defined in the current context. Creating one */
				add_assoc_stringl(tmpl->tags, buf, (char*)tag, sizeof(t_tmpl_tag), 0);
				context->tag_num++;
			} else {	/* add another instance of the tag in the same context */
				(Z_TMPL_TAG(ztag)->tag_num)++;
				add_next_index_stringl(tmpl->dup_tag, (char*)tag, sizeof(t_tmpl_tag), 0);
			}
			context->size -= tag->size;

			while(buf_len > 1 && buf[buf_len-1] != '/') buf[--buf_len] = 0;
			if(buf_len > 1) buf[--buf_len] = 0;

			i = close_idx;
			break;

		case TMPL_CONTEXT_OPEN_LEFT:
			p = ZV(tmpl->original) + point[i].l + ZL(tmpl->ctx_ol);

			TMPL_PRE_PARSE_GET_LEN(TMPL_CONTEXT_OPEN_RIGHT, ZL(tmpl->ctx_ol));

			if(buf_alloc < buf_len+len+1) {
				while(buf_alloc < buf_len+len+1) buf_alloc += TMPL_MAX_TAG_LEN;
				buf = (char*)erealloc(buf, buf_alloc);
			}
			if(buf_len > 1) buf[buf_len++] = '/';
			buf_this = buf_len;
			for(j=0; j < len; j++) buf[buf_len++] = tolower(*(p-len+j));
			buf[buf_len] = 0;

			if(SUCCESS == zend_hash_find(Z_ARRVAL_P(tmpl->tags), buf, buf_len+1, (void*)&ztag)) {
				php_error(E_ERROR, "Duplicate context \"%s\" in template (line: %d)", buf, php_tmpl_line_num(tmpl, p));
				TMPL_PRE_PARSE_CLEANUP;
				return FAILURE;
			}

			TAG_INIT(tag);
			tag->loff = point[i].l;
			tag->typ = TMPL_CONTEXT;
			tag->ctx = context;
			ZVAL_STRINGL(tag->name, buf+buf_len-len, len, 1);
			add_assoc_stringl(tmpl->tags, buf, (char*)tag, sizeof(t_tmpl_tag), 0);
			context->tag_num++;
			context = tag;

			i = close_idx;
			break;

		case TMPL_CONTEXT_CLOSE_LEFT:
			p = ZV(tmpl->original) + point[i].l + ZL(tmpl->ctx_cl);

			if(ZL(tmpl->ctx_cr)) {
	
				TMPL_PRE_PARSE_GET_LEN(TMPL_CONTEXT_CLOSE_RIGHT, ZL(tmpl->ctx_cl));

				for(j=0; j < len; j++)
					if(buf[buf_this+j] != tolower(*(p-len+j))) break;
				if(j < len) continue;

			}

			tag = context;
			tag->roff = ZL(tmpl->ctx_cr) ? point[close_idx].l + ZL(tmpl->ctx_cr) : point[i].l + ZL(tmpl->ctx_cl);
			tag->size += (tag->roff - tag->loff);

			while(buf_len > 1 && buf[buf_len-1] != '/') buf[--buf_len] = 0;
			if(buf_len > 1) buf[--buf_len] = 0;
			buf_this = buf_len;
			while(buf_this > 1 && buf[buf_this-1] != '/') --buf_this;
			if(FAILURE == zend_hash_find(Z_ARRVAL_P(tmpl->tags), buf, buf_len+1, (void*)&ztag)) {
				php_error(E_ERROR, "Can't find parent context in template. You should not see this message");
				TMPL_PRE_PARSE_CLEANUP;
				return FAILURE;
			}
			context = (t_tmpl_tag*)Z_STRVAL_PP(ztag);
			context->size -= tag->size;

			if(ZL(tmpl->ctx_cr)) i = close_idx;
			break;
		}
	}
	if(buf_len != 1) {
		php_error(E_ERROR, "Can't continue with an unterminated context \"%s\" in template (line:%d)", buf, php_tmpl_line_num(tmpl, ZV(tmpl->original) + context->loff));
		TMPL_PRE_PARSE_CLEANUP;
		return FAILURE;
	}
	tmpl->size = context->size;

	TMPL_PRE_PARSE_CLEANUP;
	return SUCCESS;
}