Browse Source

convert pre sections to preformatted gemini blocks

preserve whitespaces in item description as they may
serve a purpose.
This will eventually be improved with a more
sophisticated algo that only preverses whitespaces
in non-pre-blocks

closes #8
master
René Wagner 4 months ago
parent
commit
f847c41903
  1. 5
      orrg.pl

5
orrg.pl

@ -26,7 +26,7 @@ if (!defined($ENV{'SERVER_PROTOCOL'}) || $ENV{'SERVER_PROTOCOL'} ne 'GEMINI')
my $query = lc(uri_unescape($ENV{'QUERY_STRING'}));
if ($query eq '' || $query !~ /^(https|gemini)\:\/\//) {
write_response('INPUT', 'Paste the URI of the rss feed you want to read:', undef);
write_response('INPUT', 'Paste the URI of the rss feed you want to read', undef);
}
write_response('SUCCESS', 'text/gemini', create_response($query));
@ -77,8 +77,9 @@ sub item
$desc =~ s/\<li\>/* /igm;
$desc =~ s/\<h[1-2][^\>]+\>/### /igm;
$desc =~ s/\<br \/\>/\r\n/igm;
$desc =~ s/\<pre.*\>/\r\n```\r\n/igm;
$desc =~ s/\<\/pre\>/\r\n```\r\n/igm;
$desc = $hs->parse($desc);
$desc = trim_ws($desc);
}
push @item, (($desc ne '' && $desc ne $title) || $it->pubDate ne '')? '## '. $title : $title;
if ($it->pubDate ne '') {

Loading…
Cancel
Save