add a perl script to convert MaintNotes to wiki format
[git/dscho.git] / to-wiki.perl
blobd50449a3d09a2ca04ed34e80de82c0e074e15be5
1 #!/usr/bin/perl
3 $tabbed = 0;
4 $tab = '(\t| {8}| {5})';
6 print 'Notes:
7 * The newest version of this message can be found in the \'todo\' branch in git.git, as file [http://repo.or.cz/w/git.git?a=blob_plain;f=MaintNotes;hb=todo MaintNotes].
8 * This Wiki page is generated irregularly using [http://repo.or.cz/w/git/dscho.git?a=blob_plain;f=to-wiki.perl;hb=my-todo Dscho\'s script].
9 <br>
11 == A note from the maintainer ==
15 sub p {
16 $_ = $_[0];
17 s/^\* (This document)$/\n== $1 ==/;
18 s/^\* (.*?)\.*$/\n=== $1 ===/;
19 s/http:\/\/www.kernel.org\/$/[http:\/\/www.kernel.org\/pub\/software\/scm\/git\/docs\/ $&]/;
20 s/ repo.or.cz/ [http:\/\/repo.or.cz$&]/;
22 s/^ (\S+) *(--.*?)\n*$/$tabbed = 3; sprintf("* '''$1''' $2");/e;
23 s/^ [-*] (.*?)\n*$/$tabbed = 3; sprintf("* $1");/e;
24 s/^ [-*] (.*?)\n*$/$tabbed = 3; sprintf("** $1");/e;
25 s/^ ([A-Z].*?)\n*$/$tabbed = 3; sprintf(":$1");/e;
26 s/^ [-*] (.*?)\n*$/$tabbed = 3; sprintf("*** $1");/e;
27 s/^ \((\d)\) (.*?)\n*$/$tabbed = 3; sprintf(": $1. $2");/e;
29 $gitlink = "[http://repo.or.cz/w/git.git?a=blob_plain;f=";
30 $gitlink2 = "[http://repo.or.cz/w/git.git?a=blob;f=";
31 s/(Documentation\/SubmittingPatches|contrib\/README)/$gitlink$1 $1]/;
32 s/(MaintNotes)/$gitlink$1;hb=todo $1]/;
33 s/Meta\/(PU|git-topic.perl)/$gitlink2$1;hb=todo Meta\/$1]/;
34 s/html and man branches/'html' and 'man' branches/g;
35 s/^The maintainer's git time/
37 ----
38 == Addendum ==
40 === Activities ===
42 $&/;
43 s/^(The policy |A typical git day)/
44 === $1 ===
46 $1/;
47 s/^Some observations/=== Observations ===
49 $&/;
51 if ($tabbed == 3) {
52 $tabbed--;
53 } elsif ($tabbed) {
54 if (/^$tab/ || ($tabbed == 2 && /^ /)) {
55 if ($tabbed == 1) {
56 s/^$tab//;
57 s/^\$/ \$/;
58 s/$/<br>/;
59 } else {
60 s/^\s*/:/;
61 s/\n*$//;
63 } else {
64 if ($tabbed == 2) {
65 print "\n";
66 } else {
67 print "</blockquote>\n";
69 $tabbed = 0;
71 } else {
72 if (/^$tab/) {
73 s/^$tab//;
74 s/^\$/print " "; sprintf(" \$");/e;
75 s/$/<br>/;
76 print "<blockquote>\n";
77 $tabbed = 1;
79 s/^ {3}(\S)/$1/;
81 print $_;
84 while (<>) {
85 p $_;
88 p "";
89 print '
91 \'\'\'References:\'\'\'
92 * [http://permalink.gmane.org/gmane.comp.version-control.git/65722 Addendum to "MaintNotes"] post at git mailing list.
93 * [http://repo.or.cz/w/git.git?a=blob_plain;f=Documentation/howto/maintain-git.txt Documentation/howto/maintain-git.txt] with foreword by Jeff King.