ref: 011e0854c8a6c7d948d4a38791ce9e02178e2927
author: ori <[email protected]>
date: Thu Sep 25 08:34:26 EDT 2014
Initial commit.
--- /dev/null
+++ b/mhonarc/layout.mrc
@@ -1,0 +1,323 @@
+<!-- ------------------------------------------------------------------ -->
+<!-- MSGPGBEGIN, MSGPGEND: -->
+<!-- -->
+<!-- MSGPGBEGIN defines the beginning markup of each message page. It -->
+<!-- allows you to redefine the opening HTML element, HEAD element, -->
+<!-- TITLE element, opening BODY element, etc. -->
+<!-- -->
+<!-- MSGPGEND defines the ending markup of each message page. -->
+<!-- -->
+
+<MSGPGBEGIN>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html lang="en">
+<head>
+ <title>$SUBJECTNA$</title>
+ <link rel="stylesheet" type="text/css" media="screen" href="/style.css">
+</head>
+<body>
+ <header><h1> Eigenstate: $IDXTITLE$ mailing list</h1></header>
+ <nav>
+ <ul>
+ <li> <a href="/">Home</a> </li>
+ <li> <a href="..">Date index</a> </li>
+ <li> <a href="$TIDXFNAME$#$MSGNUM$">Thread index</a> </li>
+ <li> <a href="$IDXFNAME$#$MSGNUM$">date index</a> </li>
+ </ul>
+ </nav>
+ <article>
+</MSGPGBEGIN>
+
+<MSGPGEND>
+ </article>
+ <footer>
+ Here's a footer. Isn't that neat?
+ </footer>
+</body>
+</html>
+</MSGPGEND>
+
+
+<!-- ------------------------------------------------------------------ -->
+<!-- IDXPGBEGIN, IDXPGEND: -->
+<!-- -->
+<!-- The IDXPGBEGIN resource defines the beginning markup for the main -->
+<!-- index page. I.e. You can control the opening <HTML> tag, the HEAD -->
+<!-- element contents, the opening <BODY> tag, etc. Therefore, if you -->
+<!-- are not satisfied with the default behavior of how the TITLE -->
+<!-- resource is used, or have other needs that require control over -->
+<!-- the beginning markup, you can set the IDXPGBEGIN resource to what -->
+<!-- you desire. -->
+<!-- -->
+<!-- The IDXPGEND resource defines the end markup for the main index -->
+<!-- page. -->
+
+<IDXPGBEGIN>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html lang="en">
+<head>
+ <title>$IDXTITLE$</title>
+ <link rel="stylesheet" type="text/css" media="screen" href="/style.css">
+</head>
+<body>
+</IDXPGBEGIN>
+
+<IDXPGEND>
+</body>
+</html>
+</IDXPGEND>
+
+
+<!-- ------------------------------------------------------------------ -->
+<!-- TIDXPGBEGIN, TIDXPGEND -->
+<!-- -->
+<!-- The TIDXPGBEGIN resource defines the beginning markup for the -->
+<!-- thread index pages. I.e. You can control the opening <HTML> tag, -->
+<!-- the HEAD element contents, the opening <BODY> tag, etc. Therefore, -->
+<!-- if you are not satisfied with the default behavior of how the -->
+<!-- TTITLE resource is used, or have other needs that require control -->
+<!-- on the beginning markup, you can set the TIDXPGBEGIN resource to -->
+<!-- what you desire. -->
+<!-- -->
+<!-- The TIDXPGEND resource defines the end markup for the thread index -->
+<!-- pages. -->
+<!-- -->
+
+<TIDXPGBEGIN>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html lang="en">
+<head>
+ <title>$TIDXTITLE$</title>
+ <link rel="stylesheet" type="text/css" media="screen" href="/style.css">
+</head>
+<body>
+</TIDXPGBEGIN>
+
+<TIDXPGEND>
+</body>
+</html>
+</TIDXPGEND>
+
+<!-- ------------------------------------------------------------------ -->
+<!-- LISTBEGIN, LITEMPLATE, LISTEND: -->
+<!-- -->
+<!-- The LISTBEGIN resource specifies the markup to begin the message -->
+<!-- list. This resource works in conjuction with LITEMPLATE and -->
+<!-- LISTEND resources to format the main index page(es). -->
+<!-- -->
+<!-- The LITEMPLATE resource specifies the markup for an entry in the -->
+<!-- main index message list. This resource works in conjuction with -->
+<!-- LITEMPLATE and LISTEND resources to format the main index page(es) -->
+<!-- http://www.mhonarc.org/MHonArc/doc/resources/litemplate.html -->
+<!-- -->
+<!-- The LISTEND resource specifies the markup to end the message list -->
+<!-- in the main index. This resource works in conjuction with -->
+<!-- LISTBEGIN and LITEMPLATE resources to format the main index -->
+<!-- page(es). -->
+<!-- -->
+
+<LISTBEGIN>
+ <div id="banner">
+ <div id="header">
+ <div class="banner-left"><img src="/icons/g/banner_left.gif" width="17" height="56" border="0" alt="" /></div>
+ <div class="banner-text">$IDXTITLE$</div>
+ <div class="banner-right"><img src="/icons/banner_right.gif" width="10" height="56" alt="" /></div>
+ </div>
+ <div id="topnav">
+ <a href="/">home</a>
+ |
+ <a href="..">month and year index</a>
+ |
+ <a href="$TIDXFNAME$">thread index</a>
+ |
+ <a href="$IDXFNAME$">date index</a>
+ |
+ </div>
+ </div>
+ <div id="mailinglists">
+ <div id="main">
+<h1>Date Index</h1>
+<div id="didx">
+<ul>
+</LISTBEGIN>
+
+<LITEMPLATE>
+<li><strong>$SUBJECT$</strong> $MSGLOCALDATE(CUR;%Y-%m-%d %H:%M)$
+<ul>
+<li><em>From</em>: $FROM$</li></ul>
+</li>
+</LITEMPLATE>
+
+<LISTEND>
+</ul>
+</div>
+ <!-- FIXME <address>Archive administrator: postmaster@mlmmj-webarchiver</address> -->
+ </div>
+ </div>
+</LISTEND>
+
+
+<!-- ------------------------------------------------------------------ -->
+<!-- THEAD, TFOOT -->
+<!-- -->
+<!-- THEAD defines the header markup of thread index pages. It is also -->
+<!-- responsible for defining the opening markup for the thread -->
+<!-- listings. -->
+<!-- -->
+<!-- TFOOT defines the footer markup of thread index pages. It is also -->
+<!-- responsible for defining the closing markup for the thread listing -->
+<!-- -->
+
+<THEAD>
+<head>
+ <title>$SUBJECTNA$</title>
+ <link rel="stylesheet" type="text/css" media="screen" href="/style.css">
+</head>
+<body>
+ <header><h1> Eigenstate: $IDXTITLE$ mailing list</h1></header>
+ <nav>
+ <ul>
+ <li> <a href="/">Home</a> </li>
+ <li> <a href="..">Date index</a> </li>
+ <li> <a href="$TIDXFNAME$#$MSGNUM$">Thread index</a> </li>
+ <li> <a href="$IDXFNAME$#$MSGNUM$">date index</a> </li>
+ </ul>
+ </nav>
+ <article>
+ <h2>Thread Index</h2>
+ <div id="tidx">
+ <ul>
+</THEAD>
+
+<TFOOT>
+ </ul>
+ </div>
+ </article>
+ <footer>
+ <address>Archive administrator: [email protected]</address>
+ </footer>
+</body>
+</TFOOT>
+
+
+<TOPLINKS>
+$BUTTON(PREV)$$BUTTON(NEXT)$$BUTTON(TPREV)$$BUTTON(TNEXT)$[<a
+href="$IDXFNAME$#$MSGNUM$">Date Index</a>][<a
+href="$TIDXFNAME$#$MSGNUM$">Thread Index</a>]
+<hr>
+</TOPLINKS>
+<!-- ------------------------------------------------------------------ -->
+T
+<!-- BOTLINKS -->
+<!-- -->
+<!-- BOTLINKS defines the markup for the links at the bottom of a -->
+<!-- message page. Its usage is analagous to the TOPLINKS resource, but -->
+<!-- tends to be more verbose. However, you can define the resource -->
+<!-- anyway you desire. -->
+<!-- -->
+<BOTLINKS>
+<ul>
+$LINK(PREV)$$LINK(NEXT)$
+$LINK(TPREV)$$LINK(TNEXT)$
+<li>Index(es):
+<ul>
+<li><a href="$IDXFNAME$#$MSGNUM$">
+<strong>Main</strong></a></li>
+<li><a href="$TIDXFNAME$#$MSGNUM$">
+<strong>Thread</strong></a></li>
+</ul>
+</li>
+</ul>
+</BOTLINKS>
+
+<!-- ------------------------------------------------------------------ -->
+<!-- FOLUPBEGIN, FOLUPLITXT and FOLUPEND -->
+<!-- -->
+<!-- FOLUPBEGIN defines the markup to start the explicit follow-up -->
+<!-- links after the message body on a message page. -->
+<!-- -->
+<!-- FOLUPLITXT defines the markup for an entry in the explicit -->
+<!-- follow-up links list after the message body on a message page. -->
+<!-- -->
+<!-- FOLUPEND defines the ending markup for the the explicit follow-up -->
+<!-- links after the message body on a message page. -->
+<!-- -->
+
+<FOLUPBEGIN>
+<div id="followups">
+<table>
+ <caption>Follow-Ups:</caption>
+</FOLUPBEGIN>
+
+<FOLUPLITXT>
+ <tr><td>$SUBJECT$</td><td>$FROM$</td></tr>
+</FOLUPLITXT>
+
+<FOLUPEND>
+</table>
+</div>
+</FOLUPEND>
+
+<!-- ------------------------------------------------------------------ -->
+<!-- REFSBEGIN, REFSLITXT and REFSEND -->
+<!-- -->
+<!-- REFSBEGIN defines the markup to start the explicit reference links -->
+<!-- after the message body on a message page. -->
+<!-- -->
+<!-- REFSLITXT defines the markup for an entry in the explicit -->
+<!-- reference links list after the message body on a message page. -->
+<!-- -->
+<!-- REFSEND defines the ending markup for the the explicit reference -->
+<!-- links after the message body on a message page. -->
+<!-- -->
+
+<REFSBEGIN>
+<div id="references">
+<table>
+ <caption>References:</caption>
+</REFSBEGIN>
+
+<REFSLITXT>
+ <tr><td>$SUBJECT$</td><td>$FROM$</td></tr>
+</REFSLITXT>
+
+<REFSEND>
+</table>
+</div>
+</REFSEND>
+
+<!-- ------------------------------------------------------------------ -->
+<!-- SUBJECTHEADER: -->
+<!-- -->
+<!-- SUBJECTHEADER defines the markup for the main subject line above -->
+<!-- the message header of message pages. -->
+<!-- -->
+
+<SUBJECTHEADER>
+<h1>$SUBJECTNA$</h1>
+<div id="toplinks">
+ <div id="threadtoplinks">
+ $BUTTON(TPREV)$ | $BUTTON(TNEXT)$
+ </div>
+ <div id="datetoplinks">
+ $BUTTON(PREV)$ | $BUTTON(NEXT)$
+ </div>
+</div>
+</SUBJECTHEADER>
+
+<!-- Thread element -->
+<!-- Add dates to every line in the thread view -->
+<TLiTxt>
+<li><strong>$SUBJECT$</strong>,
+<em>$FROMNAME$</em>, $MSGLOCALDATE(CUR;%Y-%m-%d %H:%M)$
+</TLiTxt>
+
+<TTopBegin>
+<li><strong>$SUBJECT$</strong>,
+<em>$FROMNAME$</em>, $MSGLOCALDATE(CUR;%Y-%m-%d %H:%M)$
+</TTopBegin>
+
+<TSingleTxt>
+<li><strong>$SUBJECT$</strong>,
+<em>$FROMNAME$</em>, $MSGLOCALDATE(CUR;%d.%m %H:%M)$
+</TSingleTxt>
--- /dev/null
+++ b/mhonarc/mhonarc.rc
@@ -1,0 +1,7 @@
+<INCLUDE>
+/home/ori/src/mkarchive/mhonarc/setup.mrc
+</INCLUDE>
+
+<INCLUDE>
+/home/ori/src/mkarchive/mhonarc/layout.mrc
+</INCLUDE>
--- /dev/null
+++ b/mhonarc/setup.mrc
@@ -1,0 +1,134 @@
+<!-- ------------------------------------------------------------------ -->
+<!-- TLEVELS: -->
+<!-- -->
+<!-- TLEVELS defines the maximum number of nested listings in a thread -->
+<!-- index. Any threads that go over TLEVELS in depth are flattened to -->
+<!-- the value of TLEVELS. This resource is helpful in preventing huge -->
+<!- indentations in deep threads which may cause text to be squished -->
+<!-- on the right-side of an HTML viewer. -->
+<!-- -->
+
+<TLEVELS>
+8
+</TLEVELS>
+
+<!-- ------------------------------------------------------------------ -->
+<!-- MIMEALTPREFS: -->
+<!-- -->
+<!-- With MIMEALTPREFS, you can tell MHonArc to use the text/plain -->
+<!-- entity (if it exists) over the text/html part with the following -->
+<!-- setting: -->
+
+<MIMEALTPREFS>
+text/plain
+text/html
+</MIMEALTPREFS>
+
+<!-- ------------------------------------------------------------------ -->
+<!-- NOMAILTO: -->
+<!-- -->
+<!-- If the MAILTO resource is on, mail addresses in message headers -->
+<!-- will be converted into mailto URL links as defined by the -->
+<!-- MAILTOURL resource. -->
+<!-- -->
+
+<NOMAILTO>
+</NOMAILTO>
+
+<!-- ------------------------------------------------------------------ -->
+<!-- MHPATTERN: -->
+<!-- -->
+<!-- This is needed to have MHonArc grok maildir folders -->
+<!-- -->
+
+<MHPATTERN>
+^[^\.]
+</MHPATTERN>
+
+<!-- ------------------------------------------------------------------ -->
+<!-- TIDXFNAME: -->
+<!-- -->
+<!-- Name of the threads index file -->
+<!-- -->
+
+<TIDXFNAME>
+index.html
+</TIDXFNAME>
+
+<!-- ------------------------------------------------------------------ -->
+<!-- IDXFNAME: -->
+<!-- -->
+<!-- Name of the message index file -->
+<!-- -->
+
+<IDXFNAME>
+seq.html
+</IDXFNAME>
+
+<!-- ------------------------------------------------------------------ -->
+<!-- MSGPREFIX: -->
+<!-- -->
+<!-- Prefix for message files -->
+<!-- -->
+
+<MSGPREFIX>
+00
+</MSGPREFIX>
+
+<!-- ------------------------------------------------------------------ -->
+<!-- NODOC: -->
+<!-- -->
+<!-- Remove link to MHonArc documentation from bottom of pages -->
+<!-- -->
+
+<NODOC>
+</NODOC>
+
+<SPAMMODE>
+
+<!-- ------------------------------------------------------------------ -->
+<!-- CHECKNOARCHIVE: -->
+<!-- -->
+<!-- If CHECKNOARCHIVE is set, MHonArc will check each message for the -->
+<!-- "no archive" flag. If present, MHonArc will not add the message to -->
+<!-- the archive. MHonArc looks for one of the following in a message -->
+<!-- header to determine if message should not be archived: -->
+<!-- -->
+<!-- X-no-archive: yes -->
+<!-- Restrict: no-external-archive -->
+<!-- -->
+<!-- If either header field is present with the given value, and -->
+<!-- CHECKNOARCHIVE is set, MHonArc will skip the message. -->
+<!-- -->
+
+<CHECKNOARCHIVE>
+<NOCHECKNOARCHIVE>
+
+<!-- ------------------------------------------------------------------ -->
+<!-- FIELDORDER: -->
+<!-- -->
+<!-- The FIELDORDER resource allows you to control the order the -->
+<!-- message header fields appear in the HTML output. -->
+<!-- -->
+<!-- If -extra- is not specified, then only the fields listed will be -->
+<!-- displayed. -->
+
+<FIELDORDER>
+subject
+from
+reply-to
+date
+to
+cc
+</FIELDORDER>
+
+<!-- ------------------------------------------------------------------ -->
+<!-- HTMLEXT: -->
+<!-- -->
+<!-- HTMLEXT defines the extension for all HTML files generated by -->
+<!-- MHonArc. -->
+<!-- -->
+
+<HTMLEXT>
+html
+</HTMLEXT>
binary files /dev/null b/mhonarc/skel/images/banner_bg.gif differ
binary files /dev/null b/mhonarc/skel/images/banner_left.gif differ
binary files /dev/null b/mhonarc/skel/images/banner_right.gif differ
--- /dev/null
+++ b/mhonarc/skel/style/screen.css
@@ -1,0 +1,169 @@
+body
+{
+ color: #000000;
+}
+
+body, td, th, div, p, h1, h2, h2, li, address
+{
+ font-family: "Lucida Grande", Verdana, Arial, Helvetica, sans-serif;
+ font-size: 12px;
+ color: #000000;
+}
+
+#mailinglists {
+ margin: 28px;
+}
+
+h1
+{
+ font-size: 16px;
+ color: #666666;
+ margin: 20px 0px 5px 0px;
+ border-bottom: 1px dotted #cccccc;
+}
+
+h2 {
+ margin-left: 8px;
+ font-size: 14px;
+ color: #666666;
+}
+
+h3, dt {
+ margin-left: 8px;
+ font-size: 12px;
+ color: #666666;
+}
+
+div.mlarchlist h4 {
+ margin: 2px 2px 2px 16px;
+ font-size: 12px;
+ font-weight:normal;
+}
+
+dd {
+ margin-top: 4px;
+ margin-bottom: 4px;
+}
+
+div.listinfo {
+ margin-left: 8px;
+ margin-right: 8px;
+ border: 1px dotted #cccccc;
+ background-color: #eee;
+}
+
+div.listinfo p {
+ margin-left: 16px;
+ margin-right: 16px;
+}
+
+address {
+ text-align: right;
+ color: #888;
+ border-top: 1px solid #aaa;
+ border-bottom: 1px solid #aaa;
+}
+
+address a {
+ text-decoration: none;
+ color: #88f;
+}
+
+
+/* /mail-archive/ */
+#toplinks {
+ margin: 0;
+ border-top: 1px solid #aaa;
+ border-bottom: 1px solid #aaa;
+ color: #aaa;
+ font-size: 80%;
+}
+
+#toplinks a {
+ text-decoration: none;
+}
+
+#threadtoplinks {
+ float: left;
+ text-align: left;
+}
+
+#datetoplinks {
+ text-align: right;
+}
+
+#headers, #message, #didx, #tidx, #references, #followups {
+ margin: 8px 0;
+ padding: 2px 10px;
+ border: 1px dotted #888;
+ background-color: #f0f0f0;
+}
+
+#headers table {
+ font-size: 80%;
+}
+
+#references caption, #followups caption {
+ text-align: left;
+ font-weight: bold;
+ font-size: 12px;
+}
+#headers table td.headername {
+ width: 90px;
+ text-align: right;
+ font-weight: bold;
+}
+
+#banner {
+ position: relative;
+ margin: 12px 23px 15px 23px;
+}
+
+#header {
+ position: relative;
+ height: 56px;
+ background: url(../images/banner_bg.gif) top left repeat-x #ffffff;
+}
+
+#header div.banner-left {
+ position: absolute;
+ top: 0px;
+ left: 0px;
+ width: 17px;
+ height: 56px;
+}
+
+#header div.banner-text {
+ position: absolute;
+ left: 20px;
+ bottom: 12px;
+ font-size: 18px;
+ color: #ebebeb;
+}
+
+#header div.banner-right {
+ position: absolute;
+ right: 0px;
+ top: 0px;
+ width: 10px;
+ height: 56px;
+}
+
+#topnav {
+ position: absolute;
+ right: 20px;
+ bottom: 8px;
+ text-align: right;
+ color: #ebebeb;
+ font-size: 11px;
+}
+
+#topnav a {
+ color: #ebebeb;
+ font-size: 11px;
+ text-decoration: none;
+}
+
+#topnav a:hover {
+ text-decoration: underline;
+}
--- /dev/null
+++ b/mkarchive.py
@@ -1,0 +1,84 @@
+#!/usr/bin/env python
+import argparse
+import os
+import errno
+import subprocess
+import time
+import distutils.dir_util
+
+p = argparse.ArgumentParser(description = 'Generate a mail archive')
+p.add_argument('-o', '--outdir', metavar='outdir', help='generate archive under this user')
+p.add_argument('-m', '--mlmmjdir', metavar='listdir', help='generate archives for this list')
+p.add_argument('-M', '--mhonarc', metavar='mhonarc', default='/usr/bin/mhonarc', help='path to mhonarc binary')
+p.add_argument('-c', '--configdir', metavar='mhonarc', help='path to mhonarc config dir')
+p.add_argument('listname', help='', nargs='?')
+opts = p.parse_args()
+
+def mailmonth(mail):
+ return time.strftime("%b-%Y", time.gmtime(os.path.getmtime(mail)))
+
+def runmailadd(lst, mail):
+ outdir = os.path.join(opts.outdir, lst, mailmonth(mail))
+ mhonarc_cmd = [
+ opts.mhonarc,
+ '-title', lst,
+ '-rcfile', os.path.join(opts.configdir, 'mhonarc.rc'),
+ '-outdir', outdir,
+ '-add'
+ ]
+
+ distutils.dir_util.mkpath(outdir)
+ print 'runing mhonarc with command %s' % mhonarc_cmd
+ mhonarc = subprocess.Popen(mhonarc_cmd, stdin=subprocess.PIPE)
+ with open(mail) as f:
+ mhonarc.communicate(f.read())
+ mhonarc.wait()
+
+def addmail(lst):
+ listdir = os.path.join(opts.outdir, lst)
+ lastadded = os.path.join(listdir, '.lastindex')
+ lastindex = 0
+ if os.access(lastadded, os.R_OK):
+ with open(lastadded, 'r') as f:
+ lastindex = int(f.read())
+ maxindex = lastindex
+ maildir = os.path.join(opts.mlmmjdir, lst, "archive")
+ print maildir
+ for p in os.listdir(maildir):
+ if int(p) <= lastindex:
+ print "already added ", p
+ continue
+ mailfile = os.path.join(maildir, p)
+ runmailadd(lst, mailfile)
+ maxindex = max(lastindex, int(p))
+ with open(lastadded, 'w') as f:
+ f.write(str(maxindex))
+
+def genindex(lst):
+ listdir = os.path.join(opts.outdir, lst)
+ with open(os.path.join(listdir, 'index.html'), 'w') as f:
+ f.write("""
+ <html>
+ <head>
+ <title>List Archive: %s</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <link rel="stylesheet" href="/style.css" />
+ </head>
+ <body>
+ <header><h1>Eigenstate: %s list archives</h1></header>
+ <article><ul>""" % (lst, lst))
+ for d in os.listdir(listdir):
+ if os.path.isdir(os.path.join(listdir, d)):
+ f.write('<li><a href=%s>%s</a></li>' % (d, d))
+ f.write("""
+ </ul>
+ </article>
+ <footer>Hey, look at me! I'm a footer!</footer>
+ </body></html>""")
+
+def main():
+ addmail('myrddin-dev')
+ genindex('myrddin-dev')
+
+if __name__ == '__main__':
+ main()