-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Laridian Book Builder export format
This has been tested with Laridian Book Builder 2.1.0.624. Note that the resulting Bibles cannot be opened in the current stable version of Laridian Pocket Bible for Windows yet; to test on Windows you need to remove the `pb_biblebooks` meta tag and convert for an older Laridian version. Also, while interlinear bible export has been tested (in the sense that the Book Builder does not show any errors), the resulting Bible file cannot (yet) be tested in Laridian Pocket Bible for Windows (no Interlinear books supported yet). Therefore, treat this code with a grain of salt. I will re-test this once the new Pocket Bible for Windows version has been released.
- Loading branch information
Showing
5 changed files
with
798 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
...rc/main/java/biblemulticonverter/logos/format/LaridianPocketBibleExtendedInterlinear.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package biblemulticonverter.logos.format; | ||
|
||
import java.io.IOException; | ||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
import biblemulticonverter.data.Versification.Reference; | ||
import biblemulticonverter.format.LaridianPocketBible; | ||
|
||
public class LaridianPocketBibleExtendedInterlinear extends LaridianPocketBible { | ||
|
||
public static final String[] HELP_TEXT = new String[LaridianPocketBible.HELP_TEXT.length + 2]; | ||
|
||
static { | ||
HELP_TEXT[0] = "Export to Laridian Pocket Bible with Interlinear fields from Logos links"; | ||
for (int i = 1; i < LaridianPocketBible.HELP_TEXT.length; i++) { | ||
HELP_TEXT[i] = LaridianPocketBible.HELP_TEXT[i]; | ||
} | ||
HELP_TEXT[HELP_TEXT.length - 2] = "Additionally, any Logos link prefix can be used as interlinear type, by prefixing it with 'LogosLink:'."; | ||
HELP_TEXT[HELP_TEXT.length - 1] = "You will need to edit the generate meta tag in the head, though."; | ||
}; | ||
|
||
@Override | ||
protected InterlinearType parseInterlinearType(int index, String type) { | ||
if (type.startsWith("LogosLink:")) { | ||
return new LogosLinkInterlinearType(index, type.substring(10)); | ||
} | ||
return super.parseInterlinearType(index, type); | ||
} | ||
|
||
public static class LogosLinkInterlinearType extends InterlinearType<List<String>> { | ||
|
||
private static final InterlinearTypePrecalculator<List<String>> LOGOS_LINK_PRECALCULATOR = new InterlinearTypePrecalculator<List<String>>() { | ||
private final LogosLinksGenerator generator; | ||
{ | ||
try { | ||
generator = new LogosLinksGenerator(); | ||
} catch (IOException ex) { | ||
throw new RuntimeException(ex); | ||
} | ||
} | ||
|
||
public List<String> precalculate(boolean nt, Reference verseReference, char[] strongsPrefixes, int[] strongs, String[] rmac, int[] sourceIndices) { | ||
return generator.generateLinks(nt, verseReference, strongsPrefixes, strongs, rmac, sourceIndices); | ||
} | ||
}; | ||
|
||
private final String linkPrefix; | ||
|
||
protected LogosLinkInterlinearType(int index, String linkPrefix) { | ||
super(LOGOS_LINK_PRECALCULATOR, "extra" + (index + 1), "Name for LogosLink:" + linkPrefix + " (edit me), , , , , , sync:\\\\, yes"); | ||
this.linkPrefix = linkPrefix; | ||
} | ||
|
||
@Override | ||
protected List<String> determineValues(List<String> links, boolean nt, Reference verseReference, char[] strongsPrefixes, int[] strongs, String[] rmac, int[] sourceIndices) { | ||
return links.stream().filter(l -> l.startsWith(linkPrefix)).map(l -> l.substring(linkPrefix.length())).collect(Collectors.toList()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.