Beispiel #1
0
 def auto_detect_syntax(self):
     view_syntax = self.view.settings().get('syntax')
     if (view_syntax == 'Packages/Markdown/MultiMarkdown.tmLanguage'
             or view_syntax == 'Packages/Markdown/Markdown.tmLanguage'):
         return tablelib.multi_markdown_syntax()
     elif view_syntax == 'Packages/Textile/Textile.tmLanguage':
         return tablelib.textile_syntax()
     elif (view_syntax ==
           'Packages/RestructuredText/reStructuredText.tmLanguage'):
         return tablelib.re_structured_text_syntax()
     else:
         return tablelib.simple_syntax()
 def auto_detect_syntax(self):
     view_syntax = self.view.settings().get('syntax')
     if (view_syntax == 'Packages/Markdown/MultiMarkdown.tmLanguage' or
         view_syntax == 'Packages/Markdown/Markdown.tmLanguage'):
         return tablelib.multi_markdown_syntax()
     elif view_syntax == 'Packages/Textile/Textile.tmLanguage':
         return tablelib.textile_syntax()
     elif (view_syntax ==
                  'Packages/RestructuredText/reStructuredText.tmLanguage'):
         return tablelib.re_structured_text_syntax()
     else:
         return tablelib.simple_syntax()
Beispiel #3
0
    def syntax(self):
        syntax_name = self.view.settings().get(
            "table_editor_syntax")  # 配置文件获取默认语法 Preferences.sublime-settings
        if syntax_name == "Simple":
            syntax = tablelib.simple_syntax()
        elif syntax_name == "EmacsOrgMode":
            syntax = tablelib.emacs_org_mode_syntax()
        elif syntax_name == "Pandoc":
            syntax = tablelib.pandoc_syntax()
        elif syntax_name == "MultiMarkdown":
            syntax = tablelib.multi_markdown_syntax()
        elif syntax_name == "reStructuredText":
            syntax = tablelib.re_structured_text_syntax()
        elif syntax_name == "Textile":
            syntax = tablelib.textile_syntax()
        else:
            syntax = self.auto_detect_syntax()
        border_style = (
            self.view.settings().get("table_editor_border_style", None)
            or self.view.settings().get("table_editor_style", None))
        if border_style == "emacs":
            syntax.hline_out_border = '|'
            syntax.hline_in_border = '+'
        elif border_style == "grid":
            syntax.hline_out_border = '+'
            syntax.hline_in_border = '+'
        elif border_style == "simple":
            syntax.hline_out_border = '|'
            syntax.hline_in_border = '|'

        if self.view.settings().has("table_editor_custom_column_alignment"):
            syntax.custom_column_alignment = self.view.settings().get(
                "table_editor_custom_column_alignment")

        if self.view.settings().has("table_editor_keep_space_left"):
            syntax.keep_space_left = self.view.settings().get(
                "table_editor_keep_space_left")

        if self.view.settings().has("table_editor_align_number_right"):
            syntax.align_number_right = self.view.settings().get(
                "table_editor_align_number_right")

        if self.view.settings().has("table_editor_detect_header"):
            syntax.detect_header = self.view.settings().get(
                "table_editor_detect_header")

        return syntax
    def detect_syntax(self):
        syntax_name = self.view.settings().get("table_editor_syntax")
        if syntax_name == "Simple":
            syntax = tablelib.simple_syntax()
        elif syntax_name == "EmacsOrgMode":
            syntax = tablelib.emacs_org_mode_syntax()
        elif syntax_name == "Pandoc":
            syntax = tablelib.pandoc_syntax()
        elif syntax_name == "MultiMarkdown":
            syntax = tablelib.multi_markdown_syntax()
        elif syntax_name == "reStructuredText":
            syntax = tablelib.re_structured_text_syntax()
        elif syntax_name == "Textile":
            syntax = tablelib.textile_syntax()
        else:
            syntax = self.auto_detect_syntax()
        border_style = (self.view.settings().get("table_editor_border_style",
                                                   None) or
                         self.view.settings().get("table_editor_style",
                         None))
        if border_style == "emacs":
            syntax.hline_out_border = '|'
            syntax.hline_in_border = '+'
        elif border_style == "grid":
            syntax.hline_out_border = '+'
            syntax.hline_in_border = '+'
        elif border_style == "simple":
            syntax.hline_out_border = '|'
            syntax.hline_in_border = '|'

        if self.view.settings().has("table_editor_custom_column_alignment"):
            syntax.custom_column_alignment = self.view.settings().get("table_editor_custom_column_alignment")

        if self.view.settings().has("table_editor_keep_space_left"):
            syntax.keep_space_left = self.view.settings().get("table_editor_keep_space_left")

        if self.view.settings().has("table_editor_align_number_right"):
            syntax.align_number_right = self.view.settings().get("table_editor_align_number_right")

        if self.view.settings().has("table_editor_detect_header"):
            syntax.detect_header = self.view.settings().get("table_editor_detect_header")

        return syntax
Beispiel #5
0
 def setUp(self):
     self.syntax = tablelib.multi_markdown_syntax()
Beispiel #6
0
 def setUp(self):
     self.syntax = tablelib.multi_markdown_syntax()