Editorial Workflows

@Tags

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: Updated version of taskpaper @tag filtering. Now shows list of tags with values as options to filter. If you select the tag without the value it will show all tags. Example:

@shop --> shows all tags regardless if tags have a value or not
@shop(homedepot) --> only shows homedepot value @shop tags matches.

Automatically folds lines matching the tag you select from the list.

Shared by: @ryanlaner

Comments: Comment Feed (RSS)

@ryanlaner — 19 May 2015
Forgot to mention it excludes @due and @start tags for showing value options. These will only show the superset @due and @start for seeing all tags values.
mjknght — 19 Mar 2016
Hi Ryan,

Thanks so much for this, it's been immensely helpful. I've noticed a problem for a while but the penny has just dropped on what the cause might be: whenever there's a second set of parentheses in a task, the whole task is listed, not just the tag with its variable. Is there an easy way to fix this? Thanks again. Mark
anonymous — 10 May 2016
Hi Mark,

Can you give me an example task/line that has this issue so I can see it for myself and debug?

/ryan

+ Add Comment

Workflow Preview
Stop If No Document is Open... ?
Run the block if
File Name
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
Show Alert ?
Title
No Document Open
Message
You need to open a document to use this workflow. It uses the current document's path to determine where to search.
Button 1
OK
Output Value
Button 2
(don't show)
Output Value
Button 3
(don't show)
Output Value
Show Cancel Button
OFF
Stop ?
Stop
  • This Workflow
  • Repeat Block
Show HUD Alert
OFF
Message
Stopped
…End If
Set Variable ?
Variable Name
CSS Light
Value
body { font-family: 'Source Sans Pro'; color: #333; background-color: #fafafa; margin: 10px 10px 10px 10px; } a { text-decoration: none; color: #016396; } a.result-box { display: block; margin-bottom: 15px; -webkit-tap-highlight-color: rgba(0,0,0,0); color: #333; background-color: white; border: 1px solid #ccc; border-radius: 4px; padding: 10px; } a.result-box:active { color: #016396; background-color: #f0f0f0; } .highlight { background-color: yellow; } #help-text { color: gray; }
Set Variable ?
Variable Name
CSS Dark
Value
body { font-family: 'Source Sans Pro'; color: #d6d6d6; background-color: #33393f; margin: 10px 10px 10px 10px; } a { text-decoration: none; color: #b2cae5; } a.result-box { display: block; margin-bottom: 15px; -webkit-tap-highlight-color: rgba(0,0,0,0); color: #d6d6d6; background-color: #33393f; border: 1px solid #111; border-radius: 4px; padding: 10px; } a.result-box:active { color: #b2cae5; background-color: #5a6470; } .highlight { background-color: #187b00; } #help-text { color: gray; }
Set Variable ?
Variable Name
CSS
Value
This will be set from the script, depending on the currently selected theme.
Run Python Script ?
Source Code
#coding: utf-8
import workflow
import editor
import console
import re
import os
import sys
from collections import defaultdict
from collections import OrderedDict
import codecs
from StringIO import StringIO

def autoVivify():
	return 0

full_path = editor.get_path()
tagGroup = defaultdict(autoVivify)

from urllib import quote
try:
	with codecs.open(full_path, 'r', 'utf-8') as f:
		for line in f:
			m = re.findall('\s{1}(\@\w+)', line)
			n = re.findall('\s{1}(\@\w+\(.*\))', line)
			if re.search('\@done', line):
				continue
			else:
				for i in m:
					if i == '':
						pass
					else:
						tagGroup[i.strip()] += 1
				for i in n:
					if i == '':
						pass
					else:
						if re.search('(\@due)|(\@start)',i):
							continue
						else:
							tagGroup[i.strip()] += 1

except UnicodeDecodeError, e:
	pass

tagList = []
tags = ''
for key, value in tagGroup.iteritems():
	tagList.append(key)
	
tagList = sorted(tagList)

for i in tagList:
	tags = tags + i + '\n'

action_out = workflow.set_output(tags)
Select from List ?
Title
List (Lines)
Input
Multiple Selection
OFF
Show in Popover
OFF
Set Variable ?
Variable Name
Search Term
Value
Input
Unfold All Text ?
Fold Lines Containing… ?
  • Regular Expression
  • Case-insensitive Search (A = a)
  • Case-sensitive Search (A ≠ a)
Search Term
Invert
ON
Fold Lines Containing… ?
  • Regular Expression
  • Case-insensitive Search (A = a)
  • Case-sensitive Search (A ≠ a)
@done
Invert
OFF