X-Git-Url: https://git.shemshak.org/~bandali/bndl.org/blobdiff_plain/e02deb23bf382d706e4085467fc0eb2b5b7364c0..5d2cac6dd4039c174ab79f2cfd5c83ec1f3ac480:/txt2html diff --git a/txt2html b/txt2html index f2a23d9..5b0acb8 100644 --- a/txt2html +++ b/txt2html @@ -26,7 +26,9 @@ use warnings 'all'; use Getopt::Long; my $opt_lang = 'en'; -GetOptions ('lang=s' => \$opt_lang) +my $opt_index; +GetOptions ('lang=s' => \$opt_lang, + 'index' => \$opt_index) or die("bad command line arguments\n"); my $link_re = @@ -101,21 +103,34 @@ if ($opt_lang eq 'fa') { } 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('', +print("", qq(', - '', - "$title", + $opt_lang eq 'fa' ? ' dir="rtl"' : '', + ">", + qq( +\n), + "$title\n", + $url ? qq(\n) : '', + ($opt_index and $opt_lang eq 'en') + ? qq(\n) + : ($opt_index and $opt_lang eq 'fa') + ? qq(\n) + : '', $opt_lang eq 'fa' - ? "\n\n" +url('sahel.woff2')format('woff2');}pre{font-family:sahel}\n) : '', - '
', $txt, '
'); + "
$txt
\n"); STDOUT->flush;