Пример #1
0
import editor
import console
import os
import re
import sys
import codecs
import workflow
from StringIO import StringIO

# Set CSS theme
theme = editor.get_theme()
workflow.set_variable(
    'CSS',
    workflow.get_variable('CSS Dark' if theme == 'Dark' else 'CSS Light'))

# Set Variables
p = editor.get_path()
console.clear()
term = workflow.get_variable('Search Term')
pattern = re.compile(re.escape(term), flags=re.IGNORECASE)
term_array = term.split()
for i in range(len(term_array)):
    term_array[i] = re.escape(term_array[i])
from urllib import quote
dir = os.path.split(p)[0]
valid_extensions = set(
    ['.txt', '.md', '.markd', '.text', '.mdown', '.taskpaper'])
html = StringIO()
filename_match = 0
content_match = 0
match_count = 0
Пример #2
0
    ).encode("utf-8")


t = todoflow.from_files(todoflow.lists.to_list())

query_today = "@working and not @done"
query_next = "@next and not @done and not @working"

html_parts = [
    print_due(t),
    print_dates(t),
    print_query(t, "Working", query_today, "working"),
    print_query(t, "Next", query_next, "next"),
    '<a class="reload-button" id="reload-button" href="editorial://?command=TF:%20Agenda">Reload</a>',
]

action_out = "\n".join(html_parts).decode("utf-8")

import workflow

workflow.set_output(action_out)

import editor

if editor.get_theme() == "Dark":
    css = workflow.get_variable("dark css")
else:
    css = workflow.get_variable("light css")

workflow.set_variable("css", css.decode("utf-8"))
Пример #3
0
import editor
import console
import os
import re
import sys
import codecs
import workflow
from StringIO import StringIO

# Set CSS theme
theme = editor.get_theme()
workflow.set_variable('CSS', workflow.get_variable('CSS Dark' if theme == 'Dark' else 'CSS Light'))

# Set Variables
p = editor.get_path()
console.clear()
term = workflow.get_variable('Search Term')
pattern = re.compile(re.escape(term), flags=re.IGNORECASE)
term_array = term.split()
for i in range(len(term_array)):
		term_array[i] = re.escape(term_array[i])
from urllib import quote
dir = os.path.split(p)[0]
valid_extensions = set(['.txt', '.md', '.markd', '.text', '.mdown', '.taskpaper'])
html = StringIO()
filename_match = 0
content_match = 0
match_count = 0

# Iterate over fienames against search terms and output if match found