commit ed91b1e1bc55e5fb0e3cfabadc0d8d90d696fa79 from: Omar Polo date: Wed Aug 24 09:59:38 2022 UTC generate links to raw messages commit - 9301f57b20b07db3d659f81c85af18d3ded31438 commit + ed91b1e1bc55e5fb0e3cfabadc0d8d90d696fa79 blob - 0fe0a0f5dfb51bcd82a1f0fde0cea7aaecf82cc7 blob + c1bbd22f8fa8221f8b916581587c019662354c13 --- Makefile +++ Makefile @@ -12,6 +12,7 @@ all: .mblaze dirs assets dirs: mkdir -p ${OUTDIR}/thread/ + mkdir -p ${OUTDIR}/mbox/ assets: dirs got.png style.css cp got.png ${OUTDIR}/got@2x.png blob - d860664bf2ff908b8879620c2778a0acff41ad24 blob + 36fb387384baf992962694d9168505bc1f28231d --- mexp +++ mexp @@ -38,6 +38,24 @@ sub san { return $str; } +sub genmbox { + my ($fname, $mid) = @_; + + open(my $fh, ">", "$outdir/mbox/$mid.mbox") + or die "can't open $outdir/mbox/$mid.mbox: $!"; + + my $pid = fork(); + die "fork: $!" unless defined $pid; + if ($pid == 0) { + open \*STDOUT, '>&', $fh; + exec('mexport', $fname) + or die "exec mexport: $!"; + } + die "waitpid: $!" if waitpid($pid, 0) == -1; + die "mexport failed with $?" if $? != 0; + # waitpid($pid, 0); +} + my $tid; while (<>) { chomp; @@ -62,6 +80,8 @@ while (<>) { $tid = $mid if $level == 0; + genmbox($fname, $mid); + my $dest = "$outdir/$mid.html"; open(my $fh, '>', "$dest") or die "can't open $dest: $!"; @@ -90,7 +110,9 @@ while (<>) { print $fh "
", san($h), ":
"; print $fh "
", san($v), "
"; } - print $fh ""; + print $fh ""; + print $fh "

Raw message

"; + print $fh ""; my $body = do { local $/ = undef;