Skip to content

Commit

Permalink
feat: New changelog command
Browse files Browse the repository at this point in the history
Now the `Changelog` command will open the changelog as a sublime text tab.
  • Loading branch information
equinusocio committed Aug 2, 2016
1 parent 8872738 commit b6da997
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 9 deletions.
38 changes: 38 additions & 0 deletions changes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
"""Changelog."""
import sublime
import sublime_plugin
import mdpopups

CSS = '''
.mt-config-changes { {{'.background'|css}} margin: 0; padding: 0; }
.mt-config-changes ul li, .bracket-hightlighter p { {{'.foreground'|css}} }
.mt-config-changes a { color: #4B67FF; }
.mt-config-changes h1, .mt-config-changes h2, .mt-config-changes h3,
.mt-config-changes h4, .mt-config-changes h5, .mt-config-changes h6 {
{{'.string'|css('color')}}
}
.mt-config-changes h1, .mt-config-changes h2 { margin-top: 50px; }
.mt-config-changes h3, .mt-config-changes h4 { margin-top: 30px; }
.mt-config-changes blockquote { {{'.foreground'|css('color')}} }
'''


class MtChangesCommand(sublime_plugin.WindowCommand):
"""Changelog command."""

def run(self):
"""Show the changelog in a new view."""
text = sublime.load_resource('Packages/Material Theme/CHANGELOG.md')
view = self.window.new_file()
view.set_name('Material Theme - Changelog')
view.settings().set('gutter', False)
html = '<div class="mt-config-changes">%s</div>' % mdpopups.md2html(view, text)
mdpopups.add_phantom(view, 'changelog', sublime.Region(0), html, sublime.LAYOUT_INLINE, css=CSS)
view.set_read_only(True)
view.set_scratch(True)

def is_enabled(self):
"""Check if is enabled."""
return (mdpopups.version() >= (1, 7, 3)) and (int(sublime.version()) >= 3118)

is_visible = is_enabled
10 changes: 1 addition & 9 deletions urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,4 @@ class MtIssuesCommand(sublime_plugin.WindowCommand):

def run(self):
"""Show the changelog in a new view."""
webbrowser.open_new_tab('https://github.com/equinusocio/material-theme/issues')


class MtChangesCommand(sublime_plugin.WindowCommand):
"""Changelog command."""

def run(self):
"""Show the changelog in a new view."""
webbrowser.open_new_tab('https://github.com/equinusocio/material-theme/blob/master/CHANGELOG.md')
webbrowser.open_new_tab('https://github.com/equinusocio/material-theme/issues')

0 comments on commit b6da997

Please sign in to comment.