Editorial Workflows

Bible Verse Footnote

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 allows a selected Bible reference to be looked up in the English Standard Version, through Crossway's API, and returned as a markdown footnote.

See related workflow for a blockquote format at http://www.editorial-workflows.com/workflow/6398031989571584/a3n-NNsLNc0

Footnote workflow modified from Federico Viticci's "New Footnote" Workflow.

Shared by: @pfcbenjamin

Comments: Comment Feed (RSS)

There are no comments yet.

+ Add Comment

Workflow Preview
Set Variable ?
Variable Name
selectstart
Value
Sel. Range: Start
Set Variable ?
Variable Name
selectend
Value
Sel. Range: End
Selected Text ?
Entire Line(s)
OFF
Empty Selection Output
  • No Output
  • All Text
  • Closest Word
Folded Text
  • Include
  • Replace with:
If… ?
Run the block if
Input
  • 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
No Text Selected.
…End If
If… ?
Run the block if
Input
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
Set Variable ?
Variable Name
reference
Value
Input
Leave Blank ?
Variable Name
footname
Value
Leave Blank ?
Variable Name
bible text
Value
fetches the verse from crossway's API ?
Source Code
#!/usr/bin/env python
#sample code by Christian Wyglendowski found at http://www.esvapi.org/api#verse

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()

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

bible = ESVSession(key)

passage = workflow.get_variable('reference')
bibletext = bible.doPassageQuery(passage)

workflow.set_variable('bible text', bibletext)

cleanfoot = re.sub('\s|:|-','',passage)

workflow.set_variable('footname', cleanfoot)
Generate Text ?
Text
bible text
Remove Whitespace ?
  • Trim leading/trailing whitespace
  • Remove empty lines
Find / Replace ?
Find
  • Case-insensitive (A = a)
  • Case-sensitive (A ≠ a)
  • Regular Expression
Replace with
Set Variable ?
Variable Name
clean text
Value
Input
Move Caret ?
Direction
  • Backward
  • Forward
  • Start/End of Document
  • Start/End of Line
  • Number of Characters:
1
Add FN at bottom ?
Replacement Text
[^footname]: *reference* clean text
Select Range ?
Range (from:to)
selectstart:selectend
Relative to
  • Entire Document
  • Current Selection
Replace Selected Text ?
Replacement Text
reference[^footname]
…End If