commit: 3b2b05378fddf7bab07308f09cdf47a4aa78a0f3
parent aa0014169da560e1c64447df54523eb6a6379ce9
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Tue, 14 Mar 2023 12:43:22 +0100
notes_index.pm: Format with perltidy
Diffstat:
1 file changed, 15 insertions(+), 9 deletions(-)
diff --git a/notes_index.pm b/notes_index.pm
@@ -1,8 +1,12 @@
#!/usr/bin/env perl
# Copyright 2023 Haelwenn (lanodan) Monnier <contact@hacktivis.me>
# SPDX-License-Identifier: MIT
-use File::Find; # dev-perl/URI
-use URI::Escape; # dev-lang/perl
+
+# dev-lang/perl
+use File::Find;
+
+# dev-perl/URI
+use URI::Escape;
my @content;
@@ -11,7 +15,7 @@ sub wanted {
$fn =~ s@^\./@@;
- if($fn !~ /^(index.xhtml|\.)$/) {
+ if ( $fn !~ /^(index.xhtml|\.)$/ ) {
push @content, $fn;
}
@@ -20,7 +24,7 @@ sub wanted {
chdir('./notes/');
-find( \&wanted, './');
+find( \&wanted, './' );
print '<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
@@ -39,7 +43,7 @@ print '<!DOCTYPE html>
<tbody>
';
-foreach(sort(@content)) {
+foreach ( sort(@content) ) {
my $raw = $_;
# try_files $uri $uri.shtml $uri.html $uri.xhtml $uri/ =404;
@@ -49,16 +53,18 @@ foreach(sort(@content)) {
my $escaped = uri_escape_utf8($fn);
$escaped =~ s@%2F@/@;
- my $size = (lstat($raw))[7];
+ my $size = ( lstat($raw) )[7];
my $now = `git log -1 --format="format:%ai" -- "$raw"`;
# thousand separation
my $size_pp = $size;
- while ($size_pp =~ s/(\d+)(\d{3})/$1 $2/){};
+ while ( $size_pp =~ s/(\d+)(\d{3})/$1 $2/ ) { }
- printf " <tr><td><a href=\"%s\">%s</a></td><td data-value=\"%s\" data-type=\"int\">%s B</td><td>%s</td></tr>\n", $escaped, $fn, $size, $size_pp, $now;
-};
+ printf
+" <tr><td><a href=\"%s\">%s</a></td><td data-value=\"%s\" data-type=\"int\">%s B</td><td>%s</td></tr>\n",
+ $escaped, $fn, $size, $size_pp, $now;
+}
print ' </tbody>
</table>