diff --git a/akarpov/files/previews/__init__.py b/akarpov/files/previews/__init__.py index 57b1184..2e0532e 100644 --- a/akarpov/files/previews/__init__.py +++ b/akarpov/files/previews/__init__.py @@ -1,4 +1,4 @@ -from . import application, audio, image, text, video +from . import application, audio, font, image, text, video previews = { "application": { @@ -37,6 +37,7 @@ "plain": text.plain.view, "csv": text.csv.view, }, + "font": {"otf": font.otf.view}, } source_code = {} @@ -62,4 +63,5 @@ "jar": application.zip.view, "mpeg": video.mp4.view, "oga": audio.oga.view, + "otf": font.otf.view, } | source_code diff --git a/akarpov/files/previews/font/__init__.py b/akarpov/files/previews/font/__init__.py index e69de29..01e422f 100644 --- a/akarpov/files/previews/font/__init__.py +++ b/akarpov/files/previews/font/__init__.py @@ -0,0 +1 @@ +from . import otf # noqa diff --git a/akarpov/files/previews/font/otf.py b/akarpov/files/previews/font/otf.py index 61dafa1..656e063 100644 --- a/akarpov/files/previews/font/otf.py +++ b/akarpov/files/previews/font/otf.py @@ -1,5 +1,36 @@ +import string + from akarpov.files.models import File def view(file: File): - ... + text = " ".join(string.printable) + name = file.file.path.split("/")[-1].split(".")[0] + static = ( + """ + + """ + ) + content = f""" +
+ {text} +
+ """ + return static, content