App-Music-ChordPro

 view release on metacpan or  search on metacpan

t/380_roundtrip.t  view on Meta::CPAN

#! perl

use Test::More tests => 1;
use ChordPro::Config::Properties;
use File::LoadLines;

# Take a big properties file, convert to data and dump.
my $orig = Data::Properties->new;
my $lines = loadlines(\*DATA);
$orig->parse_lines( $lines , '<data>' );
my $sorig = $orig->dump;

# Load the dump into a new properties file.
my $cfg = Data::Properties->new;
$cfg->parse_lines( [ split( /[\r\n]+/, $sorig ) ], '<dump>' );

# Should be identical.
is_deeply( $cfg->data, $orig->data );

__DATA__
# Configuration for ChordPro.

# Includes. These are processed first, before the rest of
# the config file.
#
# "include" takes a list of either filenames or preset names.
include.0 = "guitar"

# General settings, to be changed by legacy configs and
# command line.
settings {
  # Titles flush: default center.
  titles = "center"
  # Columns, default one.
  columns = 1
  # Suppress empty chord lines.
  # Overrides the -a (--single-space) command line options.
  suppress-empty-chords = true
  # Suppress blank lyrics lines.
  suppress-empty-lyrics = true
  # Suppress chords.
  # Overrides --lyrics-only command line option.
  lyrics-only = false
  # Memorize chords in sections, to be recalled by [^].
  memorize = false
  # Chords inline.
  # May be a string containing pretext %s posttext.
  # Defaults to "[%s]" if true.
  inline-chords = false
  # Chords under the lyrics.
  chords-under = false
  # Transcoding.
  transcode = null
  # Always decapoize.
  decapo = false
  # Chords parsing strategy.
  # Strict (only known) or relaxed (anything that looks sane).
  chordnames = "strict"
  # Allow note names in [].
  notenames = false
}

# Metadata.
# For these keys you can use {meta key ...} as well as {key ...}.
# If strict is nonzero, only the keys named here are allowed.
# If strict is zero, {meta ...} will accept any key.
# Important: "title" and "subtitle" must always be in this list.
# The separator is used to concatenate multiple values.
metadata {
  keys = [
	"title" "subtitle" "artist" "composer" "lyricist" "arranger"
	"album" "copyright" "year" "sorttitle"
	"key" "time" "tempo" "capo" "duration"
  ]
  strict = true
  separator = "; "
}

# Printing chord diagrams.
# auto= automatically add unknown chords as empty diagrams.
# show= prints the chords used in the song.
#         all= all chords used.
#         user= only prints user defined chords.
# sorted= order the chords by key.
diagrams {
    auto     =  false
    show     =  "all"
    sorted   =  false
}

# Diagnostig messages.
diagnostics {
    format = "\"%f\", line %n, %m\n\t%l"
}

# Table of contents.
contents = [
  {
    fields   = [ "songindex" ]
    label    = "Table of Contents"
    line     = "%{title}"
    fold     = false
    omit     = false
  }
  {
    fields   = [ "sorttitle" "artist" ]
    label    = "Contents by Title"
    line     = "%{title}%{artist| - %{}}"
    fold     = false
    omit     = false
  }
  {
    fields   = [ "artist" "sorttitle" ]
    label    = "Contents by Artist"
    line     = "%{artist|%{} - }%{title}"
    fold     = false
    omit     = true



( run in 1.154 second using v1.01-cache-2.11-cpan-800906f7e73 )