Struct gabc_parser::GabcFile [−][src]
pub struct GabcFile<'a> { pub attributes: Vec<(&'a str, &'a str)>, pub syllables: Vec<Syllable<'a>>, }
Struct representing an entire gabc file.
Fields
attributes: Vec<(&'a str, &'a str)>
This file's attributes, e.g. "name: Populus Sion", as key/value tuples
syllables: Vec<Syllable<'a>>
This file's Syllable
s
Methods
impl<'a> GabcFile<'a>
[src]
impl<'a> GabcFile<'a>
pub fn new(gabc_input: &str) -> GabcFile
[src]
pub fn new(gabc_input: &str) -> GabcFile
Create a new GabcFile
from well-formed gabc input.
Examples
let s = "name:Test; %% (c1) Hel(e.)lo(hi~) (::)"; let f = GabcFile::new(s); assert_eq!(f.attributes[0], ("name", "Test")); assert_eq!(f.syllables.len(), 4); //clefs currently produce an empty syllable
pub fn as_json(&self) -> String
[src]
pub fn as_json(&self) -> String
Translate this GabcFile
into JSON.
pub fn as_lilypond(&self) -> String
[src]
pub fn as_lilypond(&self) -> String
Translate this GabcFile
into a well-formed Lilypond file, by translating its text and music
and inserting them into a template derived from
http://lilypond.org/doc/v2.18/Documentation/snippets/templates#templates-ancient-notation-template-_002d-modern-transcription-of-gregorian-music
pub fn ly_notes(&self) -> String
[src]
pub fn ly_notes(&self) -> String
Extract the notes of this file into well-formed Lilypond music, with a newline between each syllable
Examples
let s = "name:Test; %% (c1) Hel(e.)lo(hi~) (::)"; let f = GabcFile::new(s); assert_eq!(f.ly_notes(), r#" d' g'(a') \finalis "#);
pub fn ly_lyrics(&self) -> String
[src]
pub fn ly_lyrics(&self) -> String
Extract the text of this file into well-formed Lilypond lyrics, inserting " -- " to join syllables where appropriate.
Examples
let s = "name:Test; %% (c1) Hel(e.)lo(hi~) (::)"; let f = GabcFile::new(s); assert_eq!(f.ly_lyrics(), " Hel -- lo ");