1"""
2Contains writer base class.
3"""
4
5# Copyright (c) Jupyter Development Team.
6# Distributed under the terms of the Modified BSD License.
7from __future__ import annotations
8
9from traitlets import List, Unicode
10
11from nbconvert.utils.base import NbConvertBase
12
13
14class WriterBase(NbConvertBase):
15 """Consumes output from nbconvert export...() methods and writes to a
16 useful location."""
17
18 files = List(
19 Unicode(),
20 help="""
21 List of the files that the notebook references. Files will be
22 included with written output.""",
23 ).tag(config=True)
24
25 def __init__(self, config=None, **kw):
26 """
27 Constructor
28 """
29 super().__init__(config=config, **kw)
30
31 def write(self, output, resources, **kw):
32 """
33 Consume and write Jinja output.
34
35 Parameters
36 ----------
37 output : string
38 Conversion results. This string contains the file contents of the
39 converted file.
40 resources : dict
41 Resources created and filled by the nbconvert conversion process.
42 Includes output from preprocessors, such as the extract figure
43 preprocessor.
44 """
45
46 raise NotImplementedError()