Editorial Workflows

Lock Widows & Orphans

public workflow

Install 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 strategically adds nonbreaking spaces to prevent orphans and widows. Orphans and widows are typography terms for a couple types of awkward text wrapping breaks, which have a negative impact on readability.

This workflow can be a bit heavy handed. That’s why I set it up so that you can apply it two ways. If you select text, then the workflow will expand the selection to encompass the nearest full lines (a necessity of the grep search/replace quarries) and only affect them. If you don’t select any text, then the workflow will run on your entire document.

While you may want to only apply it to one paragraph at a time, especialy if you’re still touching up your work, the workflow should be safe to run across your whole document. I did what I could to ensure it won’t insert nonbreaking space glyphs where they don’t belong.

You can even run the workflow repeatedly, and it won’t mess up. That’s because there’s a section of the workflow that first strips out its effects before applying them, preventing the added nonbreaking space glyphs from throwing off the search parameters.

There’s a companion workflow for this one, “Unlock Widows & Orphans,” which is just the queries from the first half of this workflow, which simply allows you to strip out the effects. That’s super useful if you need to go back and edit your copy.

Get “Unlock Widows & Orphans” here: http://www.editorial-workflows.com/workflow/5882681648742400/1xKA-wP6bWk

One last note: Editorial’s grep handling is somewhat limited, so it’s possible I missed something. If I catch it, then I’ll update this workflow.

Shared by: Phil Selman

Comments: Comment Feed (RSS)

There are no comments yet.

+ Add Comment

Workflow Preview
If… ?
Run the block if
Selected Text
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
Extend Selection ?
Direction
  • Backward
  • Forward
  • Both
Unit
  • Start/End of Document
  • Start/End of Line
  • Number of Characters...
1
…End If
Extend Selection ?
Direction
  • Backward
  • Forward
  • Both
Unit
  • Start/End of Document
  • Start/End of Line
  • Number of Characters...
1
Protect Widows ?
Find
([.|!|?]\s[^\s]+) 
  • Case-insensitive (A = a)
  • Case-sensitive (A ≠ a)
  • Regular Expression
Replace with
$1
Protect Orphans ?
Find
&nbsp;([^.|!|?|<|>|=| ]*(\.|!|\?))
  • Case-insensitive (A = a)
  • Case-sensitive (A ≠ a)
  • Regular Expression
Replace with
$1
Prevent Orphans ?
Find
([^.|!|?|<|>|=| ]*(\.|!|\?))
  • Case-insensitive (A = a)
  • Case-sensitive (A ≠ a)
  • Regular Expression
Replace with
&nbsp;$1
Prevent Widows ?
Find
((\.|!|\?) [^ | ]*)
  • Case-insensitive (A = a)
  • Case-sensitive (A ≠ a)
  • Regular Expression
Replace with
$1&nbsp;
Clean Up Comments ?
Find
^(<![^&]+)&nbsp;(.*)$
  • Case-insensitive (A = a)
  • Case-sensitive (A ≠ a)
  • Regular Expression
Replace with
$1 $2
Fix Headers ?
Find
^\s*(<h[^>]*>[^&]*)&nbsp;([^&]*)(&nbsp;)?([^&]*)?(&nbsp;)?
  • Case-insensitive (A = a)
  • Case-sensitive (A ≠ a)
  • Regular Expression
Replace with
$1 $2 $4
Fix Headers pt2 ?
Find
\s*(</h.>)$
  • Case-insensitive (A = a)
  • Case-sensitive (A ≠ a)
  • Regular Expression
Replace with
$1
Replace Selected Text ?
Replacement Text
Input