#!/usr/bin/env python # -*- coding: utf-8 -*- import Sword import sys markup = Sword.MarkupFilterMgr(Sword.FMT_HTML) markup.thisown = False library = Sword.SWMgr(markup) target = library.getModule("StrongsHebrew") if not target: print "No module found" sys.exit() vk = Sword.SWKey("05975") target.setKey(vk) print target.renderText()
def __init__(self, markup = Sword.FMT_PLAIN): logger.debug("SwordLibrary - Create a new instance") self.markup = Sword.MarkupFilterMgr(markup) self.markup.thisown = False self.mgr = Sword.SWMgr(self.markup)
for i in range(1, 3): vk.setTestament(i) for j in range(1, vk.bookCount(i) + 1): vk.setBook(j) tmp = {} tmp['name'] = vk.bookName(i, j) tmp['abbr'] = vk.getBookAbbrev() tmp['testament'] = i tmp['bookCount'] = j out.append(tmp) return out locale.setlocale(locale.LC_ALL, 'fr_FR.UTF-8') moduleName = "FreCrampon" outputType = Sword.FMT_PLAIN markup = Sword.MarkupFilterMgr(outputType) markup.thisown = False mgr = Sword.SWMgr(markup) mod = mgr.getModule(moduleName) versification = mod.getConfigEntry("Versification") config = Sword.SWConfig("/usr/share/sword/locales.d/abbr.conf") config.get("Text", "Genesis") getAllBooks(versification) for book in getAllBooks(versification): name = book["name"] config = Sword.SWConfig("/usr/share/sword/locales.d/fr-utf8.conf") print("%s##%s" % (name, config.get("Text", name)))
""" from corediatheke.cpp if ((optionfilters & OP_VARIANTS) && variants) { if (variants == -1) manager.setGlobalOption("Textual Variants", "All Readings"); else if (variants == 1) manager.setGlobalOption("Textual Variants", "Secondary Reading"); } else manager.setGlobalOption("Textual Variants", "Primary Reading"); """ key="Josh 15:21" moduleName="LXX" vk=Sword.VerseKey(key) markup=Sword.MarkupFilterMgr(Sword.FMT_PLAIN) markup.thisown=False mgr = Sword.SWMgr(markup) mod=mgr.getModule(moduleName) if not mod: print( "No module found") sys.exit() mod.setKey(vk) #Look in bindings/objc/src/SwordManager.h for the correct mapping between C++ define and python string. #you may also have to look into specific module code though such as src/modules/filters/osisxlit.cpp: static const char oName[] = "Transliterated Forms"; mgr.setGlobalOption("Strong's Numbers","Off") mgr.setGlobalOption("Cross-references","Off") mgr.setGlobalOption("Morpheme Segmentation","Off") mgr.setGlobalOption("Morphological Tags","Off") mgr.setGlobalOption("Lemmas","Off") mgr.setGlobalOption("Words of Christ in Red","Off")