diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index e41eb5ab..2cb42eb7 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -28,8 +28,7 @@ _Though I will not personally implement rules for your favorite language, I am m 2. When creating an issue on the repository, please provide as much info as possible: - - Sublime Text build. - - Operating system. + - Provide environment information by running `Preferences->Package Settings->ApplySyntax->Support Info`. The information will be copied to the clipboard; paste the info in issue. - Errors in console. - Detailed description of the problem. - Examples for reproducing the error. You can post pictures, but if specific text or code is required to reproduce the issue, please provide the text in a plain text format for easy copy/paste. diff --git a/CHANGES.md b/CHANGES.md index 50b932fa..34927f3c 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,8 @@ +# BracketHighlighter 2.21.4 +> Released Aug 21, 2016 + +- **FIX**: Changelog command now works for older ST3 versions. + # BracketHighlighter 2.21.3 > Released Aug 1, 2016 diff --git a/Main.sublime-menu b/Main.sublime-menu index 901a37e6..37ac1bea 100644 --- a/Main.sublime-menu +++ b/Main.sublime-menu @@ -294,12 +294,12 @@ { "caption": "-" }, { "caption": "Changelog", - "command": "bh_changes" + "command": "bracket_highlighter_changes" }, { "caption": "-" }, { "caption": "Support Info", - "command": "bh_support_info" + "command": "bracket_highlighter_support_info" }, { "caption": "-" } ] diff --git a/changes.py b/changes.py index 547d1ed8..2fefe018 100644 --- a/changes.py +++ b/changes.py @@ -1,39 +1,45 @@ """Changelog.""" import sublime import sublime_plugin +import webbrowser CSS = ''' +html { {{'.background'|css}} } +div.bracket-highlighter { padding: 0; margin: 0; {{'.background'|css}} } .bracket-highlighter h1, .bracket-highlighter h2, .bracket-highlighter h3, .bracket-highlighter h4, .bracket-highlighter h5, .bracket-highlighter h6 { {{'.string'|css('color')}} } .bracket-highlighter blockquote { {{'.comment'|css('color')}} } +.apply-syntax a { text-decoration: none; } ''' -class BhChangesCommand(sublime_plugin.WindowCommand): +class BracketHighlighterChangesCommand(sublime_plugin.WindowCommand): """Changelog command.""" def run(self): """Show the changelog in a new view.""" - import mdpopups + try: + import mdpopups + has_phantom_support = (mdpopups.version() >= (1, 7, 3)) and (int(sublime.version()) >= 3118) + except Exception: + has_phantom_support = False text = sublime.load_resource('Packages/BracketHighlighter/CHANGES.md') view = self.window.new_file() view.set_name('BracketHighlighter - Changelog') view.settings().set('gutter', False) - html = '
%s
' % mdpopups.md2html(view, text) - mdpopups.add_phantom(view, 'changelog', sublime.Region(0), html, sublime.LAYOUT_INLINE, css=CSS) + if has_phantom_support: + html = '
%s
' % mdpopups.md2html(view, text) + mdpopups.add_phantom( + view, 'changelog', sublime.Region(0), html, sublime.LAYOUT_INLINE, css=CSS, on_navigate=self.on_navigate + ) + else: + view.run_command('insert', {"characters": text}) view.set_read_only(True) view.set_scratch(True) - def is_enabled(self): - """Check if is enabled.""" - try: - import mdpopups - except Exception: - return False - - return (mdpopups.version() >= (1, 7, 3)) and (int(sublime.version()) >= 3118) - - is_visible = is_enabled + def on_navigate(self, href): + """Open links.""" + webbrowser.open_new_tab(href) diff --git a/docs/contributing.md b/docs/contributing.md index 8e559d5f..17bfd8ee 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -28,8 +28,7 @@ Contribution from the community is encouraged and can be done in a variety of wa 2. When creating an issue on the repository, please provide as much info as possible: - - Sublime Text build. - - Operating system. + - Provide environment information by running `Preferences->Package Settings->BracketHighlighter->Support Info`. The information will be copied to the clipboard; paste the info in issue. - Errors in console. - Detailed description of the problem. - Examples for reproducing the error. You can post pictures, but if specific text or code is required to reproduce the issue, please provide the text in a plain text format for easy copy/paste. diff --git a/bh_support.py b/support.py similarity index 81% rename from bh_support.py rename to support.py index d5de41e9..6a98428a 100644 --- a/bh_support.py +++ b/support.py @@ -3,7 +3,7 @@ import sublime_plugin import textwrap -__version__ = "2.21.3" +__version__ = "2.21.4" __pc_name__ = 'BracketHighlighter' @@ -37,7 +37,7 @@ def is_installed_by_package_control(): return str(__pc_name__ in set(settings.get('installed_packages', []))) -class BhSupportInfoCommand(sublime_plugin.ApplicationCommand): +class BracketHighlighterSupportInfoCommand(sublime_plugin.ApplicationCommand): """Support info.""" def run(self): @@ -48,7 +48,7 @@ def run(self): info["platform"] = sublime.platform() info["version"] = sublime.version() info["arch"] = sublime.arch() - info["bh_version"] = __version__ + info["plugin_version"] = __version__ info["pc_install"] = is_installed_by_package_control() try: import mdpopups @@ -82,16 +82,16 @@ def run(self): msg = textwrap.dedent( """\ - - ST ver.: %(version)s - - Platform: %(platform)s - - Arch: %(arch)s - - Plugin ver.: %(bh_version)s + - ST ver.: %(version)s + - Platform: %(platform)s + - Arch: %(arch)s + - Plugin ver.: %(plugin_version)s - Install via PC: %(pc_install)s - - mdpopups ver.: %(mdpopups_version)s - - backrefs ver.: %(backrefs_version)s - - markdown ver.: %(markdown_version)s - - pygments ver.: %(pygments_version)s - - jinja2 ver.: %(jinja_version)s + - mdpopups ver.: %(mdpopups_version)s + - backrefs ver.: %(backrefs_version)s + - markdown ver.: %(markdown_version)s + - pygments ver.: %(pygments_version)s + - jinja2 ver.: %(jinja_version)s """ % info )