commit 584d65d8be6b5848ab341614963a118676d263aa from: Omar Polo date: Wed Aug 24 14:17:45 2022 UTC use nested list for the threading more idiomatic and works better on text browsers too! commit - e588f9d0bf1075d57cc3210767e066bfc76b3c41 commit + 584d65d8be6b5848ab341614963a118676d263aa blob - 725f605f6ba88ebd61e5d2a49f24619b9d8f258f blob + 797e5aa6783dea7190e7121cf4810a8f8bcafdd6 --- mkindex +++ mkindex @@ -11,6 +11,8 @@ die 'Set $OUTDIR' unless defined $outdir; mkdir $outdir; my $tfh; +my $threads_seen = 0; +my $last_level = 0; my $logo = <‹ Back to the index"; print $tfh "

"; - print $tfh "
Thread:
$subj
"; + print $tfh "
Thread:
$subj
"; print $tfh "\n"; - print $tfh "
\n"; + # print $tfh "
    \n"; } sub endthread { - print $tfh "
\n"; + say $tfh "" x $last_level; + say $tfh "
\n"; endpage($tfh); close($tfh); + + $last_level = 0; } sub entry_raw { - my ($fh, $mid, $level, $date, $from, $subj) = @_; + my ($fh, $sep, $mid, $level, $date, $from, $subj) = @_; + my $new_thread = $level == 0; - my $class = ""; - $class = "reply indent-$level" unless $level == 0; - print $fh "
"; + say $fh "\n" x ($last_level - $level) if $last_level > $level; + say $fh "\n
$sep" if $threads_seen && $new_thread; + + if ($new_thread) { + nextthread($mid, $subj); + say $fh "
"; + } + + if ($last_level < $level) { + say $fh "
  • \n
      "; + } elsif ($last_level == 0) { + say $fh "
        "; + } + + print $fh "
      • "; print $fh "

        "; print $fh " "; print $fh "$from"; @@ -83,12 +101,12 @@ sub entry_raw { print $fh "

        "; print $fh "$subj"; print $fh "

        "; - print $fh "
  • \n"; + print $fh "\n"; } sub entry { - entry_raw(\*STDOUT, @_); - entry_raw($tfh, @_); + entry_raw(\*STDOUT, "
    ", @_); + entry_raw($tfh, "", @_); } initpage(\*STDOUT, "Game of Trees Mail Archive"); @@ -104,7 +122,6 @@ print < EOF -my $threads_seen = 0; while (<>) { chomp; m/^[^ ]+ <([^>]+)> (.+)(\d{4}-\d{2}-\d{2} \d{2}:\d{2}) <([^>]+)> (.*)/; @@ -124,20 +141,14 @@ while (<>) { $subj =~ s/\s+/ /g; $subj =~ s/\s+$//g; - my $new_thread = $indent eq " "; - say "
    " if $threads_seen && $new_thread; - if ($new_thread) { - nextthread($mid, $subj); - say "
    "; - } - - $threads_seen = 1; - entry($mid, $level, $date, $from, $subj); + $last_level = $level; + $threads_seen = 1; } if ($threads_seen) { - say "
    " ; + say "" x $last_level; + say ""; endthread(); } blob - 08feda81eeeffe5cb75954085b5ef040ad19f188 blob + d320d6b334a2a74fedb869a86a7bb53c275594e0 --- style.css +++ style.css @@ -65,7 +65,7 @@ hr { } .thread { - margin: 2rem 0; + margin: 1rem 0; } .thread p { @@ -80,6 +80,15 @@ hr { text-decoration: underline; } +.thread ul { + padding-left: 1rem; + list-style: none; +} + +.thread > ul ul { + border-left: 1px dashed #cacaca; +} + .mail { padding: 0.5rem 5px; } @@ -98,18 +107,6 @@ hr { white-space: pre; } -.mail.indent-1 { padding-left: 15px; } -.mail.indent-2 { padding-left: 25px; } -.mail.indent-3 { padding-left: 35px; } -.mail.indent-4 { padding-left: 45px; } -.mail.indent-5 { padding-left: 55px; } -.mail.indent-6 { padding-left: 65px; } -.mail.indent-7 { padding-left: 75px; } -.mail.indent-8 { padding-left: 85px; } -.mail.indent-9 { padding-left: 95px; } -.mail.indent-10 { padding-left: 105px; } - - footer { margin-top: 70px; border-top: 1px solid #333;