Editorial Workflows

Links

unlisted 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: Enters a Markdown inline link using the browser URL and title.

The workflow checks for URLs or titles that contain parentheses, so that no conflicts will arise with inline formatting. If there are, links are inserted at the bottom with reference style. The name is specified using a Python script.

Shared by: viticci

Comments: Comment Feed (RSS)

There are no comments yet.

+ Add Comment

Workflow Preview
If: Empty selection ?
Run the block if
Selected Text
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
Stop ?
Stop
  • This Workflow
  • Repeat Block
Show HUD Alert
ON
Message
Select some text!
…End If
If: Empty URL ?
Run the block if
Browser URL
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
Stop ?
Stop
  • This Workflow
  • Repeat Block
Show HUD Alert
ON
Message
Open a URL!
…End If
If: Browser not empty, selection not empty, ( in Title ?
Run the block if
Selected Text
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
If… ?
Run the block if
Browser URL
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
If… ?
Run the block if
Browser Title
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
(
Set Variable ?
Variable Name
initialtext
Value
Sel. Range: Start:Sel. Range: End
Document Text ?
Folded Text
  • Include
  • Replace with:
Set Variable ?
Variable Name
allText
Value
Input
Run Python Script ?
Source Code
#!/usr/bin/python

import sys
import re
import workflow

text = workflow.get_variable('allText')
reflinks = re.findall(r'^\[(\d+)\]: ', text, re.MULTILINE)
if len(reflinks) == 0:
  workflow.set_output(str(1))
else:
  workflow.set_output(str(max(int(x) for x in reflinks) + 1))
Set Variable ?
Variable Name
linkname
Value
Input
Set Variable ?
Variable Name
reflink
Value
Browser URL "Browser Title"
Move Caret ?
Direction
  • Backward
  • Forward
  • Start/End of Document
  • Start/End of Line
  • Number of Characters:
1
Replace Selected Text ?
Replacement Text
[linkname]: reflink
Select Range ?
Range (from:to)
initialtext
Relative to
  • Entire Document
  • Current Selection
Replace Selected Text ?
Replacement Text
[Selected Text][linkname]
Show HUD ?
HUD Text
Link inserted!
Duration
  • 1 Second
  • 2 Seconds
  • 3 Seconds
Icon
  • "Success"
  • "Error"
Stop ?
Stop
  • This Workflow
  • Repeat Block
Show HUD Alert
OFF
Message
Stopped
…End If
…End If
…End If
If: Browser not empty, selection not empty, ( in URL ?
Run the block if
Selected Text
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
If… ?
Run the block if
Browser URL
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
If… ?
Run the block if
Browser URL
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
(
Set Variable ?
Variable Name
initialtext
Value
Sel. Range: Start:Sel. Range: End
Document Text ?
Folded Text
  • Include
  • Replace with:
Set Variable ?
Variable Name
allText
Value
Input
Run Python Script ?
Source Code
#!/usr/bin/python

import sys
import re
import workflow

text = workflow.get_variable('allText')
reflinks = re.findall(r'^\[(\d+)\]: ', text, re.MULTILINE)
if len(reflinks) == 0:
  workflow.set_output(str(1))
else:
  workflow.set_output(str(max(int(x) for x in reflinks) + 1))
Set Variable ?
Variable Name
linkname
Value
Input
Set Variable ?
Variable Name
reflink
Value
Browser URL "Browser Title"
Move Caret ?
Direction
  • Backward
  • Forward
  • Start/End of Document
  • Start/End of Line
  • Number of Characters:
1
Replace Selected Text ?
Replacement Text
[linkname]: reflink
Select Range ?
Range (from:to)
initialtext
Relative to
  • Entire Document
  • Current Selection
Replace Selected Text ?
Replacement Text
[Selected Text][linkname]
Show HUD ?
HUD Text
Link inserted!
Duration
  • 1 Second
  • 2 Seconds
  • 3 Seconds
Icon
  • "Success"
  • "Error"
Stop ?
Stop
  • This Workflow
  • Repeat Block
Show HUD Alert
OFF
Message
Stopped
…End If
…End If
…End If
If: Browser not empty, selection not empty, URL with mobile.twitter ?
Run the block if
Selected Text
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
If… ?
Run the block if
Browser URL
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
If… ?
Run the block if
Browser URL
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
mobile.twitter.com
Generate Text ?
Text
Browser URL
Find / Replace ?
Find
mobile.twitter.com
  • Case-insensitive (A = a)
  • Case-sensitive (A ≠ a)
  • Regular Expression
Replace with
twitter.com
Replace Selected Text ?
Replacement Text
[Selected Text](Input "Browser Title")
Show HUD ?
HUD Text
Link inserted!
Duration
  • 1 Second
  • 2 Seconds
  • 3 Seconds
Icon
  • "Success"
  • "Error"
Stop ?
Stop
  • This Workflow
  • Repeat Block
Show HUD Alert
OFF
Message
Stopped
…End If
…End If
…End If
If: Browser not empty, selection not empty, URL with no ( ) ?
Run the block if
Selected Text
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
If… ?
Run the block if
Browser URL
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
If… ?
Run the block if
Browser URL
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
(
Replace Selected Text ?
Replacement Text
[Selected Text](Browser URL "Browser Title")
Show HUD ?
HUD Text
Link inserted!
Duration
  • 1 Second
  • 2 Seconds
  • 3 Seconds
Icon
  • "Success"
  • "Error"
Stop ?
Stop
  • This Workflow
  • Repeat Block
Show HUD Alert
OFF
Message
Stopped
…End If
…End If
…End If