Editorial Workflows

Form Letter

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: Demonstrate substitution using Python str.format(**dict).

Create a .md file with the following template text: '''Therapy session on {session_date} with {first_name} {last_name}:

On {session_date:%B %d, %Y}, Nikki Schwartz had therapy session with
{first_name} {last_name} who is a {age} year old {sex} suffering from
{issues}.''' Make sure that is the current document in Editorial and then run this workflow.

Shared by: @cclauss

Comments: Comment Feed (RSS)

There are no comments yet.

+ Add Comment

Workflow Preview
Document Text ?
Folded Text
  • Include
  • Replace with:
Run Python Script ?
Source Code
#coding: utf-8
import datetime
import workflow

action_in = workflow.get_input()

patient_info = {'first_name': 'Donald',
                'last_name': 'Trump',
                'birth_date': datetime.date(1946, 6, 14),
                'session_date': datetime.date(2017, 3, 3),
                'sex': 'male',
                'now': datetime.date.today(),
                'issues': 'delusions of adequacy'}

fmt = 'Therapy Report {first_name} {last_name} on {session_date}.md'
workflow.set_variable('filename', fmt.format(**patient_info))

delta_t = datetime.date.today() - patient_info['birth_date']
patient_info['age'] = int(delta_t.days / 365.2425)

report = action_in.format(**patient_info)
action_out = report

Create Document ?
Open in Editor