def emit(self):
        """ Return the data! """
        self.coalesce_properties()
        output_format = self.config.get('output_format', 'markdown')
        output = ''
        if output_format == 'html':
            from format_utils import HtmlUtils
            formatter = HtmlUtils()
            output = formatter.head_one("Property Index", 0)
            output += self.format_tabular_output(formatter)
            output = self.add_html_boilerplate(output)

        if output_format == 'markdown':
            from format_utils import FormatUtils
            formatter = FormatUtils()
            output = formatter.head_one("Property Index", 0)
            output += self.format_tabular_output(formatter)

        if output_format == 'csv':
            output = self.output_csv()

        return output
Beispiel #2
0
    def emit(self):
        """ Return the data! """
        self.coalesce_properties()
        output_format = self.config.get('output_format', 'markdown')
        output = ''
        frontmatter = backmatter = ''
        if 'property_index_boilerplate' in self.config:
            boilerplate = self.config['property_index_boilerplate']
            frontmatter, backmatter = boilerplate.split('[insert property index]')
        if output_format == 'html':
            from format_utils import HtmlUtils
            formatter = HtmlUtils()
            if frontmatter:
                output = formatter.markdown_to_html(frontmatter)
            else:
                output = formatter.head_one("Property Index", 0)
            output += self.format_tabular_output(formatter)
            output += formatter.markdown_to_html(backmatter)
            toc = self.generate_toc(output)
            if '[add_toc]' in output:
                output = output.replace('[add_toc]', toc, 1)

            output = self.add_html_boilerplate(output)

        if output_format == 'markdown':
            from format_utils import FormatUtils
            formatter = FormatUtils()
            if frontmatter:
                output = frontmatter
            else:
                output = formatter.head_one("Property Index", 0)
            output += self.format_tabular_output(formatter)
            output += backmatter

        if output_format == 'csv':
            output = self.output_csv()

        return output