[sword-devel] Parsing Strong's to support more flexible layout in user interface
Tobias Klein
contact at tklein.info
Sat Nov 9 05:31:46 EST 2019
Hi,
I'm currently working on Strong's support for Ezra Project.
I've been implementing a Strong's parsing functionality that enables
flexible formatting of the Strong's definitions (from StrongsGreek and
StrongsHebrew) in my frontend.
Without this functionality the frontend would have to "dump" the
definition of a Strong's key and it wouldn't have freedom in how the
definition is formatted / layed out.
Having this functionality available, the frontend can work with
individual parts of the Strong's definition and apply specific
formatting and layout.
The parsing divides a Strong's entry into:
- Transcription
- Phonetic transcription
- Definition
- List of references
In case of Ezra Project the formatting looks like this now:
https://raw.githubusercontent.com/tobias-klein/ezra-project/master/screenshots/strongs_formatting_example.png
I'm pasting the definition of my StrongsEntry class below, which is the
base for this implementation (see
https://github.com/tobias-klein/node-sword-interface/blob/master/src/strongs_entry.hpp):
classStrongsEntry
{
public:
StrongsEntry(std::stringkey, std::stringrawEntry);
virtual~StrongsEntry(){}
staticStrongsEntry*getStrongsEntry(sword::SWModule*module, std::stringkey);
std::string rawEntry;
std::string key;
std::string transcription;
std::string phoneticTranscription;
std::string definition;
std::vector<StrongsReference> references;
private:
voidparseFromRawEntry(std::stringrawEntry);
voidparseFirstLine(std::stringfirstLine);
voideraseEmptyLines(std::vector<std::string>&lines);
voidparseDefinitionAndReferences(std::vector<std::string>&lines);
};
Now I'm wondering whether something like this could actually be useful
as part of the Sword engine, since the use case of "flexible Strong's
formatting" may also be relevant for other frontends.
Best regards,
Tobias
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.crosswire.org/pipermail/sword-devel/attachments/20191109/da508dcd/attachment.html>
More information about the sword-devel
mailing list