Пример #1
0
/* ARGSUSED */
static int
pre_sp(DECL_ARGS)
{
	size_t		 i, len;

	if ((NULL == n->prev && n->parent)) {
		if (MAN_SS == n->parent->tok)
			return(0);
		if (MAN_SH == n->parent->tok)
			return(0);
	}

	switch (n->tok) {
	case (MAN_br):
		len = 0;
		break;
	default:
		len = n->child ? a2height(p, n->child->string) : 1;
		break;
	}

	if (0 == len)
		term_newln(p);
	for (i = 0; i < len; i++)
		term_vspace(p);

	return(0);
}
Пример #2
0
static int
pre_sp(DECL_ARGS)
{
	char		*s;
	size_t		 i, len;
	int		 neg;

	if ((NULL == n->prev && n->parent)) {
		switch (n->parent->tok) {
		case MAN_SH:
			/* FALLTHROUGH */
		case MAN_SS:
			/* FALLTHROUGH */
		case MAN_PP:
			/* FALLTHROUGH */
		case MAN_LP:
			/* FALLTHROUGH */
		case MAN_P:
			/* FALLTHROUGH */
			return(0);
		default:
			break;
		}
	}

	neg = 0;
	switch (n->tok) {
	case MAN_br:
		len = 0;
		break;
	default:
		if (NULL == n->child) {
			len = 1;
			break;
		}
		s = n->child->string;
		if ('-' == *s) {
			neg = 1;
			s++;
		}
		len = a2height(p, s);
		break;
	}

	if (0 == len)
		term_newln(p);
	else if (neg)
		p->skipvsp += len;
	else
		for (i = 0; i < len; i++)
			term_vspace(p);

	return(0);
}
Пример #3
0
/* ARGSUSED */
static int
termp_sp_pre(DECL_ARGS)
{
	size_t		 i, len;

	switch (n->tok) {
	case (MDOC_sp):
		len = n->child ? a2height(p, n->child->string) : 1;
		break;
	case (MDOC_br):
		len = 0;
		break;
	default:
		len = 1;
		break;
	}

	if (0 == len)
		term_newln(p);
	for (i = 0; i < len; i++)
		term_vspace(p);

	return(0);
}