Editorial Workflows

KT: Send micropost using Working Copy

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 is a sample workflow I use to send a micropost to thecave.com. It creates a Jekyll post and saves it to a Git repository using Working Copy. It prompts you for the post title, category, and additional tags to include in the Jekyll front matter. The workflow includes the tag "micropost" automatically.

To use this workflow, change the key and repo variables to match the key and repo name in Working Copy. The key must match the URL key found in Working Copy's Settings > App Integrations section.

Working Copy must be installed to use this workflow. https://workingcopyapp.com

Comments: Comment Feed (RSS)

There are no comments yet.

+ Add Comment

Workflow Preview
Set Variable ?
Variable Name
key
Value
Working Copy URL key
Set Variable ?
Variable Name
repo
Value
your-repo-name
Get Current File Name ?
Include Folder
OFF
Include Extension
OFF
URL Escape ?
Set Variable ?
Variable Name
filename
Value
Input
Set Variable ?
Variable Name
path
Value
_posts/Year: 2001-Month: 01-Day: 01-filename.md
Select from List ?
Title
Category
List (Lines)
personal business programming
Multiple Selection
OFF
Show in Popover
OFF
Set Variable ?
Variable Name
post_category
Value
Input
Request Text Input ?
Title
Other tags
Initial Text
  • Single Line
  • Multiple Lines
Keyboard Options:
Set Variable ?
Variable Name
post_tags
Value
Input
Run Python Script ?
Source Code
#coding: utf-8
import workflow
import datetime

# Date logic adapted from http://stackoverflow.com/a/24740202/371228

# Get current local time and UTC time
localnow = datetime.datetime.now()
utcnow = datetime.datetime.utcnow()

# Compute the time difference in seconds
tzd = localnow - utcnow
secs = tzd.days*24*3600 + tzd.seconds

# Get a positive or negative prefix
prefix = '+'
if secs < 0:
	prefix = '-'
	secs = abs(secs)

# Return the local time and the difference
suffix = "%s%02d%02d" % (prefix, secs/3600, secs/60%60)

workflow.set_output(suffix)
Set Variable ?
Variable Name
post_timezone
Value
Input
Document Text ?
Folded Text
  • Include
  • Replace with:
Set Variable ?
Variable Name
text
Value
--- layout: post title: "" date: Year: 2001-Month: 01-Day: 01 Hour: 01 (24h):Minute: 01:Second: 01 post_timezone category: post_category tags: [micropost,post_tags] --- Input
Open URL ?
Open in
  • In-App Browser
  • Default App / Safari
URL
working-copy://x-callback-url/chain?key=key&repo=repo&command=pull&command=write&path=path&text=text&command=commit&message=File Name%20updated&command=push&x-success=editorial://workflow-callback?output=[[output]]
Tab
  • Last-used Tab
  • New Tab
  • Tab with ID:
Unique identifier
Wait until Loaded
OFF
Reveal Browser Automatically
ON