Re: [PATCH v3 0/6] Make Emacs search use sexp format
[notmuch-archives.git] / 0a / 91d585b09d0640982f0494c716a88993136e5c
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
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
12         autolearn=disabled\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
25         processing.\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
34 Precedence: list\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
45 \r
46 devel/newssplit.pl splits NEWS file to separate files per release.\r
47 \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
53 ---\r
54 See http://notmuchmail.org/news/ (as of 2012-02-01) to see current\r
55 output\r
56  devel/newssplit.pl |   56 ++++++++++++++++++++++++++++++++++++++++++++++++++++\r
57  1 files changed, 56 insertions(+), 0 deletions(-)\r
58  create mode 100755 devel/newssplit.pl\r
59 \r
60 diff --git a/devel/newssplit.pl b/devel/newssplit.pl\r
61 new file mode 100755\r
62 index 0000000..c1a0b26\r
63 --- /dev/null\r
64 +++ b/devel/newssplit.pl\r
65 @@ -0,0 +1,56 @@\r
66 +#!/usr/bin/perl\r
67 +# Author: Tomi Ollila\r
68 +# License: same as notmuch\r
69 +\r
70 +# This program is used to split NEWS file to separate (mdwn) files \r
71 +# for notmuch wiki. Example run:\r
72 +#\r
73 +# $ ./devel/newssplit.pl NEWS ../notmuch-wiki/news\r
74 +\r
75 +use strict;\r
76 +use warnings;\r
77 +\r
78 +die "$0 <source-file> <destination-directory>\n" unless @ARGV == 2;\r
79 +\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
82 +\r
83 +open I, '<', $ARGV[0] or die "Cannot open '$ARGV[0]': $!\n";\r
84 +\r
85 +open O, '>', '/dev/null' or die $!;\r
86 +my @emptylines = ();\r
87 +print "\nWriting to $ARGV[1]: ";\r
88 +while (<I>)\r
89 +{\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
96 +       @emptylines = ();\r
97 +    }\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
103 +    }\r
104 +    # convert top-level list item to level 4 header.\r
105 +    if (s/^\*\s+//) {\r
106 +       chomp;\r
107 +       my @l = $_;\r
108 +       while (<I>) {\r
109 +           last if /^\s*$/;\r
110 +           chomp; s/^\s+//;\r
111 +           push @l, $_;\r
112 +       }\r
113 +       print O "### ", (join ' ', @l), "\n";\r
114 +       @emptylines = ( "\n" );\r
115 +       next;\r
116 +    }\r
117 +\r
118 +    print O $_;\r
119 +}\r
120 +print "\ndone.\n";\r
121 +close O;\r
122 -- \r
123 1.7.6.5\r
124 \r