Editorial Workflows

Edit Python...

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: Place the contents of a Python file into the Editor. The Python file should have been created via the "Save as Python" workflow. You can also save the changes that you make with that workflow.

See: http://omz-forums.appspot.com/editorial/post/5265481661415424

Shared by: @cclauss

Comments: Comment Feed (RSS)

There are no comments yet.

+ Add Comment

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

action_in = workflow.get_input()

#TODO: Generate the output...
python_files = '\n'.join([x for x in sorted(os.listdir('.'))
                             if x.lower().endswith('.py')
                             and not os.path.isdir(x)])
action_out = python_files

Select from List ?
Select a file to edit.
List (Lines)
Multiple Selection
Show in Popover
If… ?
Run the block if
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
Stop ?
  • This Workflow
  • Repeat Block
Show HUD Alert
No file was selected.
…End If
Run Python Script ?
Source Code
#coding: utf-8
import editor, workflow

action_in = workflow.get_input()

#TODO: Generate the output...
assert action_in, 'No filename provided!'
with open(action_in) as in_file:
    editor.replace_text(0, len(editor.get_text()), in_file.read())
action_out = action_in