Flutter Engine
The Flutter Engine
Public Member Functions | Public Attributes | List of all members
build.Page Class Reference
Inheritance diagram for build.Page:
build.Artifact

Public Member Functions

def __init__ (self, str name)
 
def __repr__ (self)
 
def depends_on (self, str path)
 
def build (self)
 
def __init__ (self, str output, Sequence[str] inputs)
 
bool depends_on (self, str path)
 
def build (self)
 

Public Attributes

 name
 
 inputs
 
- Public Attributes inherited from build.Artifact
 output
 
 inputs
 

Additional Inherited Members

- Static Public Member Functions inherited from build.Artifact
def build_all ()
 
def build_matching (Callable[[Artifact], bool] predicate)
 

Detailed Description

A single wiki Page (a markdown file).

Definition at line 130 of file build.py.

Constructor & Destructor Documentation

◆ __init__()

def build.Page.__init__ (   self,
str  name 
)

Reimplemented from build.Artifact.

Definition at line 133 of file build.py.

133 def __init__(self, name: str):
134 self.name = name
135 output_name = 'index' if name == 'README' else name
136 super().__init__(os.path.join(OUTPUT_DIR, f'{output_name}.html'),
137 [os.path.join(WIKI_SOURCE_DIR, f'{name}.md')])
138

Member Function Documentation

◆ __repr__()

def build.Page.__repr__ (   self)

Definition at line 139 of file build.py.

139 def __repr__(self):
140 return f'Page({self.output} <- {self.inputs[0]})'
141

◆ build()

def build.Page.build (   self)
Convert artifact inputs into an output.

Reimplemented from build.Artifact.

Definition at line 172 of file build.py.

172 def build(self):
173 logging.info('Build %s from %s', self.output, self.inputs[0])
174
175 template = jinja2_env.get_template(PAGE_TEMPLATE)
176 md_converter = markdown.Markdown(extensions=[
177 'admonition',
178 'extra',
179 CodeHiliteExtension(),
180 'tables',
181 'pymdownx.superfences',
182 'toc',
183 xref_extension,
184 ])
185 result = template.render({
186 'dev':
187 is_dev_mode,
188 'body':
189 md_converter.convert(self._load_markdown()),
190 'root':
191 deployment_root
192 })
193 # pylint: disable=no-member
194 if not is_dev_mode and len(md_converter.xrefs) > 0:
195 self._update_xref_section(md_converter.xrefs)
196
197 os.makedirs(os.path.dirname(self.output), exist_ok=True)
198 with codecs.open(self.output, "w", encoding='utf-8') as file:
199 file.write(result)
200
201 template_filename = template.filename # pytype: disable=attribute-error
202 self.inputs = [self.inputs[0], template_filename]
203
204
def build()
Definition: dom.py:52

◆ depends_on()

def build.Page.depends_on (   self,
str  path 
)
Check if this

Reimplemented from build.Artifact.

Definition at line 142 of file build.py.

142 def depends_on(self, path: str):
143 return path.startswith(TEMPLATES_INCLUDES_DIR) or super().depends_on(
144 path)
145
static bool depends_on(GrRenderTask *depender, GrRenderTask *dependee)

Member Data Documentation

◆ inputs

build.Page.inputs

Definition at line 202 of file build.py.

◆ name

build.Page.name

Definition at line 134 of file build.py.


The documentation for this class was generated from the following file: