Skip to main content

set_list

Function set_list 

Source
pub fn set_list(
    content: &mut Element,
    paths: &[Vec<usize>],
    kind: Option<ListKind>,
    styles: &mut Styles,
) -> Result<(), Refused>
Expand description

Make paragraphs items of a list of a kind, or take them out of the list they are in. The paths are of paragraphs, in the order they are drawn in.

With a kind, a paragraph in no list is put in one, side by side with the others that are, so that a run of them is one list and its numbers run on; one already in a list of another kind has its list given this kind’s style; one in a list of this kind is left. Without a kind, each is taken out of its list, and what else its item held, a list nested under it, stands beside it.

A document with no list style of the kind is given one in office:automatic-styles, which if the document has none is written before the body and moves it one place along: a path held from before the edit is to be taken again.

§Errors

A path does not lead to a paragraph, or the content root does not declare a namespace the edit writes in. Each is refused before anything changes.