Add bbcode library and some bbcode parsing. SMF's bbcode is somewhat different to what this library expects so some of it does not come out correctly.

This commit is contained in:
Adrian Kuschelyagi Malacoda 2020-08-10 02:00:00 -05:00
parent 0116646dd9
commit 3cb08e2d2f
2 changed files with 9 additions and 3 deletions

View File

@ -1,9 +1,11 @@
import os
import chevron
import logging
import shutil
from datetime import datetime
import chevron
import bbcode
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger("ArchiveGenerator")
@ -16,7 +18,11 @@ def prepare_thread (thread):
return thread
def prepare_post (post):
return prepare_thread(post)
post = prepare_thread(post)
parser = bbcode.Parser()
post['body'] = parser.format(post['body']).replace("&lt;br /&gt;", "<br />")
return post
class ArchiveGenerator():
def __init__ (self, template_dir, static_dir):

View File

@ -8,7 +8,7 @@ setup(
description='Tools for exporting and creating archives of Glitch City Labs data',
author='Adrian Kuschelyagi Malacoda',
packages=['epilogue'],
install_requires=['pysqlite3 >= 0.4.3', 'chevron >= 0.13.1'],
install_requires=['pysqlite3 >= 0.4.3', 'chevron >= 0.13.1', 'bbcode >= 1.1.0'],
entry_points={
'console_scripts': [
'epilogue = epilogue:main'