Skip to content

Commit

Permalink
Merge pull request penma#4 from Zaba/master
Browse files Browse the repository at this point in the history
Some changes and fixes
  • Loading branch information
penma committed Jun 3, 2011
2 parents 9900cd0 + c4b51f2 commit 135e8b2
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 7 deletions.
5 changes: 1 addition & 4 deletions cache2dot
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,8 @@ print "digraph Wikisophy {\n";
print "\tnode [shape=box];\n";

while (<>) {
s/^/\t"/;
s/#/" -> "/;
s/$/";/;
s/^([^#]+)#(.*)$/\t"\u$1" -> "\u$2";/;
y/_/ /;
$_ = lc;

print;
}
Expand Down
23 changes: 23 additions & 0 deletions cacheleaves
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env perl

use strict;
use warnings;
use open IN => ':encoding(UTF-8)';

binmode STDIN, ':encoding(UTF-8)';
binmode STDOUT, ':utf8';

my (%parents, %children);

while (<>) {
if (m/^([^#]+)#(.*)$/) {
$parents{ucfirst($1)} = 1;
$children{ucfirst($2)} = 1;
}
}

for (keys %parents) {
if (not $children{$_}) {
print "$_\n";
}
}
7 changes: 4 additions & 3 deletions wikisophy
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,16 @@ sub parse_page {
my ($c) = @_;
my $page_name;

$c =~ s/<ref[^>]*>[^<]+<\/ref>//gs;
$c =~ s/'{2,}[^\n]+?'{2,}//gs;
$c =~ s/<!--.*?-->//gs;

wikiparse: while (length($c)) {
if ($is_debug) {
print $c;
print "*" x 80 . "\n\n";
}

$c =~ s/<ref[^>]*>[^<]+<\/ref>//gs;
$c =~ s/'{2,}[^\n]+?'{2,}//gs;

if ($c =~ /^[^{(]+\[\[/s) {
$c =~ s/^[^\[]+//s;
($page_name, $c) = extract_bracketed($c, "[");
Expand Down

0 comments on commit 135e8b2

Please sign in to comment.