X-Git-Url: http://git.shemshak.org/~bandali/bndl.org/blobdiff_plain/d3adcff4a931922ad5ee52154cf78a7a339835cf..4236f6dbb039a56d3fc233737b55cc7b0665178b:/txt2html diff --git a/txt2html b/txt2html index 128995c..10de15d 100644 --- a/txt2html +++ b/txt2html @@ -23,6 +23,13 @@ use strict; use warnings 'all'; +use Getopt::Long; + +my $opt_lang = 'en'; +my $opt_index; +GetOptions ('lang=s' => \$opt_lang, + 'index' => \$opt_index) + or die("bad command line arguments\n"); my $link_re = qr{([\('!])?\b((?:ftps?|https?|nntps?|imaps?|s?news|gopher):// @@ -91,28 +98,44 @@ sub linkify { my $txt = do { local $/; }; my $title = html_esc($txt =~ /\A([^\n]+)/); $title =~ s/^\s+|\s+$//g; -if ($ARGV[0] and $ARGV[0] eq 'fa') { +if ($opt_lang eq 'fa') { $title .= ' — بندعلی' if $title !~ /بندعلی/; } else { $title .= ' — bandali' if $title !~ /bandali/; } +my ($url) = $txt =~ /(?:plain text|متن ساده): (.*)\r?\n?\z/; +$url = 'https://bndl.org/bandali-cv.txt' + if (!$url and $title =~ /curriculum vitae/); +$url = html_esc($url) if $url; $txt = linkify(html_esc($txt)); -print('', - ($ARGV[0] and $ARGV[0] eq 'fa') - ? '' - : '', - '', - '', - "$title", - ($ARGV[0] and $ARGV[0] eq 'fa') - ? "\n\n" +url('sahel.woff2')format('woff2');}pre{font-family:sahel}) : '', - '
', $txt, '
'); + "\n", + "
$txt
\n"); STDOUT->flush;