Skip to content
This repository has been archived by the owner on Jul 8, 2020. It is now read-only.

Commit

Permalink
initial local commit
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiantheblind committed Aug 30, 2016
0 parents commit 7e86dd4
Show file tree
Hide file tree
Showing 7 changed files with 143 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# MAC OSX
.DS_Store
# WIN
Thumbs.db
# nodejs and web dev
node_modules
bower_components
# sublime sftp plugin
sftp-config.json
# sublime
*.sublime-project
*.sublime-workspace
# processing
sketch.properties
build-tmp
# codekit
.codekit-cache
# a file with private data
private.json
private
# for extendscript ID dev
pdfs
*.idlk
# for CRAN
# History files
.Rhistory
# Example code in package build process
*-Ex.R
# R data files from past sessions
.Rdata
# RStudio files
.Rproj.user/

# GOLANG
# After Effects
Adobe\ After\ Effects\ Auto-Save/
Adobe\ After\ Effects\ Auto-Speichern

# Particle Photon
*.bin

3 changes: 3 additions & 0 deletions Default.sublime-commands
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[
{ "caption": "Enable frontal slide highlighting", "command": "frontal" }
]
3 changes: 3 additions & 0 deletions Frontal.sublime-settings
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"enabled":false
}
10 changes: 10 additions & 0 deletions Main.sublime-menu
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[
{
"id": "tools",
"children":
[
{"id": "wrap"},
{ "command": "frontal" }
]
}
]
Binary file added dot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
59 changes: 59 additions & 0 deletions frontal.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import sublime, sublime_plugin, re

# see https://forum.sublimetext.com/t/dev-build-3118/21270
class Frontal(sublime_plugin.ViewEventListener):
def __init__(self, view):
self.view = view
self.phantom_set = sublime.PhantomSet(view)
self.timeout_scheduled = False
self.needs_update = False
settings = sublime.load_settings('Frontal.sublime-settings')
self.enabled = settings.get('enabled')
print (self.enabled)
if self.enabled == False:
self.phantom_set.update([])
PHANTOM_SUPPORT = int(sublime.version()) >= 3118
self.update_phantoms()

@classmethod
def is_applicable(cls, settings):
syntax = settings.get('syntax')
print (syntax)
mde = 'Packages/MarkdownEditing/Markdown.tmLanguage'
pt = 'Packages/Text/Plain text.tmLanguage'
md = 'Packages/Markdown/Markdown.sublime-syntax'
mmd = 'Packages/Markdown/MultiMarkdown.sublime-syntax'
return syntax == mde or syntax == pt or syntax == md or syntax == mmd and self.enabled == True and PHANTOM_SUPPORT == True

def update_phantoms(self):
phantoms = []
lines = self.view.find_all('^---')

counter = 2
for r in lines:
# line_region = self.view.line(r.a)
# line = self.view.substr(line_region)
name = '<div style="background-color:rgba(123,123,123,0.4);">Frontal Slide: ' + str(counter) + '</div>'
phantoms.append(sublime.Phantom(
r,
name,
sublime.LAYOUT_BLOCK))
counter = counter + 1

self.phantom_set.update(phantoms)

def handle_timeout(self):
self.timeout_scheduled = False
if self.needs_update:
self.needs_update = False
self.update_phantoms()

def on_modified(self):
# Call update_phantoms(), but not any more than 10 times a second
if self.timeout_scheduled:
self.needs_update = True
else:
sublime.set_timeout(lambda: self.handle_timeout(), 100)
self.update_phantoms()


27 changes: 27 additions & 0 deletions test.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Lorem ipsum dolor sit amet, consectetur adipisicing elit,
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

---
---


---

---


---



<FOOTER>

</FOOTER>

---


---


0 comments on commit 7e86dd4

Please sign in to comment.