diff --git a/fix_br.py b/fix_br.py index 5e8ca78..0c3a524 100644 --- a/fix_br.py +++ b/fix_br.py @@ -38,7 +38,26 @@ def scrape_posts(root_dir): post_body = post.find(class_='postMessage') for br in post_body.find_all('br'): br.replace_with('\n') - post_body_txt = post_body.get_text() + #post_body_txt = post_body.get_text() + post_body_txt = '' + + for child in post_body.children: + if not child.name: # text element + post_body_txt += child.get_text() + elif child.name == 'b': + post_body_txt += '' + child.get_text() + '' + elif child.name == 'span' and child['class'][0] == 'mu-s': + post_body_txt += '' + child.get_text() + '' + elif child.name == 'span' and child['class'][0] == 'mu-i': + post_body_txt += '' + child.get_text() + '' + elif child.name == 'span' and child['class'][0] == 'mu-r': + post_body_txt += '' + child.get_text() + '' + elif child.name == 'span' and child['class'][0] == 'mu-g': + post_body_txt += '' + child.get_text() + '' + elif child.name == 'span' and child['class'][0] == 'mu-b': + post_body_txt += '' + child.get_text() + '' + else: + post_body_txt += child.get_text() cur.execute( "UPDATE post SET body = (%s) WHERE id = (%s)", diff --git a/static/voyage.css b/static/voyage.css index 0eebdd6..0c05519 100644 --- a/static/voyage.css +++ b/static/voyage.css @@ -74,6 +74,26 @@ body { text-decoration: line-through; } +.bold { + font-weight: bold; +} + +.italic { + font-style: italic; +} + +.red { + color: red; +} + +.green { + color: green; +} + +.blue { + color: blue; +} + #visibility_menu_toggle { cursor: pointer }