From c413498ffed0a59c0b85d37797501043c4e4fef3 Mon Sep 17 00:00:00 2001 From: David Mitchell Date: Thu, 12 May 2022 22:19:57 -0600 Subject: [PATCH] global verse tags --- lib/scripture_extract.ex | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/scripture_extract.ex b/lib/scripture_extract.ex index 56189b0..b7c9714 100644 --- a/lib/scripture_extract.ex +++ b/lib/scripture_extract.ex @@ -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 @@ -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