From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1QZIeA-0002ka-6Y for garchives@archives.gentoo.org; Wed, 22 Jun 2011 08:18:50 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id BEFDF1C124; Wed, 22 Jun 2011 08:18:27 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 933CC1C01D for ; Wed, 22 Jun 2011 08:18:27 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 19CF71B4004 for ; Wed, 22 Jun 2011 08:18:27 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 73EA48003E for ; Wed, 22 Jun 2011 08:18:26 +0000 (UTC) From: "Michał Górny" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Michał Górny" Message-ID: <29193394995ad2aa7a3aa6a0a9da16b6fbe9a370.mgorny@gentoo> Subject: [gentoo-commits] proj/pms-test-suite:master commit in: / X-VCS-Repository: proj/pms-test-suite X-VCS-Files: setup.py X-VCS-Directories: / X-VCS-Committer: mgorny X-VCS-Committer-Name: Michał Górny X-VCS-Revision: 29193394995ad2aa7a3aa6a0a9da16b6fbe9a370 Date: Wed, 22 Jun 2011 08:18:26 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: 2bb257aab848290207a530ebf963b4b3 commit: 29193394995ad2aa7a3aa6a0a9da16b6fbe9a370 Author: Micha=C5=82 G=C3=B3rny gentoo org> AuthorDate: Wed Jun 22 06:50:32 2011 +0000 Commit: Micha=C5=82 G=C3=B3rny gentoo org> CommitDate: Wed Jun 22 06:50:32 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/pms-test-suit= e.git;a=3Dcommit;h=3D29193394 Grep title from Markdown header. --- setup.py | 19 +++++++++++++++++-- 1 files changed, 17 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index aa0e9f5..a9beac7 100755 --- a/setup.py +++ b/setup.py @@ -34,7 +34,20 @@ class DocCommand(Command): sys.exit(1) =20 class PMSTSExts(markdown.Extension): + class TitleGrepper(markdown.treeprocessors.Treeprocessor): + def __init__(self, ska): + self._ska =3D ska + + def run(self, root): + for c in root: + if c.tag =3D=3D "h1": + self._ska.title =3D c.text + break + return root + class HTMLSkelAdder(markdown.postprocessors.Postprocessor): + title =3D '' + def run(self, text): return ''' @@ -42,12 +55,14 @@ class DocCommand(Command): %s -''' % 'XXX' + text + ''' +''' % self.title + text + ''' ''' =20 def extendMarkdown(self, md, md_globals): - md.postprocessors.add('htmlskeladder', self.HTMLSkelAdder(), '_end') + ska =3D self.HTMLSkelAdder() + md.postprocessors.add('htmlskeladder', ska, '_end') + md.treeprocessors.add('titlegrepper', self.TitleGrepper(ska), '_end'= ) =20 m =3D markdown.Markdown(extensions =3D [PMSTSExts()]) for f in self.docs: