summaryrefslogtreecommitdiff
path: root/scripts/missing-journal-person-create
blob: afddfdeb8c1fc51602174b42ddd2df25965f60bc (plain)
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
#!/usr/bin/perl

use strict;
use warnings;

open(INPUT, "<", "/srv/http/journal/journal/index.html");
while (<INPUT>) {
    if (/^<li><span class="createlink">.*page=people%2F([^&]*).*\n$/) {
        s//$1/;
        my $basename = $_;
        my @names = split /\./, $_;
        my @Names = map ucfirst, @names;
        my $family = shift @Names;
        my $given = join ' ', @Names;
        my $realname = "$family, $given";
        my $pathname = "/home/liw/Journal/src/people/$basename.mdwn";
        if (!-e $pathname) {
            print "$realname\n";
            open(OUTPUT, ">", $pathname);
            print OUTPUT "[[!meta title=\"$realname\"]]\n\n";
            print OUTPUT "[[!inline feeds=no ";
            print OUTPUT "pages=\"notes/* and !notes/*/* and ";
            print OUTPUT "link(people/$basename)\"]]\n";
            close(OUTPUT);
        }
    }
}