X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=html.pl;h=3d9cfce0e96fcec5c2542e6ee1011e4f403af5c6;hb=626163e24773f07bb9131a80a3a111f052b64f24;hp=b6f4861b9da58ece73cfa35909bdaafc845e379c;hpb=5457430c95ec95ca258f3bf977b533ae823dade5;p=koha-bibliografija
diff --git a/html.pl b/html.pl
index b6f4861..3d9cfce 100755
--- a/html.pl
+++ b/html.pl
@@ -601,7 +601,7 @@ debug 'department_category_author' => $department_category_author;
sub department_html {
- my ( $fh, $department, $type, $label ) = @_;
+ my ( $fh, $department, $type, $label, $csv_fh ) = @_;
print $fh qq|$label
\n|;
@@ -614,10 +614,33 @@ sub department_html {
next unless @biblionumber;
- my $label = $category_label->{$category} || 'Bez kategorije';
- print $fh qq|$label
\n
\n|;
+ my $cat_label = $category_label->{$category} || 'Bez kategorije';
+ print $fh qq|$cat_label
\n\n|;
+
+ foreach my $bib_num ( @biblionumber ) {
+ my @li = li_biblio( $bib_num );
+ my $li_html = join('', @li);
+ $li_html =~ s{}{}gs;
+ print $fh $li_html;
+
+ next unless $csv_fh;
+
+ my $year = $li[1];
+ my @html;
+ foreach ( split(/}{} ) {
+ s{\s+}{ }gs;
+ $html[$1] = $_;
+ } else {
+ warn "SKIPPED: Can't find col in [$_] from $li[4]" unless m/^<[^>]+>$/;
+ }
+ }
+ my $html = join("\t", @html);
- print $fh li_biblio( $_ ) foreach @biblionumber;
+ $html =~ s{?[^>]*>}{}gs;
+ $html =~ s{\s+$}{}gs;
+ print $csv_fh "$bib_num\t$year\t$type\t$label\t$category\t$cat_label\t$html\n";
+ }
print $fh qq|
|;
}
@@ -644,16 +667,24 @@ foreach my $department ( sort keys %$department_category_author ) {
}
html_year_selection $fh => @authids;
+ my $csv_fh;
+ if ( $department eq 'AAA_ukupno' ) {
+ open($csv_fh, '>:encoding(utf-8)', "html/departments/$department.csv");
+ }
+
my $i = 0;
while ( $i < $#toc_type_label ) {
my $type = $toc_type_label[$i++] || die "type";
my $label = $toc_type_label[$i++] || die "label";
- department_html( $fh, $department, $type, $label );
+ department_html( $fh, $department, $type, $label, $csv_fh );
}
+ close($csv_fh) if $csv_fh;
+
print $fh html_end;
close($fh);
rename "html/departments/$dep_file.new", "html/departments/$dep_file.html";
+
}
print $dep_fh qq|\n|, html_end;
close($dep_fh);