Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ePUB: xhtml conformity also for missa
Browse files Browse the repository at this point in the history
... now rendering on macOS as well
FAJ-Munich committed Oct 15, 2024
1 parent 3ccef18 commit 20487e9
Showing 17 changed files with 239 additions and 116 deletions.
10 changes: 8 additions & 2 deletions standalone/tools/epubgen2/Ehoras.setup
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@
$priest='0';;
$building='0';;
$lang1='Latin';;
$psalmvar='0';;
$whitebground='0';;
$blackfont='black';;
$smallblack='82 black';;
@@ -12,13 +13,18 @@ $smallfont='63 red';;
$titlefont='113 red';;
$screenheight='1024';;
$textwidth='80';;
$oldhymns='0';;
$nonumbers='0';;
$nofancychars='0';;
$noinnumbers='1';;
$noflexa='0';;

[parameterscheck]
bbtbtcccccccnn
bbtbbtcccccccnnbbbbb

[general]
$expand='psalms';;
$version='Rubrics 1960';;
$version='Rubrics 1960 - 1960';;
$lang2='English';;
$accented='plain';;

38 changes: 38 additions & 0 deletions standalone/tools/epubgen2/Emissa.setup
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[parameters]
$pope='(nomen Papae),(name of Pope)';;
$bishop='(nomen Episcopi),(name of Bishop)';;
$lang1='Latin';;
$whitebground='1';;
$blackfont='black';;
$smallblack='82 black';;
$redfont=' italic red';;
$initiale='150 bold italic red';;
$largefont='113 bold italic red';;
$smallfont='63 red';;
$titlefont='113 red';;
$screenheight='1024';;
$textwidth='80';;
$nofancychars='0';;
$building='0';;

[parameterscheck]
ttobcccccccnnbb

[general]
$version='Rubrics 1960 - 1960';;
$lang2='English';;
$votive='Hodie';;
$rubrics='1';;
$solemn='0';;

[generalcheck]
ooobb

[generalc]
$version1='Rubrics 1960 - 1960';;
$version2='New Mass';;
$lang1='Latin';;
$lang2='Latin';;

[generalccheck]
oooo
28 changes: 17 additions & 11 deletions standalone/tools/epubgen2/EofficiumXhtml.pl
Original file line number Diff line number Diff line change
@@ -21,7 +21,6 @@ package main;
#use CGI::Cookie;;
use CGI::Carp qw(fatalsToBrowser);
use File::Basename;
use LWP::Simple;
use Time::Local;

#use DateTime;
@@ -34,9 +33,16 @@ package main;
our $Hk = 0;
our $Ck = 0;
our $officium = 'Eofficium.pl';
our $version = 'Rubrics 1960';
our $version = 'Rubrics 1960 - 1960';

@versions = ('Trident 1570', 'Trident 1910', 'Divino Afflatu', 'Reduced 1955', 'Rubrics 1960', '1960 Newcalendar');
@versions = (
'Trident - 1570',
'Trident - 1910',
'Divino Afflatu - 1954',
'Reduced - 1955',
'Rubrics 1960 - 1960',
'Rubrica 1960 - 2020 USA/Rubrics 1960 Newcalendar'
);

#***common variables arrays and hashes
#filled getweek()
@@ -215,7 +221,7 @@ ()

#setcookies('horasgp', 'general');
}
if (!$version) { $version = 'Rubrics 1960'; }
if (!$version) { $version = 'Rubrics 1960 - 1960'; }
if (!$lang2) { $lang2 = 'English'; }
$only = ($lang1 =~ $lang2) ? 1 : 0;

@@ -311,7 +317,7 @@ ()
<a href="$date1-3-Prima.html">Prima</a>
&nbsp;&nbsp;
<a href="$date1-4-Tertia.html">Tertia</a>
<br />
<br/>
<a href="$date1-5-Sexta.html">Sexta</a>
&nbsp;&nbsp;
<a href="$date1-6-Nona.html">Nona</a>
@@ -335,7 +341,7 @@ ()

if ($linkmissa) {
print << "PrintTag";
<br />
<br/>
<a href="$date1-9-Missa.html">Missa</a>
PrintTag
}
@@ -374,9 +380,9 @@ sub headline {
}

print << "PrintTag";
<p class="cen"><span class="$daycolorclass">$headline<br /></span>
$comment<br /><br />
<span class="c">$h</span>&nbsp;&nbsp;&nbsp;
<p class="cen"><span class="$daycolorclass">$headline<br/></span>
$comment<br/><br/>
<span class="c">$h</span>&ensp;
<a href="$datep-1-Matutinum.html">&darr;</a>
$date1
<a href="$daten-1-Matutinum.html">&uarr;</a>
@@ -389,7 +395,7 @@ sub headline {
<a href="$date1-3-Prima.html">Prima</a>
&nbsp;&nbsp;
<a href="$date1-4-Tertia.html">Tertia</a>
<br />
<br/>
<a href="$date1-5-Sexta.html">Sexta</a>
&nbsp;&nbsp;
<a href="$date1-6-Nona.html">Nona</a>
@@ -401,7 +407,7 @@ sub headline {

if ($linkmissa) {
print << "PrintTag";
<br />
<br/>
<a href="$date1-9-Missa.html">Missa</a>
PrintTag
}
12 changes: 6 additions & 6 deletions standalone/tools/epubgen2/Ewebdia.pl
Original file line number Diff line number Diff line change
@@ -123,7 +123,7 @@ sub setup {

if ($parmode[$i] =~ /^label/i) {
my $ilabel = $parvalue[$i];
if ($parpar[$i]) { $ilabel = wrap($ilabel, $parpar[$i], "<BR />\n"); }
if ($parpar[$i]) { $ilabel = wrap($ilabel, $parpar[$i], "<br/>\n"); }
$input .= "$ilabel";
$input .= "<INPUT TYPE=HIDDEN NAME=\'I$k\' VALUE=\'$parvalue[$i]\'>\n";

@@ -157,7 +157,7 @@ sub setup {
do_write("$datafolder/gen/$savefile.gen", $pv);
}

$input .= "<TEXTAREA NAME=\'I$k\' ID=\'I$k\' COLS=$size[1] ROWS=$size[0]>$pv</TEXTAREA><BR />\n";
$input .= "<TEXTAREA NAME=\'I$k\' ID=\'I$k\' COLS=$size[1] ROWS=$size[0]>$pv</TEXTAREA><br/>\n";
$input .= "<A HREF='#' onclick='loadrut();'>";
$input .= setfont($dialogfont) . "Load</FONT></A>";

@@ -444,7 +444,7 @@ sub setvrbar {
# #remove auxiliary characters
# $text =~ s/wait[0-9]+//ig;
# $text =~ s/\_/ /g;
# $text =~ s/\{\:.*?\:\}(<BR />)*\s*//g;
# $text =~ s/\{\:.*?\:\}(<br/>)*\s*//g;
# $text =~ s/\{\:.*?\:\}//sg;
# $text =~ s/\`//g;
#
@@ -496,7 +496,7 @@ sub setvrbar {
# #$htmltext .= setfont($blackfont,$text) . "</DIV>\n";
# #if ($only || !columnsel($lang)) {$htmltext .= "</DIV>\n";}
#
# $text =~ s/<BR>/<br \/>/sg;
# $text =~ s/<BR>/<br\/>/sg;
#
# #$text =~ s/\n//g;
# print $text;
@@ -542,8 +542,8 @@ sub longtd {
my $a1 = shift;
my $a2 = shift;

my @a1 = split('<BR />', $a1);
my @a2 = split('<BR />', $a2);
my @a1 = split('<br/>', $a1);
my @a2 = split('<br/>', $a2);
my @b1 = splice(@b1, @b1);
my @b2 = splice(@b2, @b2);
my $i;
38 changes: 19 additions & 19 deletions standalone/tools/epubgen2/epubgen2.sh
Original file line number Diff line number Diff line change
@@ -40,7 +40,7 @@ OPTIONS:
-m Generate Mass propers in addition to office texts.
-r RUBRICS The rubrics to use. Defaults to 1960.
Supported values are: 1570, 1910, DA, 1955, 1960, Newcal, Dominican, Monastic
Supported values are: 1570, 1910, DA, 1955, 1960, Newcal, Dominican
-c FILENAME The cover image to use without path. It must be a file in the data
directory. Defaults to "cover.jpg".
@@ -66,16 +66,16 @@ CDUR=$(pwd)
EPUBDIR=$CDUR/output #output directory, defaults to "output" subdirectory in the folder this script is in.
COVER_FILENAME=cover.jpg #a jpg file name to serve as cover (it has to exist in SOURCEDATADIR) #ascensio.jpg
RUBRICS_CODE=1960
RUBRICS=Rubrics%201960
RUBRICS=Rubrics%201960%20%2D%201960
RUBRICS_NAME=
NOFANCYCHARS=1 #0 or 1; when 1, "fancy" characters such as ℟ ℣ +︎ ✠ ✙︎ are replaced with R. V. + + +
OPTIONAL_KINDLEGEN_PATH=/usr/local/bin/kindlegen #full path to kindlegen executable, if exists, used to convert the resulting EPUB files to MOBI format as well

#constants
#supported rubrics as in Eofficium.pl
ALL_RUBRICS_CODES=(Monastic 1570 1910 DA 1955 1960 Newcal Dominican)
ALL_RUBRICS=("Monastic" "Tridentine 1570" "Tridentine 1910" "Divino Afflatu" "Reduced 1955" "Rubrics 1960" "1960 Newcalendar" "Ordo Praedicatorum")
ALL_RUBRICS_NAME=("_Monastic" "_1570" "_1910" "_DA" "_1955" "" "NC")
ALL_RUBRICS_CODES=(1570 1910 DA 1955 1960 Newcal Dominican)
ALL_RUBRICS=("Tridentine - 1570" "Tridentine - 1910" "Divino Afflatu - 1954" "Reduced - 1955" "Rubrics 1960 - 1960" "Rubrics 1960 - 2020 USA" "Ordo Praedicatorum - 1962")
ALL_RUBRICS_NAME=("_1570" "_1910" "_DA" "_1955" "" "NC" "OP")

YEAR_RE='^[0-9]+$'

@@ -317,10 +317,10 @@ generateHour() {
}

generateHours() {
echo -e "\e[1m:: Starting to generate hours\e[0m"
echo -e "\033[1m:: Starting to generate hours\033[0m"
foreachHourInRange generateHour
echo ""
echo -e "\e[1m:: Finished the generation of hours\e[0m"
echo -e "\033[1m:: Finished the generation of hours\033[0m"
}


@@ -385,15 +385,15 @@ outputYearToFile() {


generateTOCs() {
echo -e "\e[1m:: Starting to create TOCs\e[0m"
echo -e "\033[1m:: Starting to create TOCs\033[0m"

#generate OPF per month
foreachMonthInRange outputMonthToFile

#generate OPF per year
foreachYear outputYearToFile

echo -e "\e[1m:: Finished the creating of TOCs\e[0m"
echo -e "\033[1m:: Finished the creating of TOCs\033[0m"
}

#################################################################################################################
@@ -423,7 +423,7 @@ printf '<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://www.idpf.org/2007/opf" unique-identifier="uuid_id" version="2.0">
<metadata xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:opf="http://www.idpf.org/2007/opf" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:calibre="http://calibre.kovidgoyal.net/2009/metadata" xmlns:dc="http://purl.org/dc/elements/1.1/">
<meta name="cover" content="cover"/><dc:date>'
date --iso-8601
date +"%Y-%m-%dT%H:%M:%S:%z"
printf "</dc:date><dc:title>Breviarium $1</dc:title>
<dc:creator>Divinum Officium</dc:creator>
<dc:publisher></dc:publisher>
@@ -491,15 +491,15 @@ outputYearToFileOPF() {
}

generateOPF() {
echo -e "\e[1m:: Starting to create OPFs\e[0m"
echo -e "\033[1m:: Starting to create OPFs\033[0m"

#generate OPF per month
foreachMonthInRange outputMonthToFileOPF

#generate OPF per year
foreachYear outputYearToFileOPF

echo -e "\e[1m:: Finished the creating of OPFs\e[0m"
echo -e "\033[1m:: Finished the creating of OPFs\033[0m"
}

#Expects OPF_FILENAME to be set.
@@ -679,11 +679,11 @@ createEPUBYear() {
}

createEPUBs() {
echo -e "\e[1m:: Starting to create EPUBs for each month\e[0m"
echo -e "\033[1m:: Starting to create EPUBs for each month\033[0m"
foreachMonthInRange createEPUBMonth
echo -e "\e[1m:: Starting to create EPUBs for each year\e[0m"
echo -e "\033[1m:: Starting to create EPUBs for each year\033[0m"
foreachYear createEPUBYear
echo -e "\e[1m:: Finished the creation of EPUBs\e[0m"
echo -e "\033[1m:: Finished the creation of EPUBs\033[0m"
}


@@ -704,13 +704,13 @@ convertMOBIYear() {
createMOBIs() {
if [[ ! -e "$OPTIONAL_KINDLEGEN_PATH" ]]
then
echo "\e[1m:: KindleGen not found in $OPTIONAL_KINDLEGEN_PATH, skipping the conversion to of MOBI format. \e[0m"
echo "\033[1m:: KindleGen not found in $OPTIONAL_KINDLEGEN_PATH, skipping the conversion to of MOBI format. \033[0m"
else
echo -e "\e[1m:: Starting the conversion to MOBI format for each month\e[0m"
echo -e "\033[1m:: Starting the conversion to MOBI format for each month\033[0m"
foreachMonthInRange convertMOBIMonth
echo -e "\e[1m:: Starting the conversion to MOBI format for each year\e[0m"
echo -e "\033[1m:: Starting the conversion to MOBI format for each year\033[0m"
foreachYear convertMOBIYear
echo -e "\e[1m:: Finished the conversion to MOBI format\e[0m"
echo -e "\033[1m:: Finished the conversion to MOBI format\033[0m"
fi
}

8 changes: 5 additions & 3 deletions web/cgi-bin/DivinumOfficium/RunTimeOptions.pm
Original file line number Diff line number Diff line change
@@ -39,6 +39,7 @@ use constant LEGACY_VERSION_NAMES => {
'Monastic' => 'Monastic - 1963',
'1960 Newcalendar' => 'Rubrics 1960 - 2020 USA',
'Dominican' => 'Ordo Praedicatorum - 1962',

# safeguard switch from missa to horas
'Tridentine - 1910' => 'Tridentine - 1906',
'Ordo Praedicatorum Dominican 1962' => 'Ordo Praedicatorum - 1962',
@@ -52,6 +53,7 @@ use constant LEGACY_MISSA_VERSION_NAMES => {
'Reduced 1955' => 'Reduced - 1955',
'1960 Newcalendar' => 'Rubrics 1960 - 2020 USA',
'Dominican' => 'Ordo Praedicatorum Dominican 1962',

# safeguard switch from horas to missa
'Monastic Tridentinum 1617' => 'Tridentine - 1570',
'Monastic Divino 1930' => 'Divino Afflatu - 1954',
@@ -60,16 +62,16 @@ use constant LEGACY_MISSA_VERSION_NAMES => {
'Tridentine - 1906' => 'Tridentine - 1910',
'Ordo Praedicatorum - 1962' => 'Ordo Praedicatorum Dominican 1962',
};

# exported

sub check_version {
my $v = shift;
my $missa = shift;

if (!$missa) {
return LEGACY_VERSION_NAMES->{$v} || unequivocal($v, 'versions');
}
else {
} else {
return LEGACY_MISSA_VERSION_NAMES->{$v} || unequivocal($v, 'versions');
}
}
6 changes: 3 additions & 3 deletions web/cgi-bin/horas/horas.pl
Original file line number Diff line number Diff line change
@@ -175,11 +175,11 @@ sub resolve_refs {

# Concatenate the expansions of the lines with a line break between each.
push @resolved_lines, '';
my $resolved_block = join "<BR />\n", @resolved_lines;
my $resolved_block = join "<br/>\n", @resolved_lines;

#removes occasional double linebreaks
$resolved_block =~ s/<BR \/>\s*<BR \/>/<BR \/>/g;
$resolved_block =~ s/<\/P>\s*<BR \/>/<\/P>/g;
$resolved_block =~ s/<br\/>\s*<br\/>/<br\/>/ig;
$resolved_block =~ s/<\/P>\s*<br\/>/<\/P>/ig;
return $resolved_block;
}

Loading

0 comments on commit 20487e9

Please sign in to comment.