diff options
Diffstat (limited to 'Master/texmf-dist/doc/latex/songbook/contrib/crd2sb')
3 files changed, 361 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/songbook/contrib/crd2sb/NothingButTheBlood.crd b/Master/texmf-dist/doc/latex/songbook/contrib/crd2sb/NothingButTheBlood.crd new file mode 100644 index 00000000000..0f3662d7aa2 --- /dev/null +++ b/Master/texmf-dist/doc/latex/songbook/contrib/crd2sb/NothingButTheBlood.crd @@ -0,0 +1,22 @@ +{t:Nothing But the Blood} +{st:Robert Lowry} +{st:Public Domain} +# key: E +# tex: \SBRef{\Hos{} Songbook 1}{\#65} +# tex: \FLineIdx{What can wash away my sin?} +[E]What can [A/E]wash [B/E]a[E]way my sin?[B/D#] +[C#m7]Nothing but the blood of [F#m]Je[F#m/B]-[E]sus. +[E]What can [A/E]make [B/E]me [E]whole again?[B/D#] +[C#m7]Nothing but the blood of [F#m]Je[F#m/B]-[E]sus. + +{soc} +[E]O, [F#m7]precious [G#m7]is the [C#m]flow +[F#m]That [E/G#]makes me [F#m/A]white [B]as [C#m]snow.[B/C#]- [A/B] +[E]No [F#m7]other [G#m7]fount I [C#m]know, +[A]Nothing but the [C#m]blood of [F#m]Je[F#m/B]-[E]sus. +{eoc} + +This is all my righteousness, +Nothing but the blood of Jesus. +This is all my hope and peace, +Nothing but the blood of Jesus. diff --git a/Master/texmf-dist/doc/latex/songbook/contrib/crd2sb/crd2sb b/Master/texmf-dist/doc/latex/songbook/contrib/crd2sb/crd2sb new file mode 100644 index 00000000000..eaae05dfd89 --- /dev/null +++ b/Master/texmf-dist/doc/latex/songbook/contrib/crd2sb/crd2sb @@ -0,0 +1,243 @@ +#!/usr/local/bin/perl
+
+# crd2sb - convert chordpro files to songbook (LaTeX style)
+
+# Usage: crd2sb filename.crd [filename2.crd] . . [filenamen.crd]
+
+# The input files are "*.crd" and the output files are "*.tex" (in the
+# current directory).
+
+# $Id: crd2sb,v 1.9 1997/12/05 19:25:05 abel Exp $
+
+# (C)Copyright 1997 Abel Chow <abel@g2networks.com>
+
+# You may distribute under the terms of the Artistic License,
+# as specified in the relnotes.txt file.
+
+use File::Basename;
+
+$debuglevel = 0;
+$date = localtime;
+
+sub Init
+{
+ $title = "";
+ $key = "";
+ $copyright = "Unknown";
+ $wandm = "Unknown";
+ $sref = "";
+ $ccli = "";
+ $lyrics = "";
+
+ $nextenv = "SBVerse";
+}
+
+sub EndSong
+{
+ unless ($title) {
+ print STDERR "$file:$.: No title defined for song.\n";
+ Init();
+ return;
+ }
+ $ccli = "\\NotCCLIed" if $copyright =~ /\bPublic Domain\b/;
+
+ print STDERR "$file:$.: key undefined for \"$title\".\n" unless $key;
+ print STDERR "$file:$.: copyright info undefined for \"$title\".\n" if $copyright eq "Unknown";
+ print STDERR "$file:$.: author undefined for \"$title\".\n" if $wandm eq "Unknown";
+# print STDERR "$file:$.: scripture ref. undefined for \"$title\".\n" unless $sref;
+ print STDERR "$file:$.: CCLI status undefined for \"$title\".\n" unless $ccli;
+
+ if ($env) {
+ DoEnd($env);
+ }
+
+ print "% This file is machine generated. Do not edit.\n";
+ print "% crd2sb $file\n";
+ print "% created on $date\n";
+ print "\\begin{song}{$title}{$key}\n";
+ print " {$copyright}\n {$wandm}\n {$sref}\n {$ccli}\n";
+ print "$lyrics";
+ print "\\end{song}\n";
+ Init();
+}
+
+sub DoNewSong
+{
+ EndSong();
+ Init();
+}
+
+sub DoSubTitle
+{
+ ($_) = @_;
+ # figure out if it's a copyright
+ if (s/\(C\)// + s/\bCopyright\b//) {
+ s/^\s+//;
+ s/\s+$//;
+ $copyright = $_;
+ return;
+ }
+ if (/Public Domain/) {
+ $copyright = $_;
+ return;
+ }
+ s/^W&M://;
+ s/^\s+//;
+ s/\s+$//;
+ $wandm = $_;
+}
+
+sub DoComment
+{
+ ($_) = @_;
+ print STDERR "$file:$.: > $_\n" if $debuglevel > 0;
+ if (($p) = /^tex:\s*(.*)/) {
+ $lyrics .= "$p\n";
+ return;
+ }
+ if (($p) = /^note:\s*(.*)/) {
+ $lyrics .= "\\SBMargNote{$p}\n";
+ return;
+ }
+ if (($p) = /^intro:\s*(.*)/) {
+ $p =~ s/#/\$\\sharp\$/g;
+ $p =~ s/b/\$\\flat\$/g;
+ $p =~ s/\|/\$|\$/g;
+ $lyrics .= "\\SBIntro{\\ChFont $p}\n";
+ return;
+ }
+ if (/^section:/) {
+ $nextenv = "SBSection";
+ return;
+ }
+ # figure out if there's a CCLI ref anywhere
+ $ccli = "\\CCLIed" if /\bccli\b/i;
+ # key setting
+ if (/^\s*key:\s*(.*)/) {
+ my($k) = $1;
+ if ($k !~ /^[A-G]\S*/) {
+ print STDERR "$file:$.: invalid key $k\n";
+ }
+ $k =~ s/#/\$\\sharp\$/g;
+ $k =~ s/b/\$\\flat\$/g;
+ $key = $k;
+ return;
+ }
+ $sref = $1 if /^\s*sref:\s*(.*)/;
+}
+
+sub DoBegin
+{
+ my($myenv) = @_;
+ printf STDERR "$file:$.: missing env $env" if $env;
+ $env = $myenv;
+ $lyrics .= "\\begin{$env}\n";
+ $first = 1;
+}
+
+sub DoEnd
+{
+ print STDERR "$file:$.: mismatched quote\n" if $quote;
+ $quote = 0;
+ printf STDERR "$file:$.: missing env $env\n" unless ($env);
+ $lyrics .= "\\end{$env}\n";
+ $env = "";
+}
+
+unless (@ARGV) {
+ print "usage: crd2sb filename.crd [filename2.crd] ... [filenamen.crd]\n"
+}
+
+Init();
+foreach $file (@ARGV) {
+ ($base, $path, $type) = fileparse($file, '\.crd');
+ unless ($type) {
+ print STDERR "$file: not a Chordpro (*.crd) file\n";
+ next;
+ }
+ $outfile = "$base.tex";
+ print STDERR "#### $file -> $outfile ####\n"
+ if $debuglevel > 0;
+ unless (open(INFILE, $file)) {
+ print STDERR "$file: $!\n";
+ exit;
+ }
+ close(STDOUT);
+ unless (open(STDOUT, ">$outfile")) {
+ print STDERR "$outfile: $!\n";
+ exit;
+ }
+ while (<INFILE>) {
+ if (/^#\s+(.*)/) {
+ DoComment($1);
+ next;
+ }
+ next if /^#/;
+ # directive
+ if (m/^\s*{([^\}:]+)(:\s*([^\}]*))?}/) {
+ # title
+ if ($1 eq "title" || $1 eq "t") {
+ $title = $3; next;
+ }
+ if ($1 eq "subtitle" || $1 eq "st") {
+ DoSubTitle($3); next;
+ }
+ if ($1 eq "comment" || $1 eq "c") {
+ DoComment($3); next;
+ }
+ # new_song
+ if ($1 eq "new_song" || $1 eq "ns") {
+ DoNewSong(); next;
+ }
+ if ($1 eq "start_of_chorus" || $1 eq "soc") {
+ DoBegin("SBChorus"); next;
+ }
+ if ($1 eq "end_of_chorus" || $1 eq "eoc") {
+ DoEnd("SBChorus"); next;
+ }
+ next;
+ }
+ if (/{/ || /}/) {
+ print STDERR "$file:$.: unmatched brace\n";
+ }
+
+ # strip blank spaces and comments
+ s/\s+/ /;
+ s/^\s//;
+ s/\s$//;
+ s/&/\\&/;
+ unless ($_) { # blank line
+ DoEnd() if $env;
+ next;
+ }
+ while (/"/) { # "
+ if ($quote) {
+ $quote = 0 if (s/"/\'\'/); # " }
+ }
+ else {
+ $quote = 1 if (s/"/\`\`/); # " }
+ }
+ }
+ # protect the parens in chords
+ s/(\[[^\[\]]*)\(/$1</g;
+ s/\)([^\[\]]*\])/>$1/g;
+ s/\(/{\\em /g;
+ s/\)/}/g;
+ tr/\<\>/\(\)/;
+
+ s/\|/\$|\$/g;
+ s/\[([^\[\]]*)\]-/\\Ch{$1}{\\SBem}/g;
+ s/\[([^\[\]]*)\]([A-Za-z0-9,;:.!"'`]+)/\\Ch{$1}{$2}/g; #'`
+ s/\[([^\[\]]*)\]/\\Ch{$1}{}/g;#}}
+ s/\.\.\./\\ldots{}/g;
+
+ unless ($env) {
+ DoBegin($nextenv) unless $env;
+ $nextenv = "SBVerse";
+ }
+ $lyrics .= "\n" if $env && !$first;
+ $first = 0;
+ $lyrics .= "$_\n";
+ }
+ DoNewSong();
+}
diff --git a/Master/texmf-dist/doc/latex/songbook/contrib/crd2sb/crd2sb.txt b/Master/texmf-dist/doc/latex/songbook/contrib/crd2sb/crd2sb.txt new file mode 100644 index 00000000000..82d07892155 --- /dev/null +++ b/Master/texmf-dist/doc/latex/songbook/contrib/crd2sb/crd2sb.txt @@ -0,0 +1,96 @@ +$Id: crd2sb.txt,v 1.3 1997/11/21 21:38:35 abel Exp $ +(C)Copyright 1997 Abel Chow <abel@g2networks.com> + +What does ``crd2sb'' do? + +usage: crd2sb filename.crd + +``crd2sb'' takes Chordpro songs and generates + + What's the format of a `crd' file? + +---------------------------------------------------------------------- + +Typically, a song file looks like: + +{t:Song Title} +{st:Author} +{st:(C)Copyright information} +# key: G +# sref: ScriptRef 3:16 +# CCLI +# intro: G D C D +[|][G]This [Bm]is a [|][C]song. +[|][Dsus]La, la, [|][D]la, la, la. +[|][G]This [Bm]is a [|][C]song. +[|][Dsus]This is a[|D]nother line.[|][Dsus] [/] [D] [Dmaj7][|][D] + +{soc} +[|][G]This is the [|][D]cho[Dsus]-[|][D]-[A]rus. +[|][Am]This is the [|][G]cho[D]rus. +[|][G]This is the [|][D]cho[Dsus]-[D]-[|][A]rus. +[Am]This [|][C]is the [|][Gsus]cho[|][G]rus. +{eoc} + +[|][G]This [Bm]is the [|][C]second verse. +[|][Dsus]La, la, [|][D]la, la, la ... + +---------------------------------------------------------------------- + +Generally, if you have multiple chord changes within a word, you'll +want to use the [chord]- structure. This will put a dash in the +chordbook output (but not the wordbook or overhead versions). + +---------------------------------------------------------------------- + + Comment Directives + +Comments are any line that begins with `#'. Certain directives are +embedded in the comments so that Chordpro doesn't see them (but they +can be parsed by ``crd2sb''). + +The currently supported comment directives are: + +key, to specify the key of the song, e.g. +# key: G + +section, for when you want a section defined instead of a verse, e.g. +# section: + +note, \SBMargNote{} +# note: 1997 Missions Conference Theme Song + +tex, a catchall for putting TeX in the file +# tex: \CBPageBrk + +intro, for \SBIntro +# intro: |G D C| + +---------------------------------------------------------------------- + + Supported Chordpro Directives "{directive:args}" + +{title:Title}, {t:Title} -> title of song +{subtitle:Subtitle}, {st:Subtitle} -> used for author, copyright +{comment:This is a comment.}, {c:This is a comment} -> ignored +{new_song}, {ns} -> ends current song, starts a new song +{start_of_chorus}, {soc} -> Beginning delimiter for chorus. +{end_of_chorus}, {eoc} -> Ending delimiter for chorus + +---------------------------------------------------------------------- + + Chordpro/SongBook.sty Mappings + +[Asus]word -> \Ch{Asus}{word} +[Asus]- -> \Ch{Asus}{\SBem} +[Asus][A] -> \Ch{Asus}{}\Ch{A}{} +(abc) -> {\em abc} +... -> \ldots + +---------------------------------------------------------------------- + + To Do + +- Create example file exercising all the features. +- Explain [|]. +- Rewrite docs. |