Skip to content

Commit

Permalink
sublime-syntax support
Browse files Browse the repository at this point in the history
  • Loading branch information
facelessuser committed Apr 9, 2015
1 parent 3cf5588 commit e7ad23f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
13 changes: 13 additions & 0 deletions Calendar.sublime-syntax
@@ -0,0 +1,13 @@
%YAML 1.2
---
# http://www.sublimetext.com/docs/3/syntax.html
name: Calendar
file_extensions:
- calendar
scope: source.calendar
contexts:
main:
- match: '[ ]{3}[\d ]{3}[ ]{3}'
scope: selected_day.calendar
- match: '   [\d ]{3}   '
scope: holiday.calendar
4 changes: 3 additions & 1 deletion quickcal.py
Expand Up @@ -17,6 +17,8 @@
import json
import urllib.request

USE_ST_SYNTAX = int(sublime.version()) >= 3084
ST_SYNTAX = "sublime-syntax" if USE_ST_SYNTAX else 'tmLanguage'
MONTHS = enum("January February March April May June July August September October November December", start=1, name="Months")
WEEKDAYS = enum("Monday Tuesday Wednesday Thursday Friday Saturday Sunday", start=1, name="Days")

Expand Down Expand Up @@ -312,7 +314,7 @@ def run(self, edit, day):
sunday_first=sublime.load_settings("quickcal.sublime-settings").get("sunday_first", True),
force_update=True
)
view.set_syntax_file("Packages/QuickCal/Calendar.tmLanguage")
view.set_syntax_file("Packages/QuickCal/Calendar.%s" % ST_SYNTAX)
view.replace(edit, sublime.Region(0, view.size()), bfr)
view.sel().clear()
view.settings().set("calendar_current", {"month": str(today.month), "year": today.year})
Expand Down

0 comments on commit e7ad23f

Please sign in to comment.