8
8
9
9
from __future__ import annotations
10
10
11
+ import os
11
12
import pickle
12
13
import types
13
14
from os import path
@@ -42,10 +43,10 @@ class SerializingHTMLBuilder(StandaloneHTMLBuilder):
42
43
implementation : Any = None
43
44
implementation_dumps_unicode = False
44
45
#: additional arguments for dump()
45
- additional_dump_args = ()
46
+ additional_dump_args : tuple = ()
46
47
47
48
#: the filename for the global context file
48
- globalcontext_filename : str | None = None
49
+ globalcontext_filename : str = ''
49
50
50
51
supported_image_types = ['image/svg+xml' , 'image/png' ,
51
52
'image/gif' , 'image/jpeg' ]
@@ -69,7 +70,7 @@ def get_target_uri(self, docname: str, typ: str | None = None) -> str:
69
70
return docname [:- 5 ] # up to sep
70
71
return docname + SEP
71
72
72
- def dump_context (self , context : dict , filename : str ) -> None :
73
+ def dump_context (self , context : dict , filename : str | os . PathLike [ str ] ) -> None :
73
74
if self .implementation_dumps_unicode :
74
75
with open (filename , 'w' , encoding = 'utf-8' ) as ft :
75
76
self .implementation .dump (context , ft , * self .additional_dump_args )
@@ -109,7 +110,7 @@ def handle_page(self, pagename: str, ctx: dict, templatename: str = 'page.html',
109
110
110
111
def handle_finish (self ) -> None :
111
112
# dump the global context
112
- outfilename = path . join ( self .outdir , self .globalcontext_filename )
113
+ outfilename = self .outdir / self .globalcontext_filename
113
114
self .dump_context (self .globalcontext , outfilename )
114
115
115
116
# super here to dump the search index
0 commit comments