Editorial Workflows

Next Actions

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 script:
1. Opens /Dropbox/Task Management/Next Actions.taskpaper
2. Removes any occurences of @start(YYYY-MM-DD) from this file, where YYYY-MM-DD is on or before today
3. Folds all lines containing @start(YYYY-MM-DD), where YYYY-MM-DD is a future date

Another script of mine, "Custom Classes and Functions", must be installed for this to work.

Copyright (c) 2017 Duncan MacIntyre

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Comments: Comment Feed (RSS)

There are no comments yet.

+ Add Comment

Workflow Preview
Sub-Workflow ?
Workflow
Can Stop Main Workflow
OFF
Open Document ?
File Name
Task Management/Next Actions.taskpaper
In Dropbox
ON
Run Python Script ?
Source Code
# the following code:
# 1. gets a DateObject for today
# 2. gets this date as a YYYY-MM-DD string
# 3. removes the dashes
# 4. stores this in the today variable
today = datetime.date.today().isoformat().replace('-', '')

# create a NumTemplate object for dates in the format ' @start(YYYY-MM-DD)' where YYYY-MM-DD
# is a date
# (the NumTemplate class is defined in the "Custom Classes and Functions" workflow)
date_template = NumTemplate(' @start\({}{}{}{}-{}{}-{}{}\)')

# unfold all text
editor.unfold_all()

# get the text of the current document, store this in the text variable
text = editor.get_text()

# the following code:
# 1. using NumTemplate.re_gen, forms a regular expression to match all occurences of 
#    ' @start(YYYY-MM-DD)' where YYYY-MM-DD is a past or present date
# 2. using re.sub(), removes matches to this re from text
# 3. replaces all text in the current document with this, without scrolling
editor.replace_text(0, len(text), re.sub(date_template.re_gen('<' + today, '=' + today), '', text), False)

# the following code:
# 1. using the gen method of the today object, forms a regular expression to match all occurences
#    of ' @start(YYYY-MM-DD)' where YYYY-MM-DD is a future date
# 2. passes this on as output
workflow.set_output(date_template.re_gen('>' + today))
Fold Lines Containing… ?
  • Regular Expression
  • Case-insensitive Search (A = a)
  • Case-sensitive Search (A ≠ a)
Input
Invert
OFF
Run Python Script ?
Source Code
# scroll to the top of the document
editor.set_scroll_position(0.0)