User:AnomieBOT/source/tasks/SourceUploader.pm: Difference between revisions

Content deleted Content added
m Reverted 1 edit by 50.224.156.210 (talk) to last revision by AnomieBOT
AnomieBOT (talk | contribs)
Updating published sources: SourceUploader: * Improve list handling for doc pages. * Add a TemplateStyles stylesheet to doc pages. * Cleanup some manpage refs.
 
(One intermediate revision by the same user not shown)
Line 65:
my $class=shift;
my $self=$class->SUPER::new();
$self->{'pages'}={};
$self->{'loadexisting'}=1;
$self->{'order'}=-1000;
$self->{'fail'}=0;
return $self;
}
 
sub build_sources {
my $self = shift;
 
my $basedir=$AnomieBOT::API::basedir;
Line 75 ⟶ 79:
$self->{'fail'}=1;
AnomieBOT::API->warn("Cannot find source directory\n");
return $self;
}
 
Line 82 ⟶ 86:
$self->{'fail'}=1;
AnomieBOT::API->warn("Cannot load changelog: $!\n");
return $self;
}
local $_;
Line 114 ⟶ 118:
$self->{'fail'}=1;
AnomieBOT::API->warn("Cannot open directory $dir: $!\n");
return $self;
}
 
Line 134 ⟶ 138:
$self->{'fail'}=1;
AnomieBOT::API->warn("Cannot open file $p: $!\n");
return $self;
}
do {
Line 159 ⟶ 163:
$parser->output_string(\$x);
$parser->parse_string_document($pages{$pp});
$pages{"$pp/doc"}="<templatestyles src=\"User:$mainbot/source-docs.css\"/>\n$x" if($parser->content_seen);
 
# Handle embedded notices and metadata
Line 284 ⟶ 288:
$self->{'pages'}={%pages};
$self->{'tasklists'}=\%tasklists;
return $self;
}
 
Line 290 ⟶ 293:
my ($self, $api)=@_;
 
return undef if $self->{'fail'};
 
$self->build_sources() unless defined( $self->{'pages'} );
return undef if $self->{'fail'};
 
Line 308 ⟶ 314:
my $iter=$api->iterator(
list => 'allpages',
apprefix => $api->user.'/source/',
apnamespace => '2',
aplimit => 'max'