def __init__(self, formatter):

        self.formatter = formatter
        self.options = coldfusionbeautifier.default_options()

        # parse custom options from settings file
        self.fill_custom_options(formatter.settings.get('codeformatter_coldfusion_options'))
示例#2
0
    def __init__(self, formatter):

        self.formatter = formatter
        self.options = coldfusionbeautifier.default_options()

        # parse custom options from settings file
        self.fill_custom_options(
            formatter.settings.get('codeformatter_coldfusion_options'))
示例#3
0
    def format(self, text):
        text = text.decode("utf-8")

        stderr = ""
        stdout = ""
        options = coldfusionbeautifier.default_options()

        if "indent_size" in self.opts:
            options.indent_size = self.opts["indent_size"]

        if "indent_char" in self.opts:
            options.indent_char = str(self.opts["indent_char"])

        if "minimum_attribute_count" in self.opts:
            options.minimum_attribute_count = self.opts[
                "minimum_attribute_count"]

        if "first_attribute_on_new_line" in self.opts:
            options.first_attribute_on_new_line = self.opts[
                "first_attribute_on_new_line"]

        if "indent_with_tabs" in self.opts:
            options.indent_with_tabs = self.opts["indent_with_tabs"]

        if "expand_tags" in self.opts:
            options.expand_tags = self.opts["expand_tags"]

        if "expand_javascript" in self.opts:
            options.expand_javascript = self.opts["expand_javascript"]

        if "reduce_empty_tags" in self.opts:
            options.reduce_empty_tags = self.opts["reduce_empty_tags"]

        if "reduce_whole_word_tags" in self.opts:
            options.reduce_whole_word_tags = self.opts[
                "reduce_whole_word_tags"]

        if "exception_on_tag_mismatch" in self.opts:
            options.exception_on_tag_mismatch = self.opts[
                "exception_on_tag_mismatch"]

        if "custom_singletons" in self.opts:
            options.custom_singletons = self.opts["custom_singletons"]

        try:
            stdout = coldfusionbeautifier.beautify(text, options)
        except Exception as e:
            stderr = str(e)

        if (not stderr and not stdout):
            stderr = "Formatting error!"

        return stdout, stderr
示例#4
0
    def format(self, text):

        text = text.decode('utf-8')
        stderr = ''
        stdout = ''
        options = coldfusionbeautifier.default_options()

        if 'indent_size' in self.opts:
            options.indent_size = self.opts['indent_size']

        if 'indent_char' in self.opts:
            options.indent_char = str(self.opts['indent_char'])

        if 'minimum_attribute_count' in self.opts:
            options.minimum_attribute_count = (
                self.opts['minimum_attribute_count'])

        if 'first_attribute_on_new_line' in self.opts:
            options.first_attribute_on_new_line = (
                self.opts['first_attribute_on_new_line'])

        if 'indent_with_tabs' in self.opts:
            options.indent_with_tabs = self.opts['indent_with_tabs']

        if 'expand_tags' in self.opts:
            options.expand_tags = self.opts['expand_tags']

        if 'expand_javascript' in self.opts:
            options.expand_javascript = self.opts['expand_javascript']

        if 'reduce_empty_tags' in self.opts:
            options.reduce_empty_tags = self.opts['reduce_empty_tags']

        if 'reduce_whole_word_tags' in self.opts:
            options.reduce_whole_word_tags = (
                self.opts['reduce_whole_word_tags'])

        if 'exception_on_tag_mismatch' in self.opts:
            options.exception_on_tag_mismatch = (
                self.opts['exception_on_tag_mismatch'])

        if 'custom_singletons' in self.opts:
            options.custom_singletons = self.opts['custom_singletons']

        try:
            stdout = coldfusionbeautifier.beautify(text, options)
        except Exception as e:
            stderr = str(e)

        if (not stderr and not stdout):
            stderr = 'Formatting error!'

        return stdout, stderr
    def format(self, text):
        text = text.decode("utf-8")

        stderr = ""
        stdout = ""
        options = coldfusionbeautifier.default_options()

        if "indent_size" in self.opts:
            options.indent_size = self.opts["indent_size"]

        if "indent_char" in self.opts:
            options.indent_char = str(self.opts["indent_char"])

        if "minimum_attribute_count" in self.opts:
            options.minimum_attribute_count = self.opts["minimum_attribute_count"]

        if "first_attribute_on_new_line" in self.opts:
            options.first_attribute_on_new_line = self.opts["first_attribute_on_new_line"]

        if "indent_with_tabs" in self.opts:
            options.indent_with_tabs = self.opts["indent_with_tabs"]

        if "expand_tags" in self.opts:
            options.expand_tags = self.opts["expand_tags"]

        if "expand_javascript" in self.opts:
            options.expand_javascript = self.opts["expand_javascript"]

        if "reduce_empty_tags" in self.opts:
            options.reduce_empty_tags = self.opts["reduce_empty_tags"]

        if "reduce_whole_word_tags" in self.opts:
            options.reduce_whole_word_tags = self.opts["reduce_whole_word_tags"]

        if "exception_on_tag_mismatch" in self.opts:
            options.exception_on_tag_mismatch = self.opts["exception_on_tag_mismatch"]

        if "custom_singletons" in self.opts:
            options.custom_singletons = self.opts["custom_singletons"]

        try:
            stdout = coldfusionbeautifier.beautify(text, options)
        except Exception as e:
            stderr = str(e)

        if (not stderr and not stdout):
            stderr = "Formatting error!"

        return stdout, stderr