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: Insert Bible Verse (ESV) as Block Quote
by @pfcbenjamin
::Version 1.2.1::

**Please send any feature requests to me [on Twitter @pfcbenjamin](http://twitter.com/pfcbenjamin).**

This workflow allows a selected Bible reference to be looked up in the English Standard Version, through Crossway's API, and returned as a markdown block quote beneath the reference. The reference is wrapped in a link to the ESV Bible's website.

If no text is selected it will give you the option to select to the beginning of the current line or input a verse.

This version also adds the ESV's copyright info to the end of the document.

For more info on why I built this: https://sweetnessoffreedom.wordpress.com/2014/06/21/using-editorial-on-ios-to-build-the-ultimate-sermon-notes-tool/

Shared by: @pfcbenjamin

Comments: Comment Feed (RSS)

Jonny — 06 Jun 2014
Thanks for this! Another cool idea would be to use the same service to convert "John 3:16" to [Jn. 3:16](http://www.esvbible.org/John%203%3A16/). I'm not smart enough to do it myself... :-)
Andrew — 07 Nov 2014
As a seminarian using Editorial to write papers and sermons in a (reasonably) distraction-free way, thank you! You even used my preferred English version to use in the pulpit. Could you be more awesome?

Yeah, yeah you could. You still need Jesus, just like me. #JesusJuke'd
anonymous — 07 Dec 2014
Thanks! I was just about to write my own workflow for this so you've saved me a bunch of time.

+ Add Comment

Workflow Preview
Selected Text ?
Entire Line(s)
OFF
Empty Selection Output
  • No Output
  • All Text
  • Closest Word
Folded Text
  • Include
  • Replace with:
No Text Selected ?
Run the block if
Input
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
No Text Selected - Prompt ?
Title
No Text Selected.
Message
What would you like to do?
Button 1
Select Line
Output Value
selline
Button 2
Input Reference
Output Value
inputref
Button 3
(don't show)
Output Value
Show Cancel Button
ON
Select the Full Line ?
Run the block if
Input
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
selline
Extend Selection ?
Direction
  • Backward
  • Forward
  • Both
Unit
  • Start/End of Document
  • Start/End of Line
  • Number of Characters...
1
Selected Text ?
Entire Line(s)
ON
Empty Selection Output
  • No Output
  • All Text
  • Closest Word
Folded Text
  • Include
  • Replace with:
…End If
Enter the reference in popup ?
Run the block if
Input
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
inputref
Request Text Input ?
Title
Verse To Look Up:
Initial Text
  • Single Line
  • Multiple Lines
Keyboard Options:
…End If
…End If
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
# Sample code by Christian Wyglendowski found at http://www.esvapi.org/api#verse
# Adapted for Editorial by @pfcbenjamin
# Please read the conditions of use at [ESV Bible Web Service Introduction](http://www.esvapi.org/)
# This script makes use of the non-commercial access component.From the ESV's site: "You can access the ESV text using the key "IP" (without the quotes). This key limits you to 5,000 queries per day from a single IP address. You are bound by the below conditions of use, including the non-commercial aspects"
# Please ensure you are using this within the terms granted by the Crossway.

import urllib
import sys
import workflow
import re

class ESVSession:
    def __init__(self, key):
        options = ['include-short-copyright=0',
                   'output-format=plain-text',
                   'include-passage-horizontal-lines=0',
                   'include-heading-horizontal-lines=0',
                   'include-headings=0',
                   'include-subheadings=0',
                   'include-selahs=0',
                   'line-length=0',
                   'include-passage-references=0',
                   'include-footnotes=0']
        self.options = '&'.join(options)
        self.baseUrl = 'http://www.esvapi.org/v2/rest/passageQuery?key=IP'

    def doPassageQuery(self, passage):
        passage = passage.split()
        passage = '+'.join(passage)
        url = self.baseUrl + '&passage=%s&%s' % (passage, self.options)
        page = urllib.urlopen(url)
        return page.read()

    def PassageLink(self, passage):
    		clean = re.sub('\s','%20',passage)
    		link = 'http://www.esvbible.org/' + clean
    		return link

try:
    key = sys.argv[1]
except IndexError:
    key = 'IP'

bible = ESVSession(key)

p = workflow.get_variable('reference')
passage = p.replace(u'\u2013','-')
bibletext = bible.doPassageQuery(passage)
passagelink = bible.PassageLink(passage)

workflow.set_variable('bible text', bibletext)
workflow.set_variable('passagelink', passagelink)
Generate Text ?
Text
bible text
Remove Whitespace ?
  • Trim leading/trailing whitespace
  • Remove empty lines
Prefix / Suffix Lines ?
  • Prefix
  • Suffix
Text
>
Set Variable ?
Variable Name
quote text
Value
Input
Generate Text ?
Text
[**reference** (ESV)](passagelink) quote 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
Set End of Doc to Include Copyright ?
Run the block if
Input
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
Scripture quotations marked "ESV" are taken from The Holy Bible, English Standard Version. Copyright (C)2001 by [Crossway Bibles](http://www.crosswaybibles.org), a publishing ministry of Good News Publishers. Used by permission. All rights reserved. Text provided by the [Crossway Bibles Web Service](http://www.gnpcb.org/esv/share/services/).
Extend Selection ?
Direction
  • Backward
  • Forward
  • Both
Unit
  • Start/End of Document
  • Start/End of Line
  • Number of Characters...
1
Set Variable ?
Variable Name
docend
Value
Sel. Range: End
Replace Selected Text ?
Replacement Text
doctext Scripture quotations marked "ESV" are taken from The Holy Bible, English Standard Version. Copyright (C)2001 by [Crossway Bibles](http://www.crosswaybibles.org), a publishing ministry of Good News Publishers. Used by permission. All rights reserved. Text provided by the [Crossway Bibles Web Service](http://www.gnpcb.org/esv/share/services/).
Generate Text ?
Text
Scripture quotations marked "ESV" are taken from The Holy Bible, English Standard Version. Copyright (C)2001 by [Crossway Bibles](http://www.crosswaybibles.org), a publishing ministry of Good News Publishers. Used by permission. All rights reserved. Text provided by the [Crossway Bibles Web Service](http://www.gnpcb.org/esv/share/services/).
The extra 345 accounts for new text added ?
Expression
docend-cursorlocation+345
On Error
  • Stop Workflow
  • Output "ERROR"
Result
  • Pass to Next Action
  • Store in Variable:
Move Caret ?
Direction
  • Backward
  • Forward
  • Start/End of Document
  • Start/End of Line
  • Number of Characters:
Input
…End If