Commit 2895bcc2 authored by chrissi^'s avatar chrissi^

flamngo: Add site-dependend HTML-Parser

The flamingo-core HTML-parser does two things:

* remove the first <h1>
* re-write the HTML with beutiful soup.

We want to leave our <h1> where it is since it is
places somewhere inside out HTML.
The Template should not be able to place it there...

BS-HTML is ugly!
Signed-off-by: chrissi^'s avatarChris Fiege <>
parent b6ac55ed
from bs4 import BeautifulSoup
from flamingo.core.utils.html import extract_title
from flamingo.core.parser import ContentParser
class RawParser(ContentParser):
def parse(self, file_content, content):
markup_string = self.parse_meta_data(file_content, content)
soup = BeautifulSoup(markup_string, 'html.parser')
title = extract_title(soup)
content['content_title'] = title
content['content_body'] = markup_string
class Raw:
def parser_setup(self, context):
......@@ -8,8 +8,13 @@ PLUGINS = [
# remove flamingo core HTML plugin.
# we can now use our own "Raw"
DEFAULT_PLUGINS = [x for x in DEFAULT_PLUGINS if x != "flamingo.plugins.HTML"]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment