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: This workflow will make your device read your text out loud starting from the current cursor position until the end of the text. If an area of the text is selected it will read the selected text instead. Activating the workflow again before it has finished will stop the reading.

Some known markdown comment conventions will be ignored. Namely Ulysses (%% , ++ and ||), Notebooks (//) and html (<!-- -->). See respective documentations for details of proper usage.

It is handy to associate option-S, or a shortcut key combination of your preference, for easy starting and stopping of speech.

The reading speed is slightly faster than "normal". The default language on the device will be used. The workflow is designed to be a proofreading tool.

Shared by: Rune Myrland

Comments: Comment Feed (RSS)

There are no comments yet.

+ Add Comment

Workflow Preview
Get selection or caret to eof (python) ?
Source Code
#coding: utf-8
import workflow
import editor

# Pass current selection in current document to next element in workflow.
# If nothing is selected pass from cursor until end of text.

action_in = workflow.get_input()

# Default result
text = u""

file_path = editor.get_path()
if file_path is None:
#	print 'No document is open.'
	sel_start, sel_end = editor.get_selection()
	# print "Selection: ", sel_start, sel_end
	if(sel_start == sel_end):
		# Cursor to end of text
		text = editor.get_text()[sel_start:]
		# Current selection
		text = editor.get_selected_text()

# Pass it on
Strip markdown comments (python) ?
Source Code
#coding: utf-8
import workflow

action_in = workflow.get_input()

action_out = list()
for line in action_in.splitlines():
	# Skip Ulysses and Notebooks style full line comments respectively
	if line.startswith("%%") or line.startswith("//"):
	# Remove HTML style comments
	if line.find("<!--") > 0:
		startSplit = line.partition("<!--")
		endSplit = startSplit[-1].partition("-->")
		line = startSplit[0] + endSplit[-1]

	# Remove HTML style comments
	while line.count("||") >= 2:
		startSplit = line.partition("||")
		endSplit = startSplit[-1].partition("||")
		line = startSplit[0] + endSplit[-1]		

	# Remove Ulysses style comments
	if line.find("++") >= 0:
		splits = line.split("++")
		line = ""
		# Throw away first element if it is a comment
		if(line.find("++") == 0):
		while(len(splits) > 0):
			# Keep non-comment
			line = line + splits.pop()
			# Throw away comment
			if(len(splits) > 0):
workflow.set_output(str.join("\n", action_out))
Speech (python) ?
Source Code
#coding: utf-8
import workflow
import speech

# Get the custom parameters as a dictionary (titles are keys):
params = workflow.get_parameters()
# Get the action's input (a string):
action_in = workflow.get_input()

sp = u""

	# If speech is in progress stop
	# If not, start

	# Remove some characters that may confuse the speech api
	sp = action_in.replace("*", "").replace("_", "").replace("::", "").replace("||", "")

	# Very fast speech
	# speech.say(sp, "", 0.54)

	# Slightly fast speech
	speech.say(sp, "", 0.51)

	# Normal speed speech
	# speech.say(sp, "", 0.50)