Editorial Workflows


public workflow

Install Workflow...

This workflow contains at least one Python script. Only use it if you trust the person who shared this with you, and if you know exactly what it does.

I understand, install the workflow!

This is a workflow for Editorial, a Markdown and plain text editor for iOS. To download it, you need to view this page on a device that has the app installed.

Description: Select text between pairs of quotes.

Shared by: moyashi

Comments: Comment Feed (RSS)

There are no comments yet.

+ Add Comment

Workflow Preview
Run Python Script ?
Source Code
#coding: utf-8
import editor
import re

whole_text = editor.get_text()
cursor_position = editor.get_selection()[1]
line_span = editor.get_line_selection()
first_half = whole_text[line_span[0]:cursor_position]
last_half = whole_text[cursor_position:line_span[1]]
pattern = re.compile(".+?([^'\"]+)$")
m = pattern.match(first_half)
if m != None:
	begin = m.span(1)[0]
	pattern = re.compile("^([^'\"]+).+?")
	m = pattern.match(last_half)
	if m != None:
		end = len(first_half) + m.span(1)[1]
		#txt = whole_text[begin:end]
		editor.set_selection(begin, end)