U ž5”_ò ã@s6dZddlmZddlmZdgZGdd„deƒZdS)zÊ pygments.formatters.bbcode ~~~~~~~~~~~~~~~~~~~~~~~~~~ BBcode formatter. :copyright: Copyright 2006-2020 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. é)Ú Formatter)Ú get_bool_optÚBBCodeFormatterc@s8eZdZdZdZddgZgZdd„Zdd„Zd d „Z d S) raã Format tokens with BBcodes. These formatting codes are used by many bulletin boards, so you can highlight your sourcecode with pygments before posting it there. This formatter has no support for background colors and borders, as there are no common BBcode tags for that. Some board systems (e.g. phpBB) don't support colors in their [code] tag, so you can't use the highlighting together with that tag. Text in a [code] tag usually is shown with a monospace font (which this formatter can do with the ``monofont`` option) and no spaces (which you need for indentation) are removed. Additional options accepted: `style` The style to use, can be a string or a Style subclass (default: ``'default'``). `codetag` If set to true, put the output into ``[code]`` tags (default: ``false``) `monofont` If set to true, add a tag to show the code with a monospace font (default: ``false``). ZBBCodeZbbcodeZbbcKs<tj|f|Žt|ddƒ|_t|ddƒ|_i|_| ¡dS)NZcodetagFZmonofont)rÚ__init__rÚ_codeÚ_monoÚstylesÚ _make_styles)ÚselfÚoptions©r úD/usr/local/lib/python3.8/site-packages/pygments/formatters/bbcode.pyr4s zBBCodeFormatter.__init__cCs’|jD]†\}}d}}|dr6|d|d7}d|}|drN|d7}d|}|drf|d 7}d |}|d r~|d 7}d |}||f|j|<qdS)NÚZcolorz [color=#%s]z[/color]Zboldz[b]z[/b]Zitalicz[i]z[/i]Z underlinez[u]z[/u])Zstyler)r ÚttypeZndefÚstartÚendr r r r <szBBCodeFormatter._make_stylesc Csì|jr| d¡|jr | d¡d}d}|D]\\}}||jkrF|j}q4||krX||7}q,|r€|j|\}}| d |||f¡¡|}|}q,|r²|j|\}}| d |||f¡¡|jrÂ| d¡|jrÒ| d¡|jsÞ|jrè| d¡dS)Nz[code]z[font=monospace]rz[/font]z[/code]Ú )rÚwriterrÚparentÚjoin) r Z tokensourceZoutfileZlastvalZlasttyperÚvaluerrr r r Úformat_unencodedOs2        z BBCodeFormatter.format_unencodedN) Ú__name__Ú __module__Ú __qualname__Ú__doc__ÚnameÚaliasesÚ filenamesrr rr r r r rsN)rZpygments.formatterrZ pygments.utilrÚ__all__rr r r r Ús