Editorial Workflows

Select Tag

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: With caret inside a TaskPaper tag, selects the entire tag.

Shared by: Craig Pearlman

Comments: Comment Feed (RSS)

There are no comments yet.

+ Add Comment

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

action_in = workflow.get_input()

start, end = editor.get_selection()

# search backwards for @
while True:
	text = editor.get_selected_text()
	if len(text) > 0 and text.startswith('@'):
		break
	else:
		start = start - 1
		if start < 0: break
		editor.set_selection(start, end)
		
# search forwards for )

fulltext = editor.get_text()
length = len(fulltext)

while True:
	text = editor.get_selected_text()
	if len(text) > 0 and (text.endswith(')') or text.endswith(' ') or text.endswith('\n')):
		if not text.endswith(')'):
			editor.set_selection(start, end - 1)
		break
	else:
		end = end + 1
		if end > length: break
		editor.set_selection(start, end)

action_out = action_in
workflow.set_output(action_out)