tumblr.content
Provides several content blocks to make up post bodies
Classes
|
Abstract base class of content blocks |
Abstract base class of normal text content blocks |
|
Abstract base class of container blocks |
|
|
Abstract base class of content blocks that link to data |
|
Raw text block - creates text with the specified subtype |
|
A Text content block with the given content. |
|
A Heading1 Text subtype content block with the given content. |
|
A Heading2 Text subtype content block with the given content. |
|
A quirky Text subtype content block with the given content. |
|
A quote Text subtype content block with the given content. |
|
A chat Text subtype content block with the given content. |
|
An ordered-list-item Text subtype content block with the given content. |
|
An unordered-list-item Text subtype content block with the given content. |
|
A list of ordered-list-item Text subtype content blocks with the given items in the content list. |
|
A list of unordered-list-item Text subtype content blocks with the given items in the content list. |
|
An indented Text subtype content block with the given content. |
|
A poll content block. |
|
An Image block. |
|
Inserts a "keep reading" bar that truncates the post. |
|
Creates a row of images. |
- class Block
Abstract base class of content blocks
- class ContentBlock
Abstract base class of normal text content blocks
- abstractmethod data() Mapping
The data associated with this block
- class MultiBlock
Abstract base class of container blocks
- abstractmethod data() Iterable[Mapping]
The data associated with this block’s children
- class DataBlock(path: PurePath | str, mime_type: str)
Abstract base class of content blocks that link to data
- class RawText(content: str, subtype: str, **kwargs)
Raw text block - creates text with the specified subtype
- data() Mapping
The data associated with this block
- class Text(content: str, **kwargs)
A Text content block with the given content.
See: https://www.tumblr.com/docs/npf#content-block-type-text
- data()
The data associated with this block
- class Heading(content: str, **kwargs)
A Heading1 Text subtype content block with the given content.
See: https://www.tumblr.com/docs/npf#content-block-type-text
- class Subheading(content: str, **kwargs)
A Heading2 Text subtype content block with the given content.
See: https://www.tumblr.com/docs/npf#content-block-type-text
- class Cursive(content: str, **kwargs)
A quirky Text subtype content block with the given content.
See: https://www.tumblr.com/docs/npf#content-block-type-text
- class Quote(content: str, **kwargs)
A quote Text subtype content block with the given content.
See: https://www.tumblr.com/docs/npf#content-block-type-text
- class Chat(content: str, **kwargs)
A chat Text subtype content block with the given content.
See: https://www.tumblr.com/docs/npf#content-block-type-text
- class OrderedListItem(content: str, **kwargs)
An ordered-list-item Text subtype content block with the given content.
See: https://www.tumblr.com/docs/npf#content-block-type-text
- class UnorderedListItem(content: str, **kwargs)
An unordered-list-item Text subtype content block with the given content.
See: https://www.tumblr.com/docs/npf#content-block-type-text
- class OrderedList(items: list[str], **kwargs)
A list of ordered-list-item Text subtype content blocks with the given items in the content list. Passes all kwargs onto each individual list item.
- data()
The data associated with this block’s children
- class UnorderedList(items: list[str], **kwargs)
A list of unordered-list-item Text subtype content blocks with the given items in the content list. Passes all kwargs onto each individual list item.
- data()
The data associated with this block’s children
- class Indented(content: str, **kwargs)
An indented Text subtype content block with the given content.
See: https://www.tumblr.com/docs/npf#content-block-type-text
- class Poll(question: str, options: Iterable[str], *, expire_after: timedelta = datetime.timedelta(days=7))
A poll content block. This is not officially documented yet, so who knows if it’s going to change!
Note
expire_after is clamped between 1 and 7 days serverside
Only one poll can be in each post and this is enforced serverside
At least 2 and at most 12 options can be provided each having a max of 80 characters.
- Parameters:
question – The Poll prompt
options – The poll options
expire_after – a time delta of when the poll will close (default 7 days)
- data() Mapping
The data associated with this block
- class Image(path: PurePath | str, img_type: str, alt_text: str, caption: str = None)
An Image block.
See: https://www.tumblr.com/docs/npf#content-block-type-image
- Parameters:
path – The path to the image
img_type – The image MIME type
alt_text – Image Alt Text
caption – Optional Caption (displayed under image when viewed)
- class ReadMore
Inserts a “keep reading” bar that truncates the post. Only one can be added per post.