diff options
| author | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-07-28 12:52:13 +0200 |
|---|---|---|
| committer | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-07-28 12:52:13 +0200 |
| commit | 44472bbe31475a3c672ae003d928d7caffb4b50a (patch) | |
| tree | e74bae03c61b62479ef4f68b046e3345618933c8 /internal/liturgy/citation.go | |
| parent | 626f2275438a37e5cd2efb5964281b9bef5ce8cc (diff) | |
| parent | 7b220084cf3951c8cde0582efdfcf628afc64336 (diff) | |
| download | lectio-44472bbe31475a3c672ae003d928d7caffb4b50a.tar.gz lectio-44472bbe31475a3c672ae003d928d7caffb4b50a.zip | |
Merge branch 'of-offline-migration': offline daily view, remove scrapers
Diffstat (limited to 'internal/liturgy/citation.go')
| -rw-r--r-- | internal/liturgy/citation.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/internal/liturgy/citation.go b/internal/liturgy/citation.go new file mode 100644 index 0000000..2c545c2 --- /dev/null +++ b/internal/liturgy/citation.go @@ -0,0 +1,21 @@ +package liturgy + +import ( + "fmt" + "regexp" + "strings" +) + +// citationRe captures a scripture reference in a trailing "(...)" of a section +// heading, e.g. "Ewangelia (J 20, 1. 11-18)" -> "J 20, 1. 11-18". +var citationRe = regexp.MustCompile(`\((.+)\)\s*$`) + +// ExtractCitation returns the scripture reference carried in a section +// heading's trailing parentheses, or an error when the heading has none. +func ExtractCitation(heading string) (string, error) { + m := citationRe.FindStringSubmatch(heading) + if m == nil { + return "", fmt.Errorf("no reference found in heading: %q", heading) + } + return strings.TrimSpace(m[1]), nil +} |
