Esempio n. 1
0
        def format_value(value):
            if isinstance(value, float):
                return '{0:.{1}f}'.format(value, self.digits)
            else:
                result = str(value)

            # Only escape text if it doesn't contain LaTeX or HTML markup.
            if "''" in result:
                return result
            else:
                return markup.escape(result)
Esempio n. 2
0
    def _format_value(self, value):
        if isinstance(value, float):
            return f"{value:.{self.digits}f}"
        else:
            result = str(value)

        # Only escape text if it doesn't contain LaTeX or HTML markup.
        if "''" in result:
            return result
        else:
            return markup.escape(result)
Esempio n. 3
0
        def format_value(value):
            if isinstance(value, list):
                result = [format_value(val) for val in value]
                return result
            elif isinstance(value, float):
                return "{0:.{1}f}".format(value, self.digits)
            elif isinstance(value, int):
                return value
            else:
                result = str(value)

            # Only escape text if it doesn't contain LaTeX or HTML markup.
            if "''" in result or '""' in result:
                return result
            else:
                return markup.escape(result)