user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
201566ee5242811a3f5998f5bcf839f1eb65896a blob 3913 bytes (raw)

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
 
#!/usr/bin/env perl
# Copyright (C) 2014-2021 all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
#
# Stupid script to make HTML from preformatted, utf-8 text versions,
# only generating links for http(s).  Markdown does too much
# and requires indentation to output preformatted text.
use strict;
use warnings;
use PublicInbox::Linkify;
use PublicInbox::Hval qw(ascii_html);
my %xurls;
for (qw[lei(1)
	lei-add-external(1)
	lei-blob(1)
	lei-config(1)
	lei-convert(1)
	lei-daemon-kill(1)
	lei-daemon-pid(1)
	lei-forget-external(1)
	lei-import(1)
	lei-init(1)
	lei-ls-external(1)
	lei-ls-label(1)
	lei-overview(7)
	lei-p2q(1)
	lei-q(1)
	lei-tag(1)
	public-inbox.cgi(1)
	public-inbox-compact(1)
	public-inbox-config(5)
	public-inbox-convert(1)
	public-inbox-daemon(8)
	public-inbox-edit(1)
	public-inbox-glossary(7)
	public-inbox-httpd(1)
	public-inbox-imapd(1)
	public-inbox-index(1)
	public-inbox-init(1)
	public-inbox-learn(1)
	public-inbox-mda(1)
	public-inbox-nntpd(1)
	public-inbox-overview(7)
	public-inbox-purge(1)
	public-inbox-v1-format(5)
	public-inbox-v2-format(5)
	public-inbox-watch(1)
	public-inbox-xcpdb(1)
]) {
	my ($n) = (/([\w\-\.]+)/);
	$xurls{$_} = "$n.html";
	$xurls{$n} = "$n.html";
}

for (qw[copydatabase(1) xapian-compact(1)]) {
	my ($n) = (/([\w\-\.]+)/);
	$xurls{$_} = ".$n.1.html"
}

for (qw[make(1) flock(2) setrlimit(2) vfork(2) tmpfs(5)]) {
	my ($n, $s) = (/([\w\-]+)\((\d)\)/);
	$xurls{$_} = "http://www.man7.org/linux/man-pages/man$s/$n.$s.html";
}

for (qw[git(1)
	git-am(1)
	git-apply(1)
	git-config(1)
	git-credential(1)
	git-daemon(1)
	git-fast-import(1)
	git-fetch(1)
	git-filter-branch(1)
	git-format-patch(1)
	git-gc(1)
	git-http-backend(1)
	git-imap-send(1)
	git-init(1)
	git-send-email(1)
	gitrepository-layout(5)
]) {
	my ($n) = (/([\w\-\.]+)/);
	$xurls{$_} = "https://kernel.org/pub/software/scm/git/docs/$n.html"
}

for (qw[
	sd_listen_fds(3)
	systemd(1)
	systemd.unit(5)
	systemd.socket(5)
]) {
	my ($n) = (/([\w\-\.]+)/);
	$xurls{$_} = "https://www.freedesktop.org/software/systemd/man/$n.html";
}

$xurls{'netrc(5)'} = 'https://manpages.debian.org/stable/ftp/netrc.5.en.html';
$xurls{'mbsync(1)'} =
	'https://manpages.debian.org/stable/isync/mbsync.1.en.html';
$xurls{'offlineimap(1)'} =
	'https://manpages.debian.org/stable/offlineimap/offlineimap.1.en.html';
$xurls{'spamc(1)'} =
	'https://spamassassin.apache.org/full/3.4.x/doc/spamc.html';
$xurls{'grok-pull'} =
	'https://git.kernel.org/pub/scm/utils/grokmirror/grokmirror.git' .
	'/tree/man/grok-pull.1.rst';
$xurls{'git-filter-repo(1)'} = 'https://github.com/newren/git-filter-repo'.
			'/blob/master/Documentation/git-filter-repo.txt';
$xurls{'ssoma(1)'} = 'https://ssoma.public-inbox.org/ssoma.txt';
$xurls{'cgitrc(5)'} = 'https://git.zx2c4.com/cgit/tree/cgitrc.5.txt';
$xurls{'prove(1)'} = 'https://perldoc.perl.org/prove.html';
$xurls{'mbox(5)'} = 'https://manpages.debian.org/stable/mutt/mbox.5.en.html';

my $str = do { local $/; <STDIN> };
my ($title) = ($str =~ /\A([^\n]+)/);
if ($str =~ /^NAME\n\s+([^\n]+)/sm) {
	# don't link to ourselves
	$title = $1;
	if ($title =~ /([\w\.\-]+)/) {
		delete $xurls{$1};
	}
}
$title = ascii_html($title);
my $l = PublicInbox::Linkify->new;
$str = $l->linkify_1($str);
$str = ascii_html($str);

# longest matches, first
my @keys = sort { length($b) <=> length($a) } keys %xurls;
my $xkeys = join('|', map { quotemeta } @keys);
$str =~ s,(?<![>\w_])($xkeys)(?!(?:[\w<\-]|\.html)),
	qq(<a\nhref=").$xurls{$1}.qq(">$1).($2//'').'</a>',sge;

$str = $l->linkify_2($str);

print '<html><head>',
  qq(<meta\nhttp-equiv="Content-Type"\ncontent="text/html; charset=utf-8"\n/>),
  "<title>$title</title>",
  "</head><body><pre>",  $str , '</pre></body></html>';
STDOUT->flush;

# keep mtime on website consistent so clients can cache
if (-f STDIN && -f STDOUT) {
	my @st = stat(STDIN);
	utime($st[8], $st[9], \*STDOUT);
}
debug log:

solving 201566ee ...
found 201566ee in public-inbox.git

user/dev discussion of public-inbox itself

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://public-inbox.org/meta
	git clone --mirror http://czquwvybam4bgbro.onion/meta
	git clone --mirror http://hjrcffqmbrq6wope.onion/meta
	git clone --mirror http://ou63pmih66umazou.onion/meta

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 meta meta/ https://public-inbox.org/meta \
		meta@public-inbox.org
	public-inbox-index meta

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.mail.public-inbox.meta
	nntp://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/inbox.comp.mail.public-inbox.meta
	nntp://ie5yzdi7fg72h7s4sdcztq5evakq23rdt33mfyfcddc5u3ndnw24ogqd.onion/inbox.comp.mail.public-inbox.meta
	nntp://4uok3hntl7oi7b4uf4rtfwefqeexfzil2w6kgk2jn5z2f764irre7byd.onion/inbox.comp.mail.public-inbox.meta
	nntp://news.gmane.io/gmane.mail.public-inbox.general
 note: .onion URLs require Tor: https://www.torproject.org/

code repositories for project(s) associated with this inbox:

	https://80x24.org/public-inbox.git

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git