projects
/
~bandali
/
bndl.org
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
txt2html: support extracting publish/update dates (now restored)
[~bandali/bndl.org]
/
txt2html
diff --git
a/txt2html
b/txt2html
index
5b0acb8
..
e6dc30b
100644
(file)
--- a/
txt2html
+++ b/
txt2html
@@
-96,6
+96,7
@@
sub linkify {
my $txt = do { local $/; <STDIN> };
my $txt = do { local $/; <STDIN> };
+
my $title = html_esc($txt =~ /\A([^\n]+)/);
$title =~ s/^\s+|\s+$//g;
if ($opt_lang eq 'fa') {
my $title = html_esc($txt =~ /\A([^\n]+)/);
$title =~ s/^\s+|\s+$//g;
if ($opt_lang eq 'fa') {
@@
-103,7
+104,11
@@
if ($opt_lang eq 'fa') {
} else {
$title .= ' — bandali' if $title !~ /bandali/;
}
} else {
$title .= ' — bandali' if $title !~ /bandali/;
}
-my ($url) = $txt =~ /(?:plain text|متن ساده): (.*)\r?\n?\z/;
+
+my ($upd, $pub, $url) = $txt =~ /(.*)\r?\n(.*)\r?\n(.*)\r?\n?\z/;
+($upd) = $upd =~ /(?:updated|ویرایش): (.*)/ if $upd;
+($pub) = $pub =~ /(?:published|انتشار): (.*)/ if $pub;
+($url) = $url =~ /(?:plain text|متن ساده): (.*)/ if $url;
$url = 'https://bndl.org/bandali-cv.txt'
if (!$url and $title =~ /curriculum vitae/);
$url = html_esc($url) if $url;
$url = 'https://bndl.org/bandali-cv.txt'
if (!$url and $title =~ /curriculum vitae/);
$url = html_esc($url) if $url;
@@
-118,6
+123,7
@@
print("<!doctype html>",
<meta http-equiv="Content-Type"
content="text/html; charset=utf-8" />\n),
"<title>$title</title>\n",
<meta http-equiv="Content-Type"
content="text/html; charset=utf-8" />\n),
"<title>$title</title>\n",
+ qq(<link rel="icon" href="data:,">\n),
$url ? qq(<link rel="alternate" href="$url"
title="plain text" type="text/plain" />\n) : '',
($opt_index and $opt_lang eq 'en')
$url ? qq(<link rel="alternate" href="$url"
title="plain text" type="text/plain" />\n) : '',
($opt_index and $opt_lang eq 'en')
@@
-127,10
+133,14
@@
hreflang="fa" title="persian" />\n)
? qq(<link rel="alternate" href="https://bndl.org/"
hreflang="en" title="english" />\n)
: '',
? qq(<link rel="alternate" href="https://bndl.org/"
hreflang="en" title="english" />\n)
: '',
+ qq(<style>\@media(prefers-color-scheme:dark){
+body{background:#1c1c1c;color:white;}a:link{color:#acdeff;}
+a:visited{color:#f8f;}a:active{color:#e00;}}),
$opt_lang eq 'fa'
$opt_lang eq 'fa'
- ? qq(
<style>
\@font-face{font-family:sahel;font-weight:normal;
+ ? qq(
\n
\@font-face{font-family:sahel;font-weight:normal;
src:local('Sahel WOL'),local('Sahel'),
src:local('Sahel WOL'),local('Sahel'),
-url('sahel.woff2')format('woff2');}pre{font-family:sahel}
</style>\n
)
+url('sahel.woff2')format('woff2');}pre{font-family:sahel})
: '',
: '',
+ "</style>\n",
"</head><body><pre>$txt</pre></body></html>\n");
STDOUT->flush;
"</head><body><pre>$txt</pre></body></html>\n");
STDOUT->flush;