aboutsummaryrefslogtreecommitdiff
path: root/lib/citation/render.ml
diff options
context:
space:
mode:
Diffstat (limited to 'lib/citation/render.ml')
-rw-r--r--lib/citation/render.ml19
1 files changed, 18 insertions, 1 deletions
diff --git a/lib/citation/render.ml b/lib/citation/render.ml
index 2b40ab3..d85b050 100644
--- a/lib/citation/render.ml
+++ b/lib/citation/render.ml
@@ -81,10 +81,27 @@ let subst tmpl pairs =
let render st ~names (t : Parse.t) =
let show_num (v : Parse.verse_num) = string_of_int v.Parse.n ^ v.Parse.suffix in
+ (* A range's [last] normally renders as a bare verse number. When it
+ names its own, later chapter ([verse_end.chapter], parse.mli's own
+ citation), it is rendered through the SAME [chapter_verse] template
+ [one_part] below uses for the part's own leading "chapter:verses" --
+ so a style that reconfigures the chapter/verse separator (the "missal
+ convention" comma, {!Colitur_citation.Render}'s own doc comment)
+ renders a cross-chapter jump in that identical convention, not a
+ hardcoded ":". *)
let one_range (r : Parse.verse_range) =
match r.Parse.last with
| None -> show_num r.Parse.first
- | Some l -> subst st.range [ ("first", show_num r.Parse.first); ("last", show_num l) ]
+ | Some (l : Parse.verse_end) ->
+ let last_str =
+ match l.Parse.chapter with
+ | None -> show_num l.Parse.verse
+ | Some c ->
+ subst st.chapter_verse
+ [ ("chapter", string_of_int c); ("chapter_roman", roman_numeral c);
+ ("verses", show_num l.Parse.verse) ]
+ in
+ subst st.range [ ("first", show_num r.Parse.first); ("last", last_str) ]
in
let one_part (p : Parse.part) =
let verses = String.concat st.verse_sep (List.map one_range p.Parse.verses) in