Initial commit
This commit is contained in:
30
tools/extract_doc.py
Executable file
30
tools/extract_doc.py
Executable file
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
|
||||
filename = sys.argv[1]
|
||||
|
||||
if filename.endswith('__init__.py'):
|
||||
sys.exit(0)
|
||||
|
||||
package_name = filename.replace('/', '.').replace('.py', '')
|
||||
sys.stdout.write('%s' % (package_name))
|
||||
sys.stdout.write('\n')
|
||||
# sys.stdout.write('\n\n')
|
||||
sys.stdout.write('-' * len(package_name))
|
||||
sys.stdout.write('\n\n')
|
||||
|
||||
sys.stderr.write('\tExtract doc from %s\n' % (filename))
|
||||
|
||||
with open(filename) as infile:
|
||||
copy = False
|
||||
for line in infile:
|
||||
if line.strip() in ['"""', "'''"]:
|
||||
if not copy:
|
||||
copy = True
|
||||
else:
|
||||
break
|
||||
elif copy:
|
||||
sys.stdout.write(' %s' % (line))
|
||||
|
||||
sys.stdout.write('\n\n')
|
16
tools/extract_docs.sh
Executable file
16
tools/extract_docs.sh
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
|
||||
MODULES_TARGET="docs/modules.md"
|
||||
MAIN_MD="docs/main.md"
|
||||
TARGET_MD="docs/index.md"
|
||||
|
||||
rm -f "${MODULES_TARGET}"
|
||||
|
||||
echo "Generate doc from iwla.py"
|
||||
python tools/extract_doc.py iwla.py > "${MODULES_TARGET}"
|
||||
|
||||
echo "Generate plugins documentation"
|
||||
find plugins -name '*.py' -exec python tools/extract_doc.py \{\} \; >> "${MODULES_TARGET}"
|
||||
|
||||
echo "Generate ${TARGET_MD}"
|
||||
cat "${MAIN_MD}" "${MODULES_TARGET}" > "${TARGET_MD}"
|
3
tools/gettext.sh
Executable file
3
tools/gettext.sh
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
pygettext -a -d iwla -o iwla.pot -k gettext *.py plugins/pre_analysis/*.py plugins/post_analysis/*.py plugins/display/*.py
|
79
tools/iwla_convert.pl
Executable file
79
tools/iwla_convert.pl
Executable file
@@ -0,0 +1,79 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
my $awstats_lib_root = './';
|
||||
my @awstats_libs = ('search_engines.pm', 'robots.pm');
|
||||
|
||||
# my $awstats_lib_root = '/usr/share/awstats/lib/';
|
||||
# my @awstats_libs = ('browsers.pm', 'browsers_phone.pm', 'mime.pm', 'referer_spam.pm', 'search_engines.pm', 'operating_systems.pm', 'robots.pm', 'worms.pm');
|
||||
|
||||
foreach $lib (@awstats_libs) {require $awstats_lib_root . $lib;}
|
||||
|
||||
sub dumpList {
|
||||
my @list = @{$_[0]};
|
||||
my $FIC = $_[1];
|
||||
my $first = $_[2];
|
||||
|
||||
foreach $r (@list)
|
||||
{
|
||||
$r =~ s/\'/\\\'/g;
|
||||
if ($first == 0)
|
||||
{
|
||||
print $FIC ", ";
|
||||
}
|
||||
else
|
||||
{
|
||||
$first = 0;
|
||||
}
|
||||
print $FIC "'$r'";
|
||||
}
|
||||
}
|
||||
|
||||
sub dumpHash {
|
||||
my %hash = %{$_[0]};
|
||||
my $FIC = $_[1];
|
||||
my $first = $_[2];
|
||||
|
||||
while( my ($k,$v) = each(%hash) ) {
|
||||
$k =~ s/\'/\\\'/g;
|
||||
$v =~ s/\'/\\\'/g;
|
||||
if ($first == 0)
|
||||
{
|
||||
print $FIC ", ";
|
||||
}
|
||||
else
|
||||
{
|
||||
$first = 0;
|
||||
}
|
||||
print $FIC "'$k' : '$v'";
|
||||
}
|
||||
}
|
||||
|
||||
# Robots
|
||||
open($FIC,">", "awstats_data.py") or die $!;
|
||||
|
||||
print $FIC "robots = [";
|
||||
dumpList(\@RobotsSearchIDOrder_list1, $FIC, 1);
|
||||
dumpList(\@RobotsSearchIDOrder_list2, $FIC, 0);
|
||||
print $FIC "]\n\n";
|
||||
|
||||
print $FIC "search_engines = [";
|
||||
dumpList(\@SearchEnginesSearchIDOrder_list1, $FIC, 1);
|
||||
print $FIC "]\n\n";
|
||||
|
||||
print $FIC "search_engines_2 = [";
|
||||
dumpList(\@SearchEnginesSearchIDOrder_list2, $FIC, 1);
|
||||
print $FIC "]\n\n";
|
||||
|
||||
print $FIC "not_search_engines_keys = {";
|
||||
dumpHash(\%NotSearchEnginesKeys, $FIC, 1);
|
||||
print $FIC "}\n\n";
|
||||
|
||||
print $FIC "search_engines_hashid = {";
|
||||
dumpHash(\%SearchEnginesHashID, $FIC, 1);
|
||||
print $FIC "}\n\n";
|
||||
|
||||
print $FIC "search_engines_knwown_url = {";
|
||||
dumpHash(\%SearchEnginesKnownUrl, $FIC, 1);
|
||||
print $FIC "}\n\n";
|
||||
|
||||
close($FIC);
|
Reference in New Issue
Block a user