errbot.rendering.ansiext module

class errbot.rendering.ansiext.AnsiExtension(**kwargs)[source]

Bases: markdown.extensions.Extension

(kinda hackish) This is just a private extension to postprocess the html text to ansi text

extendMarkdown(md, md_globals)[source]

Add the various proccesors and patterns to the Markdown Instance.

This method must be overriden by every extension.

Keyword arguments:

  • md: The Markdown instance.
  • md_globals: Global variables in the markdown module namespace.
class errbot.rendering.ansiext.AnsiPostprocessor(md=None)[source]

Bases: markdown.postprocessors.Postprocessor

Markdown generates html entities, this reputs them back to their unicode equivalent

run(text)[source]

Subclasses of Postprocessor should implement a run method, which takes the html document as a single text string and returns a (possibly modified) string.

class errbot.rendering.ansiext.AnsiPreprocessor(md)[source]

Bases: markdown.extensions.fenced_code.FencedBlockPreprocessor

run(lines)[source]

Match and store Fenced Code Blocks in the HtmlStash.

class errbot.rendering.ansiext.BorderlessTable(chr_table)[source]

Bases: object

__init__(chr_table)[source]

Initialize self. See help(type(self)) for accurate signature.

add_col()[source]
add_header()[source]
begin_headers()[source]
end_headers()[source]
next_row()[source]
write(text)[source]
class errbot.rendering.ansiext.CharacterTable(fg_black, fg_red, fg_green, fg_yellow, fg_blue, fg_magenta, fg_cyan, fg_white, fg_default, bg_black, bg_red, bg_green, bg_yellow, bg_blue, bg_magenta, bg_cyan, bg_white, bg_default, fx_reset, fx_bold, fx_italic, fx_underline, fx_not_italic, fx_not_underline, fx_normal, fixed_width, end_fixed_width, inline_code, end_inline_code)

Bases: tuple

bg_black

Alias for field number 9

bg_blue

Alias for field number 13

bg_cyan

Alias for field number 15

bg_default

Alias for field number 17

bg_green

Alias for field number 11

bg_magenta

Alias for field number 14

bg_red

Alias for field number 10

bg_white

Alias for field number 16

bg_yellow

Alias for field number 12

end_fixed_width

Alias for field number 26

end_inline_code

Alias for field number 28

fg_black

Alias for field number 0

fg_blue

Alias for field number 4

fg_cyan

Alias for field number 6

fg_default

Alias for field number 8

fg_green

Alias for field number 2

fg_magenta

Alias for field number 5

fg_red

Alias for field number 1

fg_white

Alias for field number 7

fg_yellow

Alias for field number 3

fixed_width

Alias for field number 25

fx_bold

Alias for field number 19

fx_italic

Alias for field number 20

fx_normal

Alias for field number 24

fx_not_italic

Alias for field number 22

fx_not_underline

Alias for field number 23

fx_reset

Alias for field number 18

fx_underline

Alias for field number 21

inline_code

Alias for field number 27

class errbot.rendering.ansiext.NSC(s)[source]

Bases: object

__init__(s)[source]

Initialize self. See help(type(self)) for accurate signature.

class errbot.rendering.ansiext.Table(chr_table)[source]

Bases: object

__init__(chr_table)[source]

Initialize self. See help(type(self)) for accurate signature.

add_col()[source]
add_header()[source]
begin_headers()[source]
end_headers()[source]
next_row()[source]
write(text)[source]
errbot.rendering.ansiext.enable_format(name, chr_table, borders=True)[source]
errbot.rendering.ansiext.recurse(write, chr_table, element, table=None, borders=True)[source]
errbot.rendering.ansiext.translate(element, chr_table=CharacterTable(fg_black=<ansi.colour.base.Graphic object>, fg_red=<ansi.colour.base.Graphic object>, fg_green=<ansi.colour.base.Graphic object>, fg_yellow=<ansi.colour.base.Graphic object>, fg_blue=<ansi.colour.base.Graphic object>, fg_magenta=<ansi.colour.base.Graphic object>, fg_cyan=<ansi.colour.base.Graphic object>, fg_white=<ansi.colour.base.Graphic object>, fg_default=<ansi.colour.base.Graphic object>, bg_black=<ansi.colour.base.Graphic object>, bg_red=<ansi.colour.base.Graphic object>, bg_green=<ansi.colour.base.Graphic object>, bg_yellow=<ansi.colour.base.Graphic object>, bg_blue=<ansi.colour.base.Graphic object>, bg_magenta=<ansi.colour.base.Graphic object>, bg_cyan=<ansi.colour.base.Graphic object>, bg_white=<ansi.colour.base.Graphic object>, bg_default=<ansi.colour.base.Graphic object>, fx_reset=<ansi.colour.base.Graphic object>, fx_bold=<ansi.colour.base.Graphic object>, fx_italic=<ansi.colour.base.Graphic object>, fx_underline=<ansi.colour.base.Graphic object>, fx_not_italic=<ansi.colour.base.Graphic object>, fx_not_underline=<ansi.colour.base.Graphic object>, fx_normal=<ansi.colour.base.Graphic object>, fixed_width='', end_fixed_width='', inline_code='', end_inline_code=''), borders=True)[source]