* {
	/* TODO: probably "line" default for everyone in a roff format? */
	display: line;
	&::before, &::after {
		display: word;
	}
}

me {
	content: ".Nm";
}

synopses::before {
	content: ".Sh SYNOPSIS";
	display: line;
}
synopsis::before {
	content: ".Nm";
	display: line;
}

nix {
	display: none;
}
tagline::before {
	content: ".Nd";
}
today {
	content: today(".Dd %B %d, %Y");
}

description::before {
	content: ".Sh DESCRIPTION";
	display: line;
}
para:not(:first-child)::before {
	content: ".Pp";
	display: line;
}

arg {
	&::before {
		content: ".Ar";
	}
	&[optional=true]::before {
		content: ".Op Ar ";
	}
}
furniture::before {
	content: ".No ";
}

literal, literal_arg {
	display: char;
}
literal_arg::before {
	content: ".Cm";
}
part, value > {
	literal_arg::before {
		content: "Cm";
	}
	arg::before {
		content: "Ar";
	}
	shell_var::before {
		content: "$ Ns Ar";
	}
}

shell_var::before {
	content: ".No $ Ns Ar";
}

envvar::before {
	content: ".Ev";
}


arguments {
	argument {
		&::before {
			content: ".It Ar " attr(id);
			display: line;
		}
		purpose {
			&::before {
				content: '.Bl -bullet -compact';
				display: line;
			}
			&::after {
				content: '.El';
				display: line;
			}
			> *::before {
				content: '.It';
				display: line;
			}
		}
	}
	> {
		* > purpose,
		* > purpose > * {
			display: line;
		}
		.options {
			&::before {
				content: ".Fl Fl " attr(id);
			}
			purpose, forms {
				display: none;
			}
		}
		.required {
			api:not(.cli),
			purpose > terse {
				display: none;
			}
		}
		flag {
			&::before {
				content: ".It Fl Fl " attr(id);
			}
		 	> value,
			> value > arg,
			> * > value,
			> * > value > arg {
				display: word;
			}
			value:not(:first-of-type)::before {
				content: "|";
			}
			&.overwrite::before,
			&.meta::before {
				display: line;
			}
		}
	}
}
arguments.envs > {
	argument,
	flag.meta,
	flag > * {
		display: none;
	}
	flag::before {
		content: ".It RESHOLVE_" uppercase(attr(id));
		display: line;
	};
}
argument#script > purpose.terse,
argument#script > value {
	display: none;
}
flag.idk {
	&::before {
		/*
		TODO: the kind of thing that could
		be solved by freedom to specify independent
		left/right boundary types?
		*/
		content: ".It Fl Fl " attr(id) " Eo ' Ns Ar " attr(type) " Ec Ns ' | Pf RESHOLVE_" uppercase(attr(id)) "= Eo ' Ns Ar " attr(type) " Ec Ns '";
		display: line;
	}
	> {
		value {
			display: none;
		}
		purpose {
			/* single slash to keep man from double-spacing */
			content: sentencecase(content()) ". \\";
		}
		forms {
			&::before {
				display: line;
				/*
				TODO: I don't love sticking this in the ~css, but it's
				going to be less frustrating with the template next to
				the call signatures. Unless I create a meta-parser that
				converts some *other* format into inflect executions, it
				should be done here to reduce pain.
				*/
				/*content: inflect(attr(memplate), children()) nl() ".Bl -tag -width 1n";*/
				content: inflect("There plural('is', {0}) {0} directive plural('form', {0}):", children()) nl() ".Bl -tag -width 1n";
			}
			&::after {
				display: line;
				content: ".El";
			}
			> form {
				> *,
				> *::before,
				> *::after,
				part > *,
				part > *::before,
				part > *::after {
					display: word;
				}
				&::before {
					content: ".It";
				}
				> part:nth-child(2)::before {
					content: " : Ns ";
				}
				> note {
					&::before {
						content: "No (Note: ";
					}
					&::after {
						content: ")";
					}
				}
				> part[repeatable=true]::after {
					content: "Ns [; Ns " content() " ] Ns ...";
				}
				> purpose {
					display: line;

					shortform {
						content: ".Ar " slice(content(), 0, 1) " Ns " slice(content(), 1, None) " Ns ";
					}
				}
			}
		}
	}
	example {
		display: char;
		&::before, &::after {
			display: char;
		}
		&::before {
			content: ".It Ex: Fl Fl " attr(flag) " No '";
		}
		&::after {
			/* single slash to keep man from double-spacing */
			content: "'";
		}
	}
}
exits {
	&::before {
		content: '.Bl -tag -width "xx"';
		display: line;
	}
	&::after {
		content: '.El';
		display: line;
	}
	> code::before {
		content: '.It Sy';
		display: word;
	}
}
limitations {
	&::before {
		content: ".Bl -bullet";
		display: line;
	}
	&::after {
		content: ".El";
		display: line;
	}
	> limit::before {
		content: '.It';
		display: line;
	}
}

value > envvar {
	display: char;

	&::before {
		content: "Pf";
		display: word;
	}
}

option::before {
	content: '.Fl Fl';
}

topic {
	content: '.Xr ' content() ' ' attr(man);
	display: line;
}
related > topic:not(:last-of-type)::after {
	content: ' ,';
}
