summaryrefslogtreecommitdiff
path: root/scripts/missing-journal-tag-create
blob: 9360cab5b8f259e858a7cebf719c8ada52136a8b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/perl

use strict;
use warnings;

open(INPUT, "<", "/srv/http/journal/journal/index.html");
while (<INPUT>) {
    if (/^<li><span class="createlink">.*page=%2Ftag%2F([^&]*)&amp;from=notes%2F.*\n$/) {
        s//$1/;
        my $tag = $_;
        my $pathname = "/home/liw/Journal/src/tag/$tag.mdwn";
        if (!-e $pathname) {
            print "$tag\n";
            open(OUTPUT, ">", $pathname);
            print OUTPUT "[[!inline archive=yes pages=\"link(tag/$tag)\"]]\n";
            close(OUTPUT);
        }
    }
}