Frontends:Diatheke

From CrossWire Bible Society
Revision as of 18:22, 6 April 2016 by David Haslam (talk | contribs) (How do I use diatheke/CLI?: [http://en.wikipedia.org/wiki/Standard_streams#Standard_error_.28stderr.29 stderr])

Jump to: navigation, search

What is diatheke?

Diatheke is a very simple command line interface (CLI) front-end to the SWORD Project's Bible software library. Essentially, "diatheke" is the stuff contained within the file "corediatheke.cpp" in the apps/console/diatheke directory of the SWORD source tree. Corediatheke.cpp contains only one function that is intended to be called from any program using diatheke, and that function performs exactly one lookup in the SWORD library per call. Examples of calls would be a query for a verse (or verse list/range), a search, a request for a list of modules, etc.

Where's the name 'diatheke' come from?

Diatheke means 'testament' or 'commandment'. And diatheke (the program) was originally a command line application. commandment... command line app... It's a pun.

How is diatheke useful to me?

Probably it isn't, but there are a number of front-ends to diatheke (yes, front-ends to a front-end) that are of use. These include:

  • diatheke/TCL: a BibleBot for eggdrop that interfaces with diatheke/CLI
  • diatheke/CGI: a Perl/CGI interface to diatheke/CLI
  • HANDiatheke: a Palm PQA interface to diatheke/CGI
  • ActiveDiatheke: an ActiveX control (.OCX) interface to SWORD

The above four are no longer under active development.

How do I get diatheke?

This section needs updating.

To get the very latest version, grab the SWORD source tree from our SVN repository using the URL: https://crosswire.org/svn/sword/trunk

   e.g.
   $ svn checkout https://crosswire.org/svn/sword/trunk sword

If you don't want to use SVN, you can try grabbing a recent release from ftp://ftp.crosswire.org/pub/sword/source/

The Sword utilities for Windows are also installed when Xiphos is installed. These include a copy of diatheke.exe

For diatheke/CLI and diatheke/CGI you can download version 4.0 from:

For diatheke/TCL and HANDiatheke you can download version 2.0 from ftp://ftp.crosswire.org/pub/sword/frontend/diatheke/diatheke-2.0.tar.gz.

For ActiveDiatheke you can download a preliminary version from ftp://ftp.crosswire.org/pub/sword/frontend/diatheke/ActiveDiatheke.zip.

How do I use diatheke/CLI?

Calling diatheke without any parameters will result in the command line syntax help being output to stderr.

The query_key (-k) must be the last argument because all further arguments are added to the key.

Examples

The following are a few examples of calling diatheke from the command line: (booknames can be abbreviated, providing this avoids ambiguity)

Retrieve Acts ch 10 diatheke -b KJV -k "Acts 10"
First five verses of above diatheke -b KJV -m 5 -k "Acts 10"
Acts chapters 1 and 2 diatheke -b KJV -k "Acts 1-2"
Genesis 1:1 diatheke -b KJV -k G 1:1
Galatians 1:1 w/ Strong's (if available) diatheke -b KJV -o n -k "Ga 1:1"
I Corinthians 1:1 (also "ic 1:1") diatheke -b KJV -o n -k "1c 1:1"
Revelation 1:1-1:7 diatheke -b KJV -k "Rev 1:1-7"
Revelation 1:1 diatheke -b KJV -m 1 -k "R 1:1-7"
Revelation 1:1,1:3,1:7 as HTML (w/ <p>, <i>, etc. tags) diatheke -b KJV -f HTML -k R 1:1,3,7
verses with "my people", quotations optional diatheke -b KJV -s phrase -k "my people"
verses with "skin" and "bones" diatheke -b KJV -s multiword -k skin bones
verses with "church" or "assembly" diatheke -b KJV -s regex -k "church | assembly"
Strong's Greek 3056 diatheke -b StrongsGreek -k 3056
Definition of "horn" in Two Babylons diatheke -b 2BabDict -k horn
Entry for John 1:1 in Family Bible Notes diatheke -b Family -k Jn 1:1
Entry for "Lion" in Scripture Alphabet Of Animals diatheke -b SAOA -k "Lion"
Entry for "olive-tree" in Easton's Bible Dictionary diatheke -b Easton -k olive-tree
Matthew 24 from Westcott Hort Greek NT transliterated into Latin script diatheke -b WHNU -t Latin -o mn -k "Mt 24"

Diatheke output

The plain text output of diatheke marks any OSIS highlight elements (e.g. <hi type="italic">n</hi>) by wrapping the highlighted text between asterisks (e.g. *n*). It does this whatever the value of the type attribute.

Output formats

Valid output_format values are: CGI, GBF, HTML, HTMLHREF, LaTeX, OSIS, RTF, ThML, XHTML, and plain text (default).

Output encodings

Valid output_encoding values are: Latin1, UTF8 (default), UTF16, HTML, and RTF.

Tools that use Diatheke

AutoKey script for The SWORD Project

Ryan (Adyeth) has developed a script for the AutoKey 0.6x utility to do paste Bible text given a reference. It works with OpenOffice, plain text editors, or any other Linux program where you might need to paste scripture passages. It requires Diatheke in order to function. You can download it from his website.