2
0
Fork 0
textout/textoutpc/builtin/_Quote.py

50 lines
1.2 KiB
Python
Executable File
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env python3
#******************************************************************************
# Copyright (C) 2018 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
# This file is part of the textoutpc project, which is MIT-licensed.
#******************************************************************************
from .. import BlockTag as _BlockTag
__all__ = ["QuoteTag"]
class QuoteTag(_BlockTag):
""" The main tag for quoting someone.
Example uses:
[quote]Hey, I said that![/quote]
[quote=Someone important]I said something important, and it's
multiline and [b]formatted[/b]!
[quote=Someone else]Heck, he's even quoting me in his quote![/quote]
[/quote]
"""
aliases = ('[quote]',)
superblock = True
notempty = True
procvalue = True
def prepare(self, name, value):
self._value = value
def begin_html(self):
f = '<div class="citation">'
if self._value:
f += '<p><b>{} a écrit:</b></p>'.format(self._value)
return f
def end_html(self):
return '</div>'
def begin_lightscript(self):
text = '<<<'
if self._value:
text += ' ' + self._value
return text + '\n'
def end_lightscript(self):
return '<<<\n'
# End of file.