2018-01-05 22:13:30 +01:00
|
|
|
#!/usr/bin/env python3
|
2018-02-19 19:50:26 +01:00
|
|
|
#******************************************************************************
|
|
|
|
# Copyright (C) 2018 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
|
|
|
|
# This file is part of the textoutpc project, which is MIT-licensed.
|
|
|
|
#******************************************************************************
|
2018-01-05 22:13:30 +01:00
|
|
|
|
2018-05-24 21:57:42 +02:00
|
|
|
from ..tags import TextoutBlockTag as _TextoutBlockTag
|
2018-01-05 22:13:30 +01:00
|
|
|
|
|
|
|
__all__ = ["TextoutTitleTag"]
|
|
|
|
|
2018-02-19 20:13:10 +01:00
|
|
|
class TextoutTitleTag(_TextoutBlockTag):
|
2018-01-05 22:13:30 +01:00
|
|
|
""" The title tag.
|
|
|
|
Example uses:
|
|
|
|
|
|
|
|
[title]Some title[/title]
|
|
|
|
[subtitle]Some subtitle[/subtitle]
|
|
|
|
"""
|
|
|
|
|
|
|
|
aliases = ('[title]', '[subtitle]')
|
2018-01-24 12:33:33 +01:00
|
|
|
raw = True
|
2018-01-05 22:13:30 +01:00
|
|
|
|
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]
|
2018-01-05 22:13:30 +01:00
|
|
|
|
|
|
|
def begin_html(self):
|
2018-01-22 20:49:30 +01:00
|
|
|
return ('<h5>', '<h4>')[self._level == "title"]
|
2018-01-05 22:13:30 +01:00
|
|
|
|
|
|
|
def end_html(self):
|
2018-01-22 20:49:30 +01:00
|
|
|
return ('</h5>', '</h4>')[self._level == "title"]
|
2018-01-05 22:13:30 +01:00
|
|
|
|
2018-02-11 12:01:32 +01:00
|
|
|
def begin_lightscript(self):
|
|
|
|
return '#' * ((self._level == "subtitle") + 1) + ' '
|
|
|
|
|
2018-01-05 22:13:30 +01:00
|
|
|
# End of file.
|