Exemplo n.º 1
0
    def __init__(self, str_id: str, str_name: str, str_content: str,
                 str_link: str, str_type: str):
        # Class vars
        self.id = str_id
        # parse url decoding
        self.name = translate_url(str_name)
        self.name_small_list = list()
        self.content = ""
        self.link = str_link  # Item link / slug
        self.type = str_type  # Item type

        # Strip unneeded html tags from post content
        html_remover = MyHTMLParser()
        html_remover.feed(str_content)

        # Strip remaining non HTML tags (such as [h5p id="#"])
        self.content = sub(r" ?\[[^)]+\]", " " + settings_dict["h5p"] + " ",
                           html_remover.html_text)

        html_remover.close()