lyricutils/
lib.rs

1// Copyright 2026 The lyricweb Authors.
2// This project is dual-licensed under Apache 2.0 and MIT terms.
3// See LICENSE-APACHE and LICENSE-MIT for details.
4
5mod abc;
6mod music_xml;
7
8pub use crate::{abc::tunebook_to_open_lyrics, music_xml::music_xml_to_open_lyrics};
9use openlyrics::types::{Lines, VerseContent};
10
11fn lines_to_open_lyrics(verse_lyrics: Vec<String>) -> Lines {
12    let mut contents = Vec::new();
13    for line in verse_lyrics {
14        if line.is_empty() {
15            continue;
16        }
17        if !contents.is_empty() {
18            contents.push(VerseContent::Br);
19        }
20        contents.push(VerseContent::Text(line));
21    }
22    Lines {
23        contents,
24        ..Default::default()
25    }
26}