omd2tex.objects.list module#

class omd2tex.objects.list.List(text: str, depth: int, number: int = 0, complete: bool = False, reference=None)[source]#

Bases: BaseClass

to_latex_item() str[source]#

Render a single list item to LaTeX.

Returns:

LaTeX string representing the list item content.

to_latex() str[source]#

Render the list and merged nested items to LaTeX.

Returns:

LaTeX string for the list content, including merged sublists when present.

append(item: List) None[source]#

Append another list item at the same depth.

Parameters:

item – List item to append; must match depth.

Returns:

None

Raises:

TypeError – If item type or depth is incompatible.

static append_items(items: list) list[source]#

Group consecutive list items of equal depth.

Parameters:

items – Sequence of parsed elements possibly containing List instances.

Returns:

List with grouped List items aggregated by depth.

merge(item: List) None[source]#

Merge a deeper nested item under the current list element.

Parameters:

item – Nested List item.

Returns:

None

Raises:

TypeError – If provided item is not deeper than the current one.

static merge_items(items: list) list[source]#

Merge subsequent deeper list items into preceding parents.

Parameters:

items – Sequence of elements containing List instances.

Returns:

List where nested items are attached to their appropriate parents.

static indent(text: str, depth: int) str[source]#

Indent text by a multiple of four spaces based on depth.

Parameters:
  • text – String to indent.

  • depth – Nesting level to determine indentation.

Returns:

Indented text string.

class omd2tex.objects.list.Enumerate(text: str, depth: int, number: int = 0, complete: bool = False, reference=None)[source]#

Bases: List

to_latex_item() str[source]#

Render an enumerated item with adjusted counter.

to_latex() str[source]#

Render an enumerate environment with optional keep-with-next fix.

class omd2tex.objects.list.Check(text: str, depth: int, number: int = 0, complete: bool = False, reference=None)[source]#

Bases: List

to_latex_item() str[source]#

Render a checklist item using box symbols.

to_latex() str[source]#

Render a checklist as an itemize environment.

class omd2tex.objects.list.Bullet(text: str, depth: int, number: int = 0, complete: bool = False, reference=None)[source]#

Bases: List

to_latex_item() str[source]#

Render a bullet list item.

to_latex() str[source]#

Render a bullet list environment.