2
0
Fork 0
textout/textoutpc/builtin_tags/Title.py

35 lines
919 B
Python
Raw Normal View History

#!/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.
#******************************************************************************
2018-05-24 21:57:42 +02:00
from ..tags import TextoutBlockTag as _TextoutBlockTag
__all__ = ["TextoutTitleTag"]
2018-02-19 20:13:10 +01:00
class TextoutTitleTag(_TextoutBlockTag):
""" The title tag.
Example uses:
[title]Some title[/title]
[subtitle]Some subtitle[/subtitle]
"""
aliases = ('[title]', '[subtitle]')
raw = True
2018-01-16 13:34:11 +01:00
def prepare(self, name, value):
2018-01-22 20:49:30 +01:00
self._level = name[1:-1]
def begin_html(self):
2018-01-22 20:49:30 +01:00
return ('<h5>', '<h4>')[self._level == "title"]
def end_html(self):
2018-01-22 20:49:30 +01:00
return ('</h5>', '</h4>')[self._level == "title"]
def begin_lightscript(self):
return '#' * ((self._level == "subtitle") + 1) + ' '
# End of file.