From commits-return-49265-archive-asf-public=cust-asf.ponee.io@subversion.apache.org Thu Sep 13 22:12:40 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 03F9D18067E for ; Thu, 13 Sep 2018 22:12:39 +0200 (CEST) Received: (qmail 88594 invoked by uid 500); 13 Sep 2018 20:12:39 -0000 Mailing-List: contact commits-help@subversion.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@subversion.apache.org Delivered-To: mailing list commits@subversion.apache.org Received: (qmail 88584 invoked by uid 99); 13 Sep 2018 20:12:39 -0000 Received: from Unknown (HELO svn01-us-west.apache.org) (209.188.14.144) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 13 Sep 2018 20:12:39 +0000 Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id 77A713A07E6 for ; Thu, 13 Sep 2018 20:12:38 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1840861 - /subversion/trunk/tools/dist/changes-to-html.py Date: Thu, 13 Sep 2018 20:12:38 -0000 To: commits@subversion.apache.org From: brane@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20180913201238.77A713A07E6@svn01-us-west.apache.org> Author: brane Date: Thu Sep 13 20:12:37 2018 New Revision: 1840861 URL: http://svn.apache.org/viewvc?rev=1840861&view=rev Log: Added a simple script to convert the CHANGES file to HTML. * tools/dist/changes-to-html.py: New file. Added: subversion/trunk/tools/dist/changes-to-html.py (with props) Added: subversion/trunk/tools/dist/changes-to-html.py URL: http://svn.apache.org/viewvc/subversion/trunk/tools/dist/changes-to-html.py?rev=1840861&view=auto ============================================================================== --- subversion/trunk/tools/dist/changes-to-html.py (added) +++ subversion/trunk/tools/dist/changes-to-html.py Thu Sep 13 20:12:37 2018 @@ -0,0 +1,88 @@ +#!/usr/bin/env python +# python: coding=utf-8 +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +import re +import sys + + +HEADER = """ + +CHANGES + + + +
+"""
+
+FOOTER = """
+ + +""" + + +url_rx = re.compile(r'(?:^|(?<=\W))(https?://[\w\d./?&=]+)') +url_sub = r'\1' + +issue_rx = re.compile(r'(?<=\W)(#(\d+))') +issue_sub = r'\1' + +revision_rx = re.compile(r'(?:^|(?<=\W))(r\d+)') +revision_sub = r'\1' + +branchtag_rx = re.compile(r'(?<=\W)(/(?:branches|tags)/[\w\d.]+)') +branchtag_sub = r'\1' + + +def generate(stream): + sys.stdout.write(HEADER) + + beginning = True + for n in stream.readlines(): + # Skip initial comments and empty lines in the CHANGES file. + n = n.rstrip() + if beginning and (not n or n.startswith('#')): + continue + beginning = False + + n = url_rx.sub(url_sub, n) + n = issue_rx.sub(issue_sub, n) + n = revision_rx.sub(revision_sub, n) + n = branchtag_rx.sub(branchtag_sub, n) + + sys.stdout.write(n) + sys.stdout.write('\n') + + sys.stdout.write(FOOTER) + + +def generate_from(filenme): + with open(filenme, 'rt') as stream: + return generate(stream) + + +def main(): + if len(sys.argv) < 2 or sys.argv[1] == '-': + return generate(sys.stdin) + else: + return generate_from(sys.argv[1]) + +if __name__ == '__main__': + main() Propchange: subversion/trunk/tools/dist/changes-to-html.py ------------------------------------------------------------------------------ svn:eol-style = native Propchange: subversion/trunk/tools/dist/changes-to-html.py ------------------------------------------------------------------------------ svn:executable = *