Beispiel #1
0
static int
pre_lk(DECL_ARGS)
{
	const struct roff_node *link, *descr;

	if (NULL == (link = n->child))
		return 0;

	if (NULL != (descr = link->next)) {
		font_push('I');
		while (NULL != descr) {
			print_word(descr->string);
			descr = descr->next;
		}
		print_word(":");
		font_pop();
	}

	font_push('B');
	print_word(link->string);
	font_pop();
	return 0;
}
Beispiel #2
0
static int
pre_lk(DECL_ARGS)
{
	const struct roff_node *link, *descr, *punct;

	if ((link = n->child) == NULL)
		return 0;

	/* Find beginning of trailing punctuation. */
	punct = n->last;
	while (punct != link && punct->flags & NODE_DELIMC)
		punct = punct->prev;
	punct = punct->next;

	/* Link text. */
	if ((descr = link->next) != NULL && descr != punct) {
		font_push('I');
		while (descr != punct) {
			print_word(descr->string);
			descr = descr->next;
		}
		font_pop();
		print_word(":");
	}

	/* Link target. */
	font_push('B');
	print_word(link->string);
	font_pop();

	/* Trailing punctuation. */
	while (punct != NULL) {
		print_word(punct->string);
		punct = punct->next;
	}
	return 0;
}
Beispiel #3
0
static void
post_fo(DECL_ARGS)
{

	switch (n->type) {
	case MDOC_HEAD:
		font_pop();
		break;
	case MDOC_BODY:
		post_fn(meta, n);
		break;
	default:
		break;
	}
}
Beispiel #4
0
static void
post_percent(DECL_ARGS)
{

	if (pre_em == manacts[n->tok].pre)
		font_pop();
	if (n->next) {
		print_word(",");
		if (n->prev &&	n->prev->tok == n->tok &&
				n->next->tok == n->tok)
			print_word("and");
	} else {
		print_word(".");
		outflags |= MMAN_nl;
	}
}
Beispiel #5
0
static void
post_fo(DECL_ARGS)
{

	switch (n->type) {
	case ROFFT_HEAD:
		if (n->child != NULL)
			font_pop();
		break;
	case ROFFT_BODY:
		post_fn(meta, n);
		break;
	default:
		break;
	}
}
Beispiel #6
0
static void
post_percent(DECL_ARGS)
{

	if (mdoc_man_act(n->tok)->pre == pre_em)
		font_pop();
	if (n->next) {
		print_word(",");
		if (n->prev &&	n->prev->tok == n->tok &&
				n->next->tok == n->tok)
			print_word("and");
	} else {
		print_word(".");
		outflags |= MMAN_nl;
	}
}
Beispiel #7
0
static void
post_nm(DECL_ARGS)
{
	switch (n->type) {
	case ROFFT_BLOCK:
		outflags &= ~MMAN_Bk;
		break;
	case ROFFT_HEAD:
	case ROFFT_ELEM:
		if (n->child != NULL && n->child->string != NULL)
			font_pop();
		break;
	default:
		break;
	}
}
Beispiel #8
0
static void
post_nm(DECL_ARGS)
{

	switch (n->type) {
	case MDOC_BLOCK:
		outflags &= ~MMAN_Bk;
		break;
	case MDOC_HEAD:
		/* FALLTHROUGH */
	case MDOC_ELEM:
		if (n->child != NULL || meta->name != NULL)
			font_pop();
		break;
	default:
		break;
	}
}
Beispiel #9
0
static int
pre_fa(DECL_ARGS)
{
	int	 am_Fa;

	am_Fa = MDOC_Fa == n->tok;

	if (am_Fa)
		n = n->child;

	while (NULL != n) {
		font_push('I');
		if (am_Fa || NODE_SYNPRETTY & n->flags)
			outflags |= MMAN_nbrword;
		print_node(meta, n);
		font_pop();
		if (NULL != (n = n->next))
			print_word(",");
	}
	return 0;
}
Beispiel #10
0
static void
post_font(DECL_ARGS)
{

	font_pop();
}
Beispiel #11
0
static int
pre_it(DECL_ARGS)
{
	const struct roff_node *bln;

	switch (n->type) {
	case ROFFT_HEAD:
		outflags |= MMAN_PP | MMAN_nl;
		bln = n->parent->parent;
		if (0 == bln->norm->Bl.comp ||
		    (NULL == n->parent->prev &&
		     NULL == bln->parent->prev))
			outflags |= MMAN_sp;
		outflags &= ~MMAN_br;
		switch (bln->norm->Bl.type) {
		case LIST_item:
			return 0;
		case LIST_inset:
		case LIST_diag:
		case LIST_ohang:
			if (bln->norm->Bl.type == LIST_diag)
				print_line(".B \"", 0);
			else
				print_line(".BR \\& \"", 0);
			outflags &= ~MMAN_spc;
			return 1;
		case LIST_bullet:
		case LIST_dash:
		case LIST_hyphen:
			print_width(&bln->norm->Bl, NULL);
			TPremain = 0;
			outflags |= MMAN_nl;
			font_push('B');
			if (LIST_bullet == bln->norm->Bl.type)
				print_word("\\(bu");
			else
				print_word("-");
			font_pop();
			outflags |= MMAN_nl;
			return 0;
		case LIST_enum:
			print_width(&bln->norm->Bl, NULL);
			TPremain = 0;
			outflags |= MMAN_nl;
			print_count(&bln->norm->Bl.count);
			outflags |= MMAN_nl;
			return 0;
		case LIST_hang:
			print_width(&bln->norm->Bl, n->child);
			TPremain = 0;
			outflags |= MMAN_nl;
			return 1;
		case LIST_tag:
			print_width(&bln->norm->Bl, n->child);
			putchar('\n');
			outflags &= ~MMAN_spc;
			return 1;
		default:
			return 1;
		}
	default:
		break;
	}
	return 1;
}
Beispiel #12
0
static int
pre_it(DECL_ARGS)
{
	const struct mdoc_node *bln;

	switch (n->type) {
	case MDOC_HEAD:
		outflags |= MMAN_PP | MMAN_nl;
		bln = n->parent->parent;
		if (0 == bln->norm->Bl.comp ||
		    (NULL == n->parent->prev &&
		     NULL == bln->parent->prev))
			outflags |= MMAN_sp;
		outflags &= ~MMAN_br;
		switch (bln->norm->Bl.type) {
		case LIST_item:
			return(0);
		case LIST_inset:
			/* FALLTHROUGH */
		case LIST_diag:
			/* FALLTHROUGH */
		case LIST_ohang:
			if (bln->norm->Bl.type == LIST_diag)
				print_line(".B \"", 0);
			else
				print_line(".R \"", 0);
			outflags &= ~MMAN_spc;
			return(1);
		case LIST_bullet:
			/* FALLTHROUGH */
		case LIST_dash:
			/* FALLTHROUGH */
		case LIST_hyphen:
			print_width(bln->norm->Bl.width, NULL, 0);
			TPremain = 0;
			outflags |= MMAN_nl;
			font_push('B');
			if (LIST_bullet == bln->norm->Bl.type)
				print_word("o");
			else
				print_word("-");
			font_pop();
			outflags |= MMAN_nl;
			return(0);
		case LIST_enum:
			print_width(bln->norm->Bl.width, NULL, 0);
			TPremain = 0;
			outflags |= MMAN_nl;
			print_count(&bln->norm->Bl.count);
			outflags |= MMAN_nl;
			return(0);
		case LIST_hang:
			print_width(bln->norm->Bl.width, n->child, 6);
			TPremain = 0;
			outflags |= MMAN_nl;
			return(1);
		case LIST_tag:
			print_width(bln->norm->Bl.width, n->child, 0);
			putchar('\n');
			outflags &= ~MMAN_spc;
			return(1);
		default:
			return(1);
		}
	default:
		break;
	}
	return(1);
}