#!/usr/bin/env perl
-# txt2pre --- convert my site's txt files to `pre'-based html
+# txt2pre --- convert my site's txt files to `pre'-based atom/rss/html
# Copyright (C) 2014-2021 all contributors <meta@public-inbox.org>
# Copyright (c) 2021 Amin Bandali <bandali@gnu.org>
my $upd_iso8601 = `date -Iseconds -ud '$upd' | tr -d \\\\n` if $upd;
my $pub_iso8601 = `date -Iseconds -ud '$pub' | tr -d \\\\n` if $pub;
my $pub_rfc5322 = `date -uRd '$pub' | tr -d \\\\n` if $pub;
-my $url_html = $url =~ s/(?:[.]$lang)?[.]txt$/.html/r;
-$url_html =~ s|/bandali-(.*)|/$1|;
-my $slug = $url_html =~ s|.*/(.*)[.]html$|$1|r;
-my $note_id = "$feed_id:$slug";
+my $url_html = $url =~ s/(?:[.]$lang)?[.]txt$/.html/r if $url;
+$url_html =~ s|/bandali-(.*)|/$1| if $url_html;
+my $slug = $url_html =~ s|.*/(.*)[.]html$|$1|r if $url_html;
+my $note_id = "$feed_id:$slug" if $url_html;
# note header
if ($format eq 'html') {