Editorial Workflows

Bible Verse Block Quote

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: I updated the Bible ESV Block script by by @pfcbenjamin to version 3

Shared by: Wade Allen

Comments: Comment Feed (RSS)

There are no comments yet.

+ Add Comment

Workflow Preview
Selected Text ?
Entire Line(s)
ON
Empty Selection Output
  • No Output
  • All Text
  • Closest Word
Folded Text
  • Include
  • Replace with:
Extend Selection ?
Direction
  • Backward
  • Forward
  • Both
Unit
  • Start/End of Document
  • Start/End of Line
  • Number of Characters...
1
If… ?
Run the block if
Input
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
Change Case ?
  • UPPER CASE
  • lower case
  • Title Case
Set Variable ?
Variable Name
reference
Value
Input
Set Variable ?
Variable Name
passagelink
Value
Get Verse(s) from ESV API ?
Source Code
#coding: utf-8
#!/usr/bin/env python

import urllib2
import re
import sys
import json
import workflow


options = ['include-passage-references=false',
           'include-first-verse-numbers=false',
           'include-verse-numbers=false',
           'include-heading-horizontal-lines=false',
           'include-footnotes=false',
           'include-footnote-body=false',
           'include-short-copyright=false',
           'include-passage-horizontal-lines=false',
           'include-headings=false',
           'include-selahs=false',
           'indent-poetry=false'
           ]

options = '&'.join(options)

p = workflow.get_variable('reference')
passage = p.replace(u'\u2013','-')

passage = passage.split()
passage = '+'.join(passage)
request = urllib2.Request("https://api.esv.org/v3/passage/text/?q=" + passage + '&' + options)
request.add_header('Authorization','Token ca76f7bf26d7b82f9d765305b960d2d0f71f9f6c')

request.get_header('Accept')
response = urllib2.urlopen(request)
page = response.read()

bible = json.loads(page)
bibletext = bible['passages']
bibletext = u", ".join(bibletext)
bibleref = bible['canonical']

bibletext = bibletext.replace('\n', ' ').replace('\r', '')

workflow.set_variable('bible text', bibletext)
workflow.set_variable('reference', bibleref)
Generate Text ?
Text
bible text
Remove Whitespace ?
  • Trim leading/trailing whitespace
  • Remove empty lines
Set Variable ?
Variable Name
scripture
Value
Input
Generate Text ?
Text
(reference ESV) scripture
Prefix / Suffix Lines ?
  • Prefix
  • Suffix
Text
>
Replace Selected Text ?
Replacement Text
Input
Store cursor location ?
Variable Name
cursorlocation
Value
Sel. Range: End
…End If
Document Text ?
Folded Text
  • Include
  • Replace with:
Set Variable ?
Variable Name
doctext
Value
Input