Commit 52053170 authored by Luc Didry's avatar Luc Didry

Fix bug in atom feed article ids

parent a978f044
Pipeline #41689 passed with stages
in 56 seconds
Revision history for Last
0.6.1 2018-03-07
- Fix bug in atom feed article ids
0.6.0 2018-03-07
- Allow to merge multiple toots
- Allow to modify the content of the toot through a custom module
......
......@@ -32,7 +32,6 @@ BEGIN {
} else {
$lc_loaded = 1;
}
print $lc_loaded, "\n";
}
# Get config
......@@ -170,8 +169,8 @@ my %versions = ();
$urls->each(
sub {
my ($e, $nb) = @_;
my ($content, $i, $date, $time, $attachments, $id, $url, $dt, $num, $attachments2) = process_entry($e, $nb);
format_and_insert_toot($content, $i, $date, $time, $attachments, $id, $url, $dt, $num, $attachments2);
my ($content, $i, $date, $time, $attachments, $id, $dt, $num, $attachments2) = process_entry($e, $nb);
format_and_insert_toot($content, $i, $date, $time, $attachments, $id, $dt, $num, $attachments2);
}
);
......@@ -327,23 +326,22 @@ sub process_entry {
$content = process_md($content);
}
return ($content, $i, $date, $time, $attachments, $id, $url, $dt, $num, $attachments2);
return ($content, $i, $date, $time, $attachments, $id, $dt, $num, $attachments2);
} elsif ($res->is_error) {
die "Error while fetching $i: $res->message";
}
} else {
my ($content, $attachments, $attachments2, $date, $time, $id, $url, $dt) = ('', '', '');
my ($content, $attachments, $attachments2, $date, $time, $id, $dt) = ('', '', '');
c(@{$i})->each(
sub {
my ($e, $nb) = @_;
my ($tmp_content, $tmp_i, $tmp_date, $tmp_time, $tmp_attachments, $tmp_id, $tmp_url, $tmp_dt, $tmp_num, $tmp_attachments2) = process_entry($e, $nb);
my ($tmp_content, $tmp_i, $tmp_date, $tmp_time, $tmp_attachments, $tmp_id, $tmp_dt, $tmp_num, $tmp_attachments2) = process_entry($e, $nb);
if ($nb == 1) {
$i = $tmp_i;
$date = $tmp_date;
$time = $tmp_time;
$id = $tmp_id;
$url = $tmp_url;
$dt = $tmp_dt;
$content = $tmp_content;
$attachments = $tmp_attachments;
......@@ -367,7 +365,7 @@ sub process_entry {
}
}
);
return ($content, $i, $date, $time, $attachments, $id, $url, $dt, $num, $attachments2);
return ($content, $i, $date, $time, $attachments, $id, $dt, $num, $attachments2);
}
}
......@@ -504,7 +502,7 @@ sub process_md {
}
sub format_and_insert_toot {
my ($content, $i, $date, $time, $attachments, $id, $url, $dt, $num, $attachments2) = @_;
my ($content, $i, $date, $time, $attachments, $id, $dt, $num, $attachments2) = @_;
$content =~ s#<p></p>|</br>##g;
$content =~ s#<br>#<br />#g;
my $append = "\n <article><a href=\"#$id\"><h3 id=\"$id\">$date <span style=\"font-size: 0.5em;\">$time</span></h3></a>$content$attachments<div><a href=\"$i\"><em>Source</em></a></div></article><hr>\n";
......@@ -538,7 +536,7 @@ sub format_and_insert_toot {
## Create entries for the atom feed
push @entries, {
title => "$date $time",
id => "$url#$id",
id => "$id",
updated => DateTime::Format::RFC3339->format_datetime($dt),
content => $append
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment