]> git.scottworley.com Git - paperdoorknob/commitdiff
Put Texifier in spec
authorScott Worley <scottworley@scottworley.com>
Mon, 1 Jan 2024 02:54:30 +0000 (18:54 -0800)
committerScott Worley <scottworley@scottworley.com>
Mon, 1 Jan 2024 06:14:24 +0000 (22:14 -0800)
args.py
paperdoorknob_test.py
spec.py

diff --git a/args.py b/args.py
index 45c080a30a7eb34904558d89697f14c6f9d5854d..ede847118dd4bfdd5cc7f62843252790fac52405 100644 (file)
--- a/args.py
+++ b/args.py
@@ -103,6 +103,7 @@ def spec_from_commandline_args() -> Iterator[Spec]:
                 DiskImageStore(args.out + '_images', fetcher),
                 lambda x: ApplyHTMLFilters(args.htmlfilters, x),
                 lambda x: ApplyDOMFilters(args.domfilters, x),
+                texifier,
                 lambda x: ApplyTexFilters(args.texfilters, x),
                 args.image_size,
                 layout,
index 286d6a9fc3aa65ca4cae3c4934470f27e775e468..28408d6138003d0ce616bc0e034cb9f9d52a250f 100644 (file)
@@ -35,15 +35,17 @@ class BaseTestProcess(ABC):
 
     def testProcess(self) -> None:
         buf = io.BytesIO()
+        texifier = PandocTexifier('pandoc')
         spec = Spec(
             self.url(),
             self.fetcher(),
             FakeImageStore(),
             lambda x: x,
             lambda x: None,
+            texifier,
             lambda x: x,
             20,
-            ContentOnlyLayout(PandocTexifier('pandoc')),
+            ContentOnlyLayout(texifier),
             'margin=20mm',
             buf,
             lambda _: None)
@@ -71,6 +73,7 @@ Pretty sure.
             FakeImageStore(),
             lambda x: x,
             lambda x: None,
+            texifier,
             lambda x: x,
             20,
             ContentOnlyLayout(texifier),
@@ -80,6 +83,7 @@ Pretty sure.
         paperdoorknob.process(spec)
 
     def testPDF(self) -> None:
+        texifier = PandocTexifier('pandoc')
         with open("test.tex", 'wb') as out:
             spec = Spec(
                 self.url(),
@@ -87,9 +91,10 @@ Pretty sure.
                 FakeImageStore(),
                 lambda x: x,
                 lambda x: None,
+                texifier,
                 lambda x: x,
                 20,
-                BesideIconLayout(PandocTexifier('pandoc')),
+                BesideIconLayout(texifier),
                 None,
                 out,
                 lambda _: None)
diff --git a/spec.py b/spec.py
index c4975b507e64bf6a3e3622d3e0dbf7fb32901260..3aa72920843103c737aa9c93982d8fabde74837c 100644 (file)
--- a/spec.py
+++ b/spec.py
@@ -14,6 +14,7 @@ from bs4.element import Tag
 from fetch import Fetcher
 from glowfic import Layout
 from images import ImageStore
+from texify import Texifier
 
 
 # pylint: disable=too-many-instance-attributes
@@ -24,6 +25,7 @@ class Spec:
     images: ImageStore
     htmlfilter: Callable[[bytes], bytes]
     domfilter: Callable[[Tag], None]
+    texifier: Texifier
     texfilter: Callable[[bytes], bytes]
     icon_size: float
     layout: Layout