KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache/2.4.62
System : FreeBSD fbsdweb2.web.rcn.net 14.1-RELEASE FreeBSD 14.1-RELEASE releng/14.1-n267679-10e31f0946d8 GENERIC amd64
User : www ( 80)
PHP Version : 8.3.8
Disable Function : NONE
Directory :  /domains/mandarintools/cbom/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /domains/mandarintools/cbom/toruby.pl
#!//e/perl5.005_62/perl

use utf8;

%tonemark = ("a1", "\x{101}", "a2", "\x{e1}", "a3", "\x{1ce}", "a4", "\x{e0}", "a5", "a",
	     "e1", "\x{113}", "e2", "\x{e9}", "e3", "\x{115}", "e4", "\x{e8}", "e5", "e",
	     "i1", "\x{12b}", "i2", "\x{ed}", "i3", "\x{1d0}", "i4", "\x{ec}", "i5", "i",
	     "o1", "\x{14d}", "o2", "\x{f3}", "o3", "\x{1d2}", "o4", "\x{f2}", "o5", "o",
	     "u1", "\x{16b}", "u2", "\x{fa}", "u3", "\x{1d4}", "u4", "\x{f9}", "u5", "u",
	     "v1", "\x{1d6}", "v2", "\x{1d8}", "v3", "\x{1da}", "v4", "\x{1dc}", "v5", "\x{fc}");

%diacritics = ("1", "\x{304}", "2", "\x{301}", "3", "\x{306}", "4", "\x{300}", "5", "");

print '<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=UTF-8">
<STYLE>
RUBY { ruby-align:center }
</STYLE>
<TITLE>Annotated Missionary Scriptures</TITLE>
</HEAD>
<BODY>
<FONT SIZE=+2>
';

open(FD, "scriptures-original2.txt") or die "Can't open";

$line = <FD>;
chomp($line);
print "<CENTER><H1>$line</h1></CENTER>\n";

$lineno = 2;
while ($line = <FD>) {
    if ($lineno == 2) {
	chomp($line);
	$line = "<CENTER><H2>$line</H2></CENTER>\n";
    }

    if ($line =~ m/Bible/) {
	$startbooks = 1;
	print "<table width=\100%>";
    }

    if (!$startbooks && $line =~ m/\w\t+\w/) {
	($first, $second) = split(/\t+/, $line);
	$line = "<table width=100\%><tr><td align=left><font size=+2><b>$first</b></font></td><td align=right><font size=+2><b>$second</b></font></td></tr></table>\n";
    } elsif ($line =~ m/\w\t+\w/) {
	($first, $second) = split(/\t+/, $line);
	if ($line =~ m/Bible/ or $line =~ /Testament/ or $line =~ /Book of Mormon/ or $line =~ /Doctrine/ or 
	    $line =~ m/Pearl of Great Price/) {
	    $line = "<tr><td align=left><font size=+2><b>$first</b></font></td><td align=right><font size=+2><b>$second</b></font></td></tr>\n";
	} else {
	    $line = "<tr><td align=left><font size=+2>$first</font></td><td align=right><font size=+2>$second</font></td></tr>\n";
	}
    }

    $line =~ s/(\p{InCJKUnifiedIdeographs})([a-z]+\d)\s?/"<ruby>" . $1 . "<rt>" . &addmark($2) . "<\/ruby>"/eg;
    print $line, "<BR>";
    $lineno++;
}
close(FD);

print "</BODY></HTML>";




sub addmark {
    my($withnumber) = @_;
    $withnumber =~ s/^\s*//;
    $withnumber =~ s/\s*$//;
    

    # Switch tone number to be next to vowel it will join with
    $withnumber =~ s/ng(\d)$/${1}ng/;
    $withnumber =~ s/n(\d)$/${1}n/;
    $withnumber =~ s/ai(\d)$/a${1}i/;
    $withnumber =~ s/ao(\d)$/a${1}o/;
    $withnumber =~ s/ei(\d)$/e${1}i/;
    $withnumber =~ s/er(\d)$/e${1}r/;
    $withnumber =~ s/ou(\d)$/o${1}u/;

    # Replace vowel+tone number with tone marked vowel

    #$withnumber =~ s/([aeiouv]\d)/$tonemark{$1}/e;
    $withnumber =~ s/v/\x{fc}/;
    $withnumber =~ s/(\d)/$diacritics{$1}/e;
    
    $withnumber .= " ";


    return $withnumber;
}


   

Anon7 - 2021