Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
b460257
Execute make silently
Oct 10, 2025
9a4bf4c
Merge remote-tracking branch 'upstream/main'
Oct 10, 2025
7443c2a
#16: Represent hierarchy detail_type -> Folders, etc. on category pages
Oct 29, 2025
645d9e9
#16: Add testing directory for module tests
Nov 7, 2025
34b1d4e
#16: Enhance Film.pm for secondary categories
Nov 7, 2025
c2db5e0
#16: Refactor secondary_categorysections - categorysections_inv
Nov 10, 2025
5650bfe
#16: Adapt Vocab.pm filmsectionlist(), encapsulate default detail ty…
Nov 11, 2025
4de8078
#16: perltidy
Nov 11, 2025
4cc101a
Mask quotes in category page titles
Nov 11, 2025
9bf0971
#16: Fix missing ware filmsections in category template
Nov 11, 2025
f03eb25
Add and use vocab_name()
Nov 14, 2025
70a4309
Add Vocab_folderlist.t and Folder_get_doc_count.t
Nov 29, 2025
1da05d0
#28: Create new module Film::Sections and move section methods here
Nov 15, 2025
98d399b
#16 / #17: Running code
Nov 29, 2025
0c4c20f
Move obsolete scripts to old/
Nov 30, 2025
f539fa1
#34: Use standards (utf8::all, autodie, no use lib)
Dec 1, 2025
4f4154d
Fix testing Film->label() calls; add id() test
Dec 5, 2025
adac05b
#23: Add Film status()
Nov 14, 2025
caf4335
#12: Exclude online films from films() list
Dec 5, 2025
0bbc2ac
#27: Refactor variable names film_id, first_img
Dec 5, 2025
226d832
#24: Display the number of images per film section
Dec 5, 2025
ac9ffb3
#24: Do not show total image counts for secondary categories
Dec 5, 2025
a8520f5
Add Film->valid with tests
Dec 9, 2025
27f937f
#22: Improve category page display; add $section->film() and $section…
Dec 14, 2025
0bd1d81
perltidy
Dec 14, 2025
abdbba1
#19: Add links to microfilms
Dec 14, 2025
2b05dc4
Remove code for #19 - issue postponed
Dec 16, 2025
a64d968
pm20/pm20-dataproc#8: Fix up-to-now unused definitions
Dec 16, 2025
96bce89
#19: Add specific link to subject/ware/geo film section lists
Dec 30, 2025
b964248
#38: Sort ware film sections alphabetically
Dec 30, 2025
501f303
#18: Add explanations about the coverage von secondary categories
Jan 2, 2026
c324a82
#18: Gray plus italic for incomplete filmsections
Jan 12, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions category_def.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@ geo:
detail:
subject:
title:
en: Subject archives folders
de: Sacharchiv Mappen
en: Subject archives
de: Sacharchiv
ware:
title:
en: Commodities/wares archives folders
de: Warenarchiv Mappen
en: Commodities/wares archives
de: Warenarchiv
ordered_by:
en: by wares
de: nach Waren
subject:
prov: hwwa
title:
Expand All @@ -22,8 +25,11 @@ subject:
detail:
geo:
title:
en: Countries-subject archives folders
de: Länder-Sacharchiv Mappen
en: Countries-subject archives
de: Länder-Sacharchiv
ordered_by:
en: by countries
de: nach Ländern
ware:
prov: hwwa
title:
Expand All @@ -33,5 +39,5 @@ ware:
detail:
geo:
title:
en: Commodities/wares archives folders
de: Warenarchiv Mappen
en: Commodities/wares archives
de: Warenarchiv
6 changes: 4 additions & 2 deletions count_film_images.pl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@

use strict;
use warnings;
use utf8;
use autodie;
use utf8::all;

use Data::Dumper;
##use Data::Dumper::Names;
Expand Down Expand Up @@ -49,7 +50,8 @@
# findbuch input
my $findbuch_file =
$filmdata_root->child( $set . '_' . $collection . '.json' );
my $findbuch_data = from_json( $findbuch_file->slurp ) || die "not found";
my $findbuch_data = decode_json( $findbuch_file->slurp_raw )
|| die "not found";

my $last_film_id = 0;
foreach my $entry ( @{$findbuch_data} ) {
Expand Down
114 changes: 93 additions & 21 deletions create_category_pages.pl
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@

use strict;
use warnings;
use utf8;

use lib './lib';
use autodie;
use utf8::all;

use Carp;
use Data::Dumper;
Expand All @@ -30,8 +29,6 @@
use ZBW::PM20x::Folder;
use ZBW::PM20x::Vocab;

binmode( STDOUT, ":encoding(UTF-8)" );

##Readonly my $WEB_ROOT => path('/tmp/category');
Readonly my $WEB_ROOT => path('../web/category');
Readonly my $KLASSDATA_ROOT => path('../data/klassdata');
Expand Down Expand Up @@ -162,8 +159,11 @@

my %filmsections;
foreach my $filming (qw/ 1 2/) {
$filmsections{$filming} =
[ $master_voc->filmsectionlist( $category_id, $filming ) ];
$filmsections{$filming} = [
$master_voc->filmsectionlist(
$category_id, $filming, $detail_type
)
];
}

my $folder_count =
Expand All @@ -184,7 +184,8 @@
$category_type eq 'ware'
? $firstletter
: $master_voc->subheading( $lang, $firstletter );
push( @lines, '', "### $subhead <a name='id_$firstletter'></a>", '' );
push( @lines, '', "#### $subhead <a name='id_$firstletter'></a>",
'' );
push( @tabs, { startchar => $firstletter } );
$firstletter_old = $firstletter;
}
Expand Down Expand Up @@ -317,6 +318,19 @@
#
###########################

# data structure %category_data:

# category_type
# category_id # defines page
# detail_type
# folder
# lines
# de|en
# filming_loop
# de|en
# filming
# filmsection_loop

my %category_data;

print "\nCollect data for folders\n";
Expand Down Expand Up @@ -460,7 +474,7 @@
# prepend subheading
my $subheading =
$detail_voc->subheading( $lang, $firstletter ) || $firstletter;
$text .= "\n\n### $subheading\n\n";
$text .= "\n\n#### $subheading\n\n";

# all text line for this subheading
$text .= join( "\n", @{ $lines_ref->{$firstletter} } );
Expand All @@ -479,12 +493,13 @@

print "\n\nCollect data for film sections\n";

# only top level for the country-subject and ware archives
foreach my $category_type (qw/ geo ware /) {
# now for all top level pages
foreach my $category_type (qw/ geo subject ware /) {
print "\nfilm sections category_type: $category_type\n";

# master vocabulary reference
$master_voc = ZBW::PM20x::Vocab->new($category_type);
my $master_type = $master_voc->vocab_name;

foreach my $lang (@LANGUAGES) {
print " lang: $lang\n";
Expand All @@ -493,9 +508,9 @@
my @detail_types =
sort keys %{ $definitions_ref->{$category_type}{detail} };
foreach my $detail_type (@detail_types) {
next if $category_type eq 'geo' and $detail_type eq 'ware';

print " detail_type: $detail_type\n";
my $detail_voc = ZBW::PM20x::Vocab->new($detail_type);
my $def_ref = $definitions_ref->{$category_type}->{detail}{$detail_type};
my $detail_title = $def_ref->{title}{$lang};

Expand All @@ -507,57 +522,102 @@
foreach my $filming (qw/ 1 2 /) {
my $filming_ref = $filming_def_ref->{$filming};

# filmsections for the master / detail combination (works in either
# normal or inversed hierarchical order)
my @filmsectionlist =
$master_voc->filmsectionlist( $category_id, $filming );
$master_voc->filmsectionlist( $category_id, $filming,
$detail_type );

# how to deal deal wth mission information depends ...
# how to deal deal with missing information depends ...
if ( not scalar(@filmsectionlist) > 0 ) {
if ( $filming eq '1'
and $category_data{$category_type}{$category_id}{$detail_type}
{folder}{complete} )
{
## is ok
} else {
## in which cases should a warning be issued?
## warn "no film data for $category_id in filming $filming\n";
}
next;
}

my @filmsection_loop;
foreach my $section (@filmsectionlist) {
## TODO is this correct? includes position and R/L!
my $film_id = substr( $section->{'@id'}, 25 );
my $entry = {
my $section_id = substr( $section->{'@id'}, 25 );

my $section_label =
$section->label( $lang, $detail_voc ) || $section->{title};

my $entry = {
"is_$lang" => 1,
filmviewer_url => $section->{'@id'},
film_id => $film_id,
first_img => $section->{title},
section_id => $section_id,
section_label => $section_label,
image_count => $section->img_count,
};
if ( $section->is_filmstartonly ) {
$entry->{is_filmstartonly} = 1;
}
push( @filmsection_loop, $entry );
}

# sort ware entries alphabetically
if ( $detail_type eq 'ware' ) {
my $uc = Unicode::Collate->new();
@filmsection_loop =
sort { $uc->cmp( $a->{'section_label'}, $b->{'section_label'} ) }
@filmsection_loop;
}

my %filming_data = (
"is_$lang" => 1,
detail_title => $detail_title,
filming_title => $filming_ref->{title}{$lang},
legal => $filming_ref->{legal}{$lang},
filmsection_loop => \@filmsection_loop,
total_number_of_images =>
$master_voc->film_img_count( $category_id, $filming ),
);

# remove image count for ware section on geo pages
# or geo sections on subject pages
if ( ( $master_type eq 'geo' and $detail_type eq 'ware' )
or ( $master_type eq 'subject' and $detail_type eq 'geo' ) )
{
delete $filming_data{total_number_of_images};
}

push( @filmings, \%filming_data );
} # $filming

if ( scalar(@filmings) ) {
$category_data{$category_type}{$category_id}{$detail_type}
{filming_loop}{$lang} = \@filmings;
}

# add data for special text about secondary categories
if ( ( $master_type eq 'geo' and $detail_type eq 'ware' )
or ( $master_type eq 'subject' and $detail_type eq 'geo' ) )
{
my $collection = $detail_type eq 'ware' ? 'wa' : 'sh';
my %suppl = (
label => $master_voc->label( $lang, $category_id ),
detail_title => $detail_title,
ordered_by => $def_ref->{ordered_by}{$lang},
filmlist1 => "/film/h1_$collection.de.html",
filmlist2 => "/film/h2_$collection.de.html",
);
$category_data{$category_type}{$category_id}{$detail_type}
{secondary_category}{$lang} = \%suppl;
} # secondary_category
} # scalar(@filmings)
} # $category_id
} # $detail_type
} # $lang
}

###print "\n## size inc. film: ", total_size(\%category_data) / (1024*1024), "\n";
###path('/tmp/category.dat')->spew(Dumper \%category_data); exit;

print "\n\nOutput of individual category pages\n\n";

Expand Down Expand Up @@ -593,8 +653,19 @@
if ( defined $filming_loop_ref ) {
$data{filming_loop} = $filming_loop_ref;
}
push( @detail_data, \%data );

# supplemental data for secondary category
## TODO fix ugly construct
if ( defined $category_ref->{$detail_type}{secondary_category} ) {
$data{is_secondary_category} = 1;
foreach
my $key (qw[ label ordered_by detail_title filmlist1 filmlist2 ])
{
$data{$key} =
$category_ref->{$detail_type}{secondary_category}{$lang}{$key};
}
}
push( @detail_data, \%data );
} # $detail_type

# actual output
Expand All @@ -617,6 +688,7 @@ sub output_category_page {
$PROV{ $definitions_ref->{$category_type}{prov} }{name}{$lang};
my $signature = $master_voc->signature($id);
my $label = $master_voc->label( $lang, $id );
$label =~ s/"/\\"/g;
my $backlinktitle =
$lang eq 'en'
? 'Category Overview'
Expand Down
3 changes: 2 additions & 1 deletion create_euipo.pl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@

use strict;
use warnings;
use utf8;
use autodie;
use utf8::all;

use Data::Dumper;
use JSON;
Expand Down
11 changes: 6 additions & 5 deletions create_filmlists.pl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@

use strict;
use warnings;
use utf8;
use autodie;
use utf8::all;

use Data::Dumper;
use JSON;
Expand All @@ -17,7 +18,7 @@
my $filmdata_root = path('../data/filmdata');
my $img_file = $filmdata_root->child('img_count.json');
my $ip_hints =
path('../web/templates/fragments/ip_hints.de.md.frag')->slurp_utf8;
path('../web/templates/fragments/ip_hints.de.md.frag')->slurp;

my %page = (
h => {
Expand Down Expand Up @@ -72,7 +73,7 @@
);

# TEMPORARY: remove path
my $img_count = decode_json( $img_file->slurp );
my $img_count = decode_json( $img_file->slurp_raw );
my %img_cnt;
foreach my $key ( keys %{$img_count} ) {
my $shortkey = substr( $key, 18 );
Expand All @@ -90,7 +91,7 @@
my $zotero_file = $filmdata_root->child("zotero.$page_name.json");
my %zotero_film;
if ( -f $zotero_file ) {
%zotero_film = %{ decode_json( $zotero_file->slurp ) };
%zotero_film = %{ decode_json( $zotero_file->slurp_raw ) };
}

# some header information for the page
Expand Down Expand Up @@ -119,7 +120,7 @@
$filmfile = $filmdata_root->child( $page_name . '.json' );
}
my @film_sections =
@{ decode_json( $filmfile->slurp ) };
@{ decode_json( $filmfile->slurp_raw ) };

# iterate through the list of film sections (from the excel file)
foreach my $film_section (@film_sections) {
Expand Down
5 changes: 2 additions & 3 deletions create_filmviewer_links.pl
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@

use strict;
use warnings;
use utf8;

use lib './lib';
use autodie;
use utf8::all;

use Data::Dumper;
use JSON;
Expand Down
8 changes: 3 additions & 5 deletions create_folder_list.pl
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@

use strict;
use warnings;
use utf8;

use lib './lib';
use autodie;
use utf8::all;

use Data::Dumper;
use HTML::Template;
Expand All @@ -22,7 +21,6 @@
use YAML;
use ZBW::PM20x::Folder;

binmode( STDOUT, ":utf8" );
$Data::Dumper::Sortkeys = 1;

Readonly my $FOLDER_DATA => path('/pm20/data/rdf/pm20.extended.jsonld');
Expand Down Expand Up @@ -268,7 +266,7 @@ sub load_ids {
my $coll_id_ref = shift or die "param missing";

# create a list of numerical keys for each collection
my $data = decode_json( $FOLDER_DATA->slurp );
my $data = decode_json( $FOLDER_DATA->slurp_raw );
foreach my $entry ( @{ $data->{'@graph'} } ) {
$entry->{identifier} =~ m/^(co|pe|sh|wa)\/(\d{6}(?:,\d{6})?)$/;
push( @{ $coll_id_ref->{$1} }, $2 );
Expand Down
Loading