Skip to content

Commit

Permalink
Merge pull request #4 from digitalbias/better-verse-references
Browse files Browse the repository at this point in the history
global verse tags
  • Loading branch information
digitalbias authored May 13, 2022
2 parents ae84d74 + c413498 commit cf9aa28
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/scripture_extract.ex
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,8 @@ defmodule ScriptureExtract do
def extract_verse(result) do
verse_number = get_result_value(:verse_number, result)
scripture_text = get_result_value(:scripture_text, result)
"#{verse_number} #{scripture_text} ^#{verse_number}\n\n"
verse_reference = get_verse_reference(result)
"#{verse_number} #{scripture_text} ^#{verse_reference}\n\n"
end

defp get_result_value(:book_id, [_, book_id, _, _, _, _, _, _, _]) do
Expand All @@ -203,4 +204,10 @@ defmodule ScriptureExtract do
defp get_result_value(:scripture_text, [_, _, _, _, _, _, _, _, scripture_text]) do
scripture_text
end

defp get_verse_reference([_, _, _, _, _, book_title, chapter_number, verse_number, _]) do
"#{book_title}chap#{chapter_number}ver#{verse_number}"
|> String.replace(" ", "")
|> String.downcase(:ascii)
end
end

0 comments on commit cf9aa28

Please sign in to comment.