Fossil

Check-in [733e9af8]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:added fossilwiki -- a perl script to dump information about the wiki pages in a repo
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:733e9af854ed9c6adf708252d2f746b95841e507
User & Date: ron 2012-05-14 19:44:06
Context
2012-05-26
20:59
Minor error text rewording (for clarity). Suggestion from the mailing list. check-in: e130c2e7 user: stephan tags: trunk
2012-05-14
19:44
added fossilwiki -- a perl script to dump information about the wiki pages in a repo check-in: 733e9af8 user: ron tags: trunk
2012-05-12
19:03
Update the built-in SQLite to the first 3.7.12 release candidate. check-in: 3613fe56 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Added tools/fossilwiki.









































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#!/usr/bin/perl
# vim: cin :

$repofile = shift;
$repocmd = '';
$repocmd = "-R $repofile" if -f $repofile;
$mainpage = '';

@rep = ();
if ( ! -f $repofile )
{
	@rep = `fossil info | grep 'project-name'`;
}
else
{
	@rep = `fossil info $repofile | grep 'project-name'`;
}

$mainpage = $rep[0];
chomp $mainpage;
$mainpage =~ s/^project-name:\s+//;


@pages = `fossil wiki list $repocmd`;

%pages = ();
foreach $page ( @pages )
{
	chomp $page;
	$text = `fossil wiki export "$page" $repocmd`;
	$pages{$page} = $text;
}

@orphans = ();
@nointernals = ();
@terminals = ();
@empties = ();
%badlinks = ();
%alllinks = ();
%links = ();
foreach $page ( keys %pages )
{
	my @links = ();
	my $text = $pages{$page};
	while ( $text =~ m/\[([^][]+)\]/g )
	{
		push @links,$1;
	}

	$numlinks = $#links;

	if (@links == ()) 
	{
		push @terminals, $page;
	}
	else
	{
		my @internals = grep { $_ !~ /(http:)|(mailto:)|(https:)/ } @links;
		if (@internals == ()) 
		{
			push @nointernals, $page;
		}
		else
		{
			@{$links{$page}{'links'}} = map {my ($a,$b) = split /\|/; $a;} @internals;
			foreach $internal ( @internals )
			{
				my ($int_link, $display) = split /\|/, $internal;
				${$links{$int_link}{'refs'}}++;
				$alllinks{$int_link} = 1;
			}
		}
	}

	if ($text eq '' || $text =~ m/^<i>Empty Page<\/i>/)
	{
		chomp $tail;
		my ($head, $tail) = split /\/i>/ , $text;
		if ($tail =~ m/^\s*$/s) {
		 	push @empties, $page;
		}
	}
}
foreach $page ( keys %links )
{
	if ($page ne $mainpage &&  (${$links{$page}{'refs'}} == 0))
	{
		push @orphans, $page;
	}
}
foreach $link (keys %alllinks )
{
	if (! exists($pages{$link}) && $link !~ /^\./ && $link !~ /^\//)
	{
		$badlinks{$link} = 1;
	}
}
foreach $empty ( @empties )
{
	print ("empty: '$empty'\n");
}
foreach $nointernals ( @nointernals )
{
	print ("nointernals: '$nointernals'\n");
}
foreach $terminal ( @terminals )
{
	print ("terminal: '$terminal'\n");
}
foreach $orphan ( @orphans )
{
	print ("orphan: '$orphan'\n");
}
foreach $link ( keys %badlinks )
{
	print ("badlink: '$link'\n");
}
foreach $page ( sort keys %links )
{
	my @links = @{$links{$page}{'links'}};
	if (@links != ()) 
	{
		if ($page eq $mainpage)
		{
			print "links: *** '$page' *** -> ", join (", ", @links), "\n";
		}
		else
		{
			print "links: '$page' -> ", join (", ", @links), "\n";
		}
	}
}