1 Return-Path: <too@guru.guru-group.fi>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id 624C0429E5B
\r
6 for <notmuch@notmuchmail.org>; Wed, 1 Feb 2012 07:22:55 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id s69OosxUxL9X for <notmuch@notmuchmail.org>;
\r
16 Wed, 1 Feb 2012 07:22:54 -0800 (PST)
\r
17 Received: from guru.guru-group.fi (guru-group.fi [87.108.86.66])
\r
18 by olra.theworths.org (Postfix) with ESMTP id 18596429E34
\r
19 for <notmuch@notmuchmail.org>; Wed, 1 Feb 2012 07:22:54 -0800 (PST)
\r
20 Received: by guru.guru-group.fi (Postfix, from userid 501)
\r
21 id EA80768055; Wed, 1 Feb 2012 17:22:56 +0200 (EET)
\r
22 From: Tomi Ollila <tomi.ollila@iki.fi>
\r
23 To: notmuch@notmuchmail.org
\r
24 Subject: [PATCH 2/2] devel: added newssplit.pl for splitting NEWS for markdown
\r
26 Date: Wed, 1 Feb 2012 17:22:50 +0200
\r
27 Message-Id: <1328109770-29279-2-git-send-email-tomi.ollila@iki.fi>
\r
28 X-Mailer: git-send-email 1.7.6.1
\r
29 In-Reply-To: <1328109770-29279-1-git-send-email-tomi.ollila@iki.fi>
\r
30 References: <1328109770-29279-1-git-send-email-tomi.ollila@iki.fi>
\r
31 Cc: Tomi Ollila <tomi.ollila@iki.fi>
\r
32 X-BeenThere: notmuch@notmuchmail.org
\r
33 X-Mailman-Version: 2.1.13
\r
35 List-Id: "Use and development of the notmuch mail system."
\r
36 <notmuch.notmuchmail.org>
\r
37 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
38 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
39 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
40 List-Post: <mailto:notmuch@notmuchmail.org>
\r
41 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
42 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
43 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
44 X-List-Received-Date: Wed, 01 Feb 2012 15:22:55 -0000
\r
46 devel/newssplit.pl splits NEWS file to separate files per release.
\r
48 In addition to splitting it changes lines starting with '*' to start
\r
49 with '###' (markdown for h3) and concatenates continuing non-empty
\r
50 lines to the same line; markdown does now allow (long) header line
\r
51 to be split into multiple lines -- such long lines would look ugly
\r
52 when reading the original NEWS file in text format.
\r
54 See http://notmuchmail.org/news/ (as of 2012-02-01) to see current
\r
56 devel/newssplit.pl | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++
\r
57 1 files changed, 56 insertions(+), 0 deletions(-)
\r
58 create mode 100755 devel/newssplit.pl
\r
60 diff --git a/devel/newssplit.pl b/devel/newssplit.pl
\r
61 new file mode 100755
\r
62 index 0000000..c1a0b26
\r
64 +++ b/devel/newssplit.pl
\r
67 +# Author: Tomi Ollila
\r
68 +# License: same as notmuch
\r
70 +# This program is used to split NEWS file to separate (mdwn) files
\r
71 +# for notmuch wiki. Example run:
\r
73 +# $ ./devel/newssplit.pl NEWS ../notmuch-wiki/news
\r
78 +die "$0 <source-file> <destination-directory>\n" unless @ARGV == 2;
\r
80 +die "'$ARGV[0]': no such file\n" unless -f $ARGV[0];
\r
81 +die "'$ARGV[1]': no such directory\n" unless -d $ARGV[1];
\r
83 +open I, '<', $ARGV[0] or die "Cannot open '$ARGV[0]': $!\n";
\r
85 +open O, '>', '/dev/null' or die $!;
\r
86 +my @emptylines = ();
\r
87 +print "\nWriting to $ARGV[1]: ";
\r
90 + # The date part in regex regognizes wip version dates like: (201x-xx-xx).
\r
91 + if (/^Notmuch\s+(\S+)\s+\((\w\w\w\w-\w\w-\w\w)\)/) {
\r
92 + # open O... autocloses previously opened file.
\r
93 + open O, '>', "$ARGV[1]/release-$1.mdwn" or die $!;
\r
94 + print " release-$1.mdwn...";
\r
95 + print O "[[!meta date=\"$2\"]]\n\n";
\r
98 + # buffer "trailing" empty lines -- dropped at end of file.
\r
99 + push(@emptylines, $_), next if s/^\s*$/\n/;
\r
100 + if (@emptylines) {
\r
101 + print O @emptylines;
\r
102 + @emptylines = ();
\r
104 + # convert top-level list item to level 4 header.
\r
105 + if (s/^\*\s+//) {
\r
113 + print O "### ", (join ' ', @l), "\n";
\r
114 + @emptylines = ( "\n" );
\r
120 +print "\ndone.\n";
\r