Metadata-Version: 2.1
Name: BibleOrgSys
Version: 0.0.9
Summary: Bible Organisational System — load, check, and/or export Bible files/folders
Home-page: http://freely-given.org/Software/BibleOrganisationalSystem/
Author: Robert Hunt
Author-email: Freely.Given.org+BOS@gmail.com
License: GPLv3
Project-URL: Source Code, https://github.com/openscriptures/BibleOrgSys/
Keywords: Bible index book chapter verse USFM USX
Platform: UNKNOWN
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Religion
Classifier: Topic :: Religion
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Operating System :: OS Independent
Requires-Python: >=3.7
Description-Content-Type: text/markdown


**Bible Organisational System** / **BibleOrgSys** / **BOS**

A library of modules for importing and processing various book/chapter/verse (BCV) texts,
including Bibles of course, but also other related BCV materials like Bible commentaries.

NOTE: This packaging is still being tested following massive restructuring,
and is not necessarily fully functional until it is marked as v0.1.0 or higher.
We also have hopes to improve documentation before v0.2.0.

A future package of apps that use the BOS is also planned for release.
After that point, we also hope to release Docker and Snap versions.

This software has been developed in small chunks of spare time since 2010
(so it's not necessarily well-thought out, and definitely not polished).
However, it has been tested on hundreds of Bible filesets,
including USFM, OSIS, USX, USFX, and many other import formats.

This software forms the basis of the online Bible Drop Box service
hosted at http://Freely-Given.org/Software/BibleDropBox/.

This package will not reach v1.0.0 until versification mapping is added.

The API will not become fixed/stable until the v1.0.0 release.

No attempt at all has been made at memory or speed optimisations
and this is not planned until after the release of v1.0.0.

Here is a simple **USFM to USX converter** using BibleOrgSys:

```
#!/usr/bin/env python3
#
# USFM2USX.py (minimal version)
#
# Command-line app to export a USX (XML) Bible.
#
# Copyright (C) 2019-2020 Robert Hunt
# Author: Robert Hunt <Freely.Given.org+BOS@gmail.com>
# License: See gpl-3.0.txt
#
'''
A short command-line app as part of BOS (Bible Organisational System) demos.
This app inputs any known type of Bible file(s) from disk
    and then exports a USX version in the (default) OutputFiles folder
        (inside the BibleOrgSys folder in your home folder).

Note that this app can be run from using the command:
        USFM2USX.py path/to/fileOrFolder

You can discover the available command line parameters with
        USFM2USX.py --help

This app also demonstrates how little code is required to use the BOS
    to load a Bible (in any of a large range of formats — see UnknownBible.py)
    and then to export it in your desired format (see options in BibleWriter.py).
'''
from BibleOrgSys import BibleOrgSysGlobals
from BibleOrgSys.UnknownBible import UnknownBible

PROGRAM_NAME = "USFM to USX (minimal)"
PROGRAM_VERSION = '0.04'

# Configure basic Bible Organisational System (BOS) set-up
parser = BibleOrgSysGlobals.setup( PROGRAM_NAME, PROGRAM_VERSION )
parser.add_argument( "inputFolderpath", help="path/to/folder of USFM files" )
BibleOrgSysGlobals.addStandardOptionsAndProcess( parser )

# Do the actual Bible load and export work that we want
unknownBible = UnknownBible( BibleOrgSysGlobals.commandLineArguments.inputFolderpath )
loadedBible = unknownBible.search( autoLoadAlways=True, autoLoadBooks=True ) # Load all the books if we find any
if not isinstance( loadedBible, str ): # i.e., not an error message
    loadedBible.toUSX2XML() # Export as USX files (USFM inside XML)
    print( f"\nOutput should be in {BibleOrgSysGlobals.DEFAULT_WRITEABLE_OUTPUT_FOLDERPATH.joinpath( 'BOS_USX2_Export/' )}/ folder." )

# Do the BOS close-down stuff
BibleOrgSysGlobals.closedown( PROGRAM_NAME, PROGRAM_VERSION )
```

A short command-line app as part of BOS (Bible Organisational System) demos.
This app inputs any known type of Bible file(s)
    and then exports a USX version in the (default) OutputFiles folder
        (inside the BibleOrgSys folder in your home folder).

This app can be run using the command:
        `USFM2USX.py`

You can discover the version with
        `USFM2USX.py --version`

You can discover the available command line parameters with
        `USFM2USX.py --help`

    e.g., for verbose mode
        `USFM2USX.py --verbose path/to/fileOrFolder`
    or using the abbreviated option
        `USFM2USX.py -v path/to/fileOrFolder`

This app also demonstrates how little actual code is required to use the BOS
    to load a Bible (in any of a large range of formats — see UnknownBible.py)
    and then to export it in your desired format (see options in BibleWriter.py).

The BOS is developed and well-tested on Linux (Ubuntu) but also runs on Windows (although not so well tested).

See https://ubsicap.github.io/usfm/ for more information about USFM.

See https://ubsicap.github.io/usx/ for more information about USX.


