From ooo-dev-return-1706-apmail-incubator-ooo-dev-archive=incubator.apache.org@incubator.apache.org Wed Jul 6 18:43:20 2011 Return-Path: X-Original-To: apmail-incubator-ooo-dev-archive@minotaur.apache.org Delivered-To: apmail-incubator-ooo-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id F31206A0C for ; Wed, 6 Jul 2011 18:43:19 +0000 (UTC) Received: (qmail 6693 invoked by uid 500); 6 Jul 2011 18:43:19 -0000 Delivered-To: apmail-incubator-ooo-dev-archive@incubator.apache.org Received: (qmail 6651 invoked by uid 500); 6 Jul 2011 18:43:19 -0000 Mailing-List: contact ooo-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ooo-dev@incubator.apache.org Delivered-To: mailing list ooo-dev@incubator.apache.org Received: (qmail 6632 invoked by uid 99); 6 Jul 2011 18:43:19 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 06 Jul 2011 18:43:19 +0000 X-ASF-Spam-Status: No, hits=0.0 required=5.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [98.139.213.161] (HELO nm24-vm0.bullet.mail.bf1.yahoo.com) (98.139.213.161) by apache.org (qpsmtpd/0.29) with SMTP; Wed, 06 Jul 2011 18:43:10 +0000 Received: from [98.139.212.153] by nm24.bullet.mail.bf1.yahoo.com with NNFMP; 06 Jul 2011 18:42:47 -0000 Received: from [98.139.212.217] by tm10.bullet.mail.bf1.yahoo.com with NNFMP; 06 Jul 2011 18:42:47 -0000 Received: from [127.0.0.1] by omp1026.mail.bf1.yahoo.com with NNFMP; 06 Jul 2011 18:42:47 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 149250.51024.bm@omp1026.mail.bf1.yahoo.com Received: (qmail 5026 invoked by uid 60001); 6 Jul 2011 18:42:47 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1309977767; bh=HIv8Oxn60m9F5kGP03NuIQXVbCY83Qc07Pdv9+LOTk4=; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type; b=QMngc1QeNYbTdDBYXLufqWCD/kqm4nEo1vLUnv22dZd5TPOt8dLF2V7KPwDAgI44ep4Vbjl1SRLmkdXwNhq32WCrelDb7HvPd7YUGlimJjG8NSUL+0iGmpwhDeDt/PlnwFQwRIBMfh+J10lh04T6hqt0DRUPln71zZgaNdEo3Co= DomainKey-Signature:a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type; b=4l/jfI5S7K4ioyQAvLkDofvtKVdDCdcyJN50OPndQcQFVj0yeaTMG+mrmcA4QN5QmHU9ROh9ZXlIzM9HgEEMlsBVJq+IhxymV7eUo3ryHEmRCJ57Vyik/14oGBHkJGmiPFaH7RwX/dfYDGt8PRN/y+r04IpCl9M1RITtNSYqzsI=; Message-ID: <76517.4500.qm@web161424.mail.bf1.yahoo.com> X-YMail-OSG: UogQaLAVM1kZE52nDJDNFOzTvPJG804FztNUa6xLYCxjgqo ZVBdNsaSibDiypCPdmxZ7lbP7pVQSpcZRTBhFJR1rOcPrl3fY0cdO_8zQUyX v4ThbCt4BZPUHjz0sWWf_SqsgIxBKnjDiog_ZiJfUaVPd25VJwKHPR7vjgY7 7A3bIlhFGA4KuXQ6Bfu7u7kTXZV28HxWtBfWqAJColFwiEe1ut51B2Ei6cgv 0Mcj2cjV07ULfxW3GkJdSn5zAcYISSJ9KtcwCG..pcbZNSyycUA7K_Truy0l lMaGbQM.KFu63hhBOPPVn9yWTJDMVO3srysZ3c9wXGWU4_v649rLS8Yq6cgQ ZbRrGU28mGRFH7_pOAXvk6wnZI6NLOhbiFrOgMvF0EJJoKg6FMUxmvp8IIkU bSRhuDzKlroWWG9JUbrTTQP8wLBXGu83r7i__wCregpur.XGLONEMGMcSYWv O9JreirFdqpQEzlk2j1OA9HKJiwnUkl7LiYdkKmOZe44XI9jUQE2WxPXWIId IePeXG0J.MGoA7HXRGAf8YtSLir6Oynmwd6CqJFXCoOB5Z2LF3Dg- Received: from [99.135.28.65] by web161424.mail.bf1.yahoo.com via HTTP; Wed, 06 Jul 2011 11:42:46 PDT X-Mailer: YahooMailWebService/0.8.111.304355 Date: Wed, 6 Jul 2011 11:42:46 -0700 (PDT) From: Joe Schaefer Subject: Re: svn commit: r1142819 - /incubator/ooo/site/trunk/content/openofficeorg/people.mdtext To: "ooo-dev@incubator.apache.org" MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Checked: Checked by ClamAV on apache.org To test you just install the python markdown package and execute the script from the command line. Sent from my iPhone On Jul 6, 2011, at 2:38 PM, Dave Fisher wrote: Joe, Submit a patch to infrastructure@ plaese. I would, but I am uncomfortable submitting untested code. I need some help setting up a version of the CMS for testing. I think that others here may have a similar need. Thanks. Anyway if you want to debug what I did here is a diff compared to mdx_elementid.py: --- mdx_elementid.py 2011-07-06 10:43:22.000000000 -0700 +++ mdx_classtag.py 2011-07-05 18:34:32.000000000 -0700 @@ -1,39 +1,39 @@ #! ''' -id Extension for Python-Markdown +classtag Extension for Python-Markdown ========================================== -This extension adds ids to block elements in Python-Markdown. +This extension adds class tags to block elements in Python-Markdown. Simple Usage: import markdown text = """ - ... list: {#list.1} + ... list: {.list.1} ... - ... 1. This is a test {#node1} - ... 2. Other {#node2} + ... 1. This is a test {.node1} + ... 2. Other {#.node2} ... ... More ... """ - >>> markdown.markdown(text, ['toc','elementid']) - u'

list:

\\n
    \\n
  1. This is a test
  2. \\n
  3. Other
  4. \\n
\\n

More

' - >>> text2 = u"""Spain {#el1} + >>> markdown.markdown(text, ['toc','classtag']) + u'

list:

\\n
    \\n
  1. This is a test
  2. \\n
  3. Other
  4. \\n
\\n

More

' + >>> text2 = u"""Spain {.el1} ... : Name of a country ... in the South West of Europe ... - ... Espa\xf1a {#el2} + ... Espa\xf1a {.el2} ... : Name of Spain ... in Spanish (contains non-ascii) ... ... End of definition list... ... """ - >>> markdown.markdown(text2, ['toc','elementid', 'def_list']) - u'
\\n
Spain
\\n
Name of a country\\n in the South West of Europe
\\n
Espa\\xf1a
\\n
Name of Spain\\n in Spanish (contains non-ascii)
\\n
\\n

End of definition list...

' - + >>> markdown.markdown(text2, ['toc','classtag', 'def_list']) + u'
\\n
Spain
\\n
Name of a country\\n in the South West of Europe
\\n
Espa\\xf1a
\\n
Name of Spain\\n in Spanish (contains non-ascii)
\\n
\\n

End of definition list...

' +Based on mdx_elementid.py Copyright 2010 * [Santiago Gala](http://memojo.com/~sgala/blog/) @@ -46,52 +46,52 @@ ID_RE = re.compile(r"""[ \t]* # optional whitespace [#]{0,6} # end of heading [ \t]* # optional whitespace - (?:[ \t]*\{[ \t]*\#(?P[-._:a-zA-Z0-9]+)[ \t]*\}) + (?:[ \t]*\{[ \t]*\.(?P[-._:a-zA-Z0-9]+)[ \t]*\}) [ \t]* # optional whitespace (\n|$) # ^^ group('id') = id attribute """, re.VERBOSE) -class IdTreeProcessor(markdown.treeprocessors.Treeprocessor): - """ Id Treeprocessor - parse text for id specs. """ +class ClasstagTreeProcessor(markdown.treeprocessors.Treeprocessor): + """ Classtag Treeprocessor - parse text for classtag specs. """ - def _parseID(self, element): - ''' recursively parse all {#idname}s at eol into ids ''' + def _parseClasstag(self, element): + ''' recursively parse all {.classtag}s at eol into ids ''' if markdown.isBlockLevel(element.tag) and element.tag not in ['code', 'pre']: #print element if (element.text and element.text.strip()): m = ID_RE.search(element.text) if m: - element.set('id',m.group('id')) + element.set('classtag',m.group('classtag')) element.text = element.text[:m.start()] for e in element: - self._parseID(e) + self._parseClasstag(e) return element def run(self, root): ''' - Find and remove all id specs references from the text, - and add them as the id attribute of the element. + Find and remove all classtag specs references from the text, + and add them as the class attribute of the element. ''' if markdown.isBlockLevel(root.tag) and root.tag not in ['code', 'pre']: - self._parseID(root) + self._parseClasstag(root) return root -class IdExtension(markdown.Extension): - """ Id Extension for Python-Markdown. """ +class ClasstagExtension(markdown.Extension): + """ Classtag Extension for Python-Markdown. """ def extendMarkdown(self, md, md_globals): - """ Insert IdTreeProcessor in tree processors. It should be before toc. """ - idext = IdTreeProcessor(md) - idext.config = self.config - md.treeprocessors.add("elid", idext, "_begin") + """ Insert ClasstagTreeProcessor in tree processors. It should be before toc. """ + classtagext = ClasstagTreeProcessor(md) + classtagext.config = self.config + md.treeprocessors.add("elid", classtagext, "_begin") def makeExtension(configs=None): - return IdExtension(configs=configs) + return ClasstagExtension(configs=configs) if __name__ == "__main__": import doctest Regards, Dave Sent from my iPhone On Jul 5, 2011, at 11:46 PM, Dave Fisher wrote: Hi Joe, I've made what I think is an appropriate edit to create an mdx_classtag.py. (1) Basically id was converted to classtag all over. (class is a reserved word.) (2) The appropriate # was changed to . in the regex (I hope) What would be my easiest strategy for testing it on my people.a.o account? Is it as simple as downloading the proper part of the repos? Regards, Dave On Jul 5, 2011, at 2:11 PM, Joe Schaefer wrote: ----- Original Message ---- From: Dave Fisher To: ooo-dev@incubator.apache.org Cc: ooo-commits@incubator.apache.org Sent: Tue, July 5, 2011 4:57:36 PM Subject: Re: svn commit: r1142819 - /incubator/ooo/site/trunk/content/openofficeorg/people.mdtext Hi Joe, Thanks for all the CMS tips. I see from this commit that # {#foo} is inserted into the table header html as . Would # {.bar} add class="bar"? Not as it's currently implemented, no. What you want to look at is the source for mdx_elementid.py as it's a custom extension of our markdown impl. If you hack it to do what you want, and your code doesn't suck, I'll apply the patch. The source is here https://svn.apache.org/repos/infra/websites/cms/build/mdx_elementid.py .