Paragraph

Paragraphs are defined by their types. They contain text and with every edit they rebuild a list of characters per line used to cut up their text into lines (for display with word wrap).

Design Decisions

The only currently available paragraph types are SCENE, ACTION, NAME, PARENTHETICALS, DIALOG. Transitions are notably missing but as they are frowned upon won’t most likely ever get into Shane (there are probably useful edge cases for transitions but they are few and far between). Shane is supposed to be a simple alternative and will never be bloated up with screenplay elements that are almost definitely never used or actually needed.

Coding Standard Specifics

Paragraph methods that make changes to the paragraph (i.e. are not getters) are to be prefixed with sp_ and called only by the paragraph itself or the Screenplay.

Source Code Docstrings

class shane.paragraph.PPrefs

Enum for paragraph preferences.

static get_enter(ptype: shane.paragraph.PType) → shane.paragraph.PType

Return paragraph type to come after typing enter in a paragraph.

static get_indent(ptype: shane.paragraph.PType) → int

Return indentation of paragraph type.

static get_prec_empty(ptype: shane.paragraph.PType) → int

Return preceding empty lines of paragraph type.

static get_tab(ptype: shane.paragraph.PType) → shane.paragraph.PType

Return paragraph type to convert to from paragraph type.

static get_width(ptype: shane.paragraph.PType) → int

Return width of paragraph type.

class shane.paragraph.PType

Enum for paragraph types.

class shane.paragraph.Paragraph(ptype: shane.paragraph.PType, text=None)

A paragraph in a screenplay.

get_line_column_at_pos(pos: int) -> (<class 'int'>, <class 'int'>)

Return line and column for position.

get_line_count() → int

Return number of lines.

get_lines() → []

Return text in line wrapped form.

get_pos_at_line_column(line: int, column: int) → int

Return position for column in line.

get_text() → str

Return paragraph’s text (ending with null character).

get_type()

Return type.

sp_delete(pos: int, length: int) → str

Delete text from paragraph and return deleted text.

sp_input(pos: int, text: str)

Input text into paragraph.

sp_set_type(ptype: shane.paragraph.PType)

Set paragraph’s type.