2
0
Fork 0
textout/textoutpc/__init__.py

45 lines
1.4 KiB
Python
Raw Normal View History

2018-01-02 18:57:04 +01:00
#!/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-01-02 18:57:04 +01:00
""" Functions for the user.
Really simplifies the thing.
"""
2018-07-28 19:36:43 +02:00
from io import StringIO as _StringIO
2018-07-28 19:36:43 +02:00
from ._options import TextoutOptions as Options, \
TextoutBlockTag as BlockTag, TextoutInlineTag as InlineTag, \
TextoutParagraphTag as ParagraphTag, TextoutSmiley as Smiley
from ._translate import Translator as _Translator
__all__ = ["version", "tohtml", "tolightscript",
"Options", "BlockTag", "ParagraphTag", "InlineTag", "Smiley"]
2018-02-12 08:32:02 +01:00
version = "0.1.1"
2018-01-02 18:57:04 +01:00
2018-07-28 19:36:43 +02:00
# ---
# Public functions.
# ---
_default_options = Options()
def tohtml(message, options = _default_options, **tweaks):
""" Converts textout BBcode to HTML.
Receives a string, returns a string. """
2018-07-28 19:36:43 +02:00
return _Translator(_StringIO(message), _StringIO(), 'html', \
tweaks, options).process().getvalue()
2018-07-28 19:36:43 +02:00
def tolightscript(message, options = _default_options, **tweaks):
""" Converts textout BBcode to Lightscript.
Receives a string, returns a string. """
return "" # TODO: real thing one day
2018-07-28 19:36:43 +02:00
return _Translator(_StringIO(message), _StringIO(), 'lightscript', \
tweaks, options).process().getvalue()
2018-01-02 18:57:04 +01:00
# End of file.