Пример #1
0
    def render(self):
        if self.sequence_type in ["list", "accordion"]:
            return templates.template("sequence/list.html").render(
                anchor_id=self.content["anchor_id"],
                items=self.content["items"])
        elif self.sequence_type == "tabs":
            return templates.template("sequence/tabs.html").render(
                tabs=self.content["items"],
                anchor_id=self.content["anchor_id"])
        elif self.sequence_type == "sections":
            return templates.template("sequence/sections.html").render(
                sections=self.content["items"],
                full_width=config["html"]["style"]["full_width"].get(bool),
            )
        elif self.sequence_type == "grid":
            return templates.template("sequence/grid.html").render(
                items=self.content["items"])

        raise ValueError("Template not understood", self.sequence_type)
Пример #2
0
    def to_html(self) -> str:
        """Generate and return complete template as lengthy string
            for using with frameworks.

        Returns:
            Profiling report html including wrapper.
        
        """
        from data_profiling.src.report.presentation.flavours import HTMLReport
        from data_profiling.src.report.presentation.flavours.html import templates

        use_local_assets = config["html"]["use_local_assets"].get(bool)

        html = HTMLReport(self.report).render()

        nav_items = [
            (section.name, section.anchor_id)
            for section in self.report.content["items"]
        ]
        wrapped_html = templates.template("wrapper/wrapper.html").render(
            content=html,
            title=self.title,
            nav=config["html"]["navbar_show"].get(bool),
            nav_items=nav_items,
            version=__version__,
            offline=use_local_assets,
            primary_color=config["html"]["style"]["primary_color"].get(str),
            logo=config["html"]["style"]["logo"].get(str),
            theme=config["html"]["style"]["theme"].get(str),
        )

        minify_html = config["html"]["minify_html"].get(bool)
        if minify_html:
            from htmlmin.main import minify

            wrapped_html = minify(
                wrapped_html, remove_all_empty_space=True, remove_comments=True
            )
        return wrapped_html
Пример #3
0
 def render(self):
     return templates.template("frequency_table.html").render(
         rows=self.content["rows"])
Пример #4
0
 def render(self):
     return templates.template("collapse.html").render(**self.content)
Пример #5
0
 def render(self):
     return widgets.HTML(
         templates.template("warnings.html").render(**self.content))
Пример #6
0
 def render(self):
     return templates.template("table.html").render(**self.content)
Пример #7
0
 def render(self):
     return templates.template("diagram.html").render(**self.content)
Пример #8
0
 def render(self):
     return templates.template("toggle_button.html").render(**self.content)
 def render(self):
     return templates.template("frequency_table_small.html").render(
         rows=self.content)
Пример #10
0
 def render(self):
     return widgets.HTML(
         templates.template("variable_info.html").render(**self.content))
Пример #11
0
 def render(self):
     return templates.template("warnings.html").render(**self.content)