[PerlWikiBot] SF.net SVN: perlwikibot:[64] trunk/no-interwiki/prepare_noiw_list.pl
Status: Pre-Alpha
Brought to you by:
rotemliss
|
From: <am...@us...> - 2008-08-04 16:08:11
|
Revision: 64
http://perlwikibot.svn.sourceforge.net/perlwikibot/?rev=64&view=rev
Author: amire80
Date: 2008-08-04 16:08:14 +0000 (Mon, 04 Aug 2008)
Log Message:
-----------
Fixed a bug in template parser. Added percentage of iwless pages to stats.
Modified Paths:
--------------
trunk/no-interwiki/prepare_noiw_list.pl
Modified: trunk/no-interwiki/prepare_noiw_list.pl
===================================================================
--- trunk/no-interwiki/prepare_noiw_list.pl 2008-08-04 13:32:26 UTC (rev 63)
+++ trunk/no-interwiki/prepare_noiw_list.pl 2008-08-04 16:08:14 UTC (rev 64)
@@ -373,9 +373,7 @@
next PAGE
if ($page_counter < $option{start_from});
- my $namespace = namespace($page);
- $namespace_count{$namespace}++;
-
+ my $namespace = namespace($page);
my $page_title = $page->title();
# Skipping cases:
@@ -384,11 +382,13 @@
is_redirect($page)
or not is_in_namespace($page, @INCLUDE_NAMESPACES)
+ # TODO: Be more precise here.
# Portal pages which have a '/' in their name are probably
# internal and do not need interwiki links.
or (is_in_namespace($page, 'Portal') and $page_title =~ m{/}xms)
);
+ $namespace_count{$namespace}++;
INFO("\n* processing $page_counter - ", $page_title);
my $page_text_ref = $page->text();
@@ -573,7 +573,8 @@
foreach my $next_filter (@{$filter}) {
# N.B. - case-insensitive. Wrong, but kinda useful.
- if ($next_match =~ /\A\Q$next_filter/xmsi) {
+ if ($next_match =~ /\A\Q$MW_SYNTAX{'start_tmpl'}$next_filter/xmsi)
+ {
# N.B.: parse_template calls find_templates() recursively
my $parsed_template =
@@ -1273,8 +1274,14 @@
INFO('pages without interwiki links per namespace');
foreach my $namespace (keys %{ $statistics{'has no interwiki link'} }) {
- INFO(
- "$namespace: $statistics{'has no interwiki link'}->{$namespace}");
+ my $iwless_in_namespace =
+ $statistics{'has no interwiki link'}->{$namespace};
+ ## no critic ValuesAndExpressions::ProhibitMagicNumbers
+ no integer;
+ my $percentage = sprintf '%.2f',
+ 100 * $iwless_in_namespace / $namespace_count{$namespace};
+ use integer;
+ INFO("$namespace: $iwless_in_namespace, $percentage%");
}
INFO("\nNAMESPACES");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|