]> git.scottworley.com Git - paperdoorknob/commitdiff
Pass an ImageStore around
authorScott Worley <scottworley@scottworley.com>
Wed, 20 Dec 2023 07:55:05 +0000 (23:55 -0800)
committerScott Worley <scottworley@scottworley.com>
Wed, 20 Dec 2023 07:55:05 +0000 (23:55 -0800)
args.py
paperdoorknob_test.py
spec.py

diff --git a/args.py b/args.py
index f343a84a71d2ef0a2394ec71c84d7e1c932cbd3a..d90de8a78b7e32207c66fe6ee19d7939de634483 100644 (file)
--- a/args.py
+++ b/args.py
@@ -16,6 +16,7 @@ from xdg_base_dirs import xdg_cache_home
 from domfilter import ApplyDOMFilters, DOMFilters
 from fetch import CachingFetcher
 from htmlfilter import ApplyHTMLFilters, HTMLFilters
+from images import ImageStore
 from spec import Spec
 from texify import PandocTexifier
 
@@ -66,6 +67,7 @@ def spec_from_commandline_args() -> Iterator[Spec]:
             yield Spec(
                 args.url,
                 fetcher,
+                ImageStore(args.out + '_images', fetcher),
                 lambda x: ApplyHTMLFilters(args.htmlfilters, x),
                 lambda x: ApplyDOMFilters(args.domfilters, x),
                 PandocTexifier(args.pandoc or 'pandoc'),
index 49f1872842ea2e61503fd119942c68bfa0eb6bcc..65fc2a9f308fbba82657389a87dd9b0971b312da 100644 (file)
@@ -15,6 +15,7 @@ import paperdoorknob
 from testing.fakeserver import FakeGlowficServer
 from domfilter import ApplyDOMFilters
 from fetch import DirectFetcher, FakeFetcher, Fetcher
+from images import ImageStore
 from spec import Spec
 from texify import DirectTexifier, PandocTexifier, VerifyingTexifier
 
@@ -46,6 +47,7 @@ class BaseTestProcess(ABC):
         spec = Spec(
             self.url(),
             self.fetcher(),
+            ImageStore('is', self.fetcher()),
             lambda x: x,
             lambda x: ApplyDOMFilters('NoEdit,NoFooter', x),
             PandocTexifier('pandoc'),
@@ -68,6 +70,7 @@ Pretty sure.
         spec = Spec(
             self.url(),
             self.fetcher(),
+            ImageStore('is', self.fetcher()),
             lambda x: x,
             lambda x: ApplyDOMFilters('NoEdit,NoFooter', x),
             texifier,
@@ -80,6 +83,7 @@ Pretty sure.
             spec = Spec(
                 self.url(),
                 self.fetcher(),
+                ImageStore('is', self.fetcher()),
                 lambda x: x,
                 lambda x: ApplyDOMFilters('NoEdit,NoFooter', x),
                 PandocTexifier('pandoc'),
diff --git a/spec.py b/spec.py
index c7ace56daf7c6da338a1288b4b5278410009cf23..2b80f163d880c78d36556437b70ab4805eed8a48 100644 (file)
--- a/spec.py
+++ b/spec.py
@@ -13,6 +13,7 @@ from bs4.element import Tag
 
 from fetch import Fetcher
 from texify import Texifier
+from images import ImageStore
 
 
 # pylint: disable=too-many-instance-attributes
@@ -20,6 +21,7 @@ from texify import Texifier
 class Spec:
     url: str
     fetcher: Fetcher
+    images: ImageStore
     htmlfilter: Callable[[bytes], bytes]
     domfilter: Callable[[Tag], None]
     texifier: Texifier