From 31b3384bd5b8bc20ea3809c9513e471d8418e2a0 Mon Sep 17 00:00:00 2001 From: www Date: Mon, 28 Dec 2020 08:13:40 +0000 Subject: [PATCH] clean internfiles --- internfiles/__init__.py | 7 ++++--- templates/internfiles.html | 10 +--------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/internfiles/__init__.py b/internfiles/__init__.py index 8d7c864..b0dc2ff 100644 --- a/internfiles/__init__.py +++ b/internfiles/__init__.py @@ -4,7 +4,7 @@ from slugify import slugify import re from flask import redirect, url_for, send_from_directory from .pth import pth - +import bs4 bp = Blueprint("internfiles", __name__, url_prefix="/internfiles") @@ -61,9 +61,10 @@ def web(path=""): if f and f.endswith(".txt"): text = os.path.abspath(f) - with open(os.path.abspath(f), "r") as fh: - text = fh.read() + with open(os.path.abspath(f), "r", encoding='utf-8') as fh: + text = (fh.read()) text = re.sub("\\n\s*\\n", "
", text) + #text=bs4.BeautifulSoup(text).text elif f: return send_from_directory(str(f - 1), str(f[-1])) return render_template("internfiles.html", file=f, dir=d, text=text, path=pth(d.p)) diff --git a/templates/internfiles.html b/templates/internfiles.html index 1e5c96c..a2ca8f6 100644 --- a/templates/internfiles.html +++ b/templates/internfiles.html @@ -5,17 +5,9 @@ -

sdf

- - -{{file}} -{{dir}} -{{dir.files}}

Text:

{{text|safe}}