Editorial Workflows

View Images

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 workflow gives the ability to show associated pictures within the same directory with @image tag (particularly usefull in taskpaper documents).

How to use :

Example
@image(name_of_image.png)

The name can take all alphanumeric characters and the extension can be jpg or png.

Shared by: www.caddtec.ca

Comments: Comment Feed (RSS)

There are no comments yet.

+ Add Comment

Workflow Preview
Get all the @image tags ?
Source Code
#coding: utf-8
import workflow
import editor
import re

text = editor.get_text()
tags = re.findall('@image\([\- .a-zA-Z0-9_]+\)', text)
if len(tags) == 0:
	import console
	console.hud_alert('No Tags Found', 'error')
	workflow.stop()
else:
	workflow.set_output('\n'.join(tags))
Select the @image you want to see ?
Title
Select Tag
List (Lines)
Input
Multiple Selection
OFF
Show in Popover
OFF
Extract file name from tag ?
Source Code
#coding: utf-8
import workflow
import re

action_in = workflow.get_input()

val = re.findall('[\- .a-zA-Z0-9_]+\.(?:png|jpg)', action_in)

if val:
	workflow.set_output(val[0])
else:
	workflow.set_output(None)
Set Variable ?
Variable Name
image_name
Value
Input
Custom UI ?
User Interface
Presentation Style
  • Sheet
  • Full-Screen
  • Popover
Output
Use Editor Theme
ON
Present image to the user ?
Source Code
#coding: utf-8
import workflow
import ui
import os
import editor
import console


action_in = workflow.get_variable('image_name')
show_f = workflow.get_variable('show_format').lower()

if not action_in:
	console.alert('The file name in attachment is invalid...')
else:
	img_name = os.path.join(editor.get_path().rsplit('/', 1)[0], action_in)
	if os.path.exists(img_name):
		im = ui.Image.named(img_name)
		myview = ui.load_view()
		myview['img_attachment'].image = im
		myview.present(show_f)
	else:
		console.alert('Error', 'The file name does not exist', 'OK', hide_cancel_button=True)