Convert usfm bibles into gemtext (python library/utility)
cross references: Put in parentheses
Zach DeCook 2021-07-08
parent 4b03a40 · commit 04f01be
-rwxr-xr-xusfm2gmi.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/usfm2gmi.py b/usfm2gmi.py
index 7bfef3b..65a0f95 100755
--- a/usfm2gmi.py
+++ b/usfm2gmi.py
@@ -91,6 +91,16 @@ def convert(line):
skip = 1 # verse reference not necessary for inline fn
elif word == '\\f*':
out += ']'
+ # Cross-references (https://ubsicap.github.io/usfm/notes_basic/xrefs.html)
+ elif word == '\\x':
+ out += '('
+ skip = 1 # next character is xref caller
+ elif word == '\\xo':
+ skip = 1 # verse reference not necessary for inline xref
+ elif word in ['\\xt']:
+ continue
+ elif word == '\\x*':
+ out += ')'
# TODO: support Endnotes (\fe and \fe*)
elif word in ['\\ft']:
continue # TODO: fancy formatting of more types