Re: [Zope-dev] small manuel bugfix

2010-01-06 Thread Benji York
On Fri, Dec 25, 2009 at 9:37 PM, Chris McDonough  wrote:
> I added a branch of manuel to the Zope SVN that fixes the codeblock plugin 
> when
> you use codeblock "roles" such as:

I've released Manuel 1.0.3 which includes this fix.
-- 
Benji York
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] small manuel bugfix

2009-12-26 Thread Chris McDonough
Benji York wrote:
> On Fri, Dec 25, 2009 at 10:31 PM, Chris McDonough  wrote:
>> Yeah.  I'm a fan of unit tests.
> 
> Yep, me too.  To be clear, I do want unit tests in the form of a doctest (like
> http://svn.zope.org/manuel/trunk/src/manuel/bugs.txt?view=markup).  Which may
> be the best place for this test.

I just added tests for the find_code_blocks function to the chrism-codeblock 
branch in the form of non-doctest unit tests.

- C
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] small manuel bugfix

2009-12-26 Thread Benji York
On Fri, Dec 25, 2009 at 10:31 PM, Chris McDonough  wrote:
> Yeah.  I'm a fan of unit tests.

Yep, me too.  To be clear, I do want unit tests in the form of a doctest (like
http://svn.zope.org/manuel/trunk/src/manuel/bugs.txt?view=markup).  Which may
be the best place for this test.

Thanks.
-- 
Benji York
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] small manuel bugfix

2009-12-25 Thread Chris McDonough
Benji York wrote:
> On Fri, Dec 25, 2009 at 9:37 PM, Chris McDonough  wrote:
>> I added a branch of manuel to the Zope SVN that fixes the codeblock plugin 
>> when
>> you use codeblock "roles" such as:
> 
> Looks good.  Add tests and I'll merge and release your branch.

Sorry about the no-tests thing. :-(

> I'm not sure what form the tests should take.  There's probably no need
> to reflect this in the documentation, so non-documentation flavored
> tests are appropriate.

Yeah.  I'm a fan of unit tests.

- C
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] small manuel bugfix

2009-12-25 Thread Benji York
On Fri, Dec 25, 2009 at 9:37 PM, Chris McDonough  wrote:
> I added a branch of manuel to the Zope SVN that fixes the codeblock plugin 
> when
> you use codeblock "roles" such as:

Looks good.  Add tests and I'll merge and release your branch.

I'm not sure what form the tests should take.  There's probably no need
to reflect this in the documentation, so non-documentation flavored
tests are appropriate.
-- 
Benji York
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] small manuel bugfix

2009-12-25 Thread Chris McDonough
Ugh, that patch is rendered backwards... but you get the idea.

Chris McDonough wrote:
> I added a branch of manuel to the Zope SVN that fixes the codeblock plugin 
> when 
> you use codeblock "roles" such as:
> 
> .. code-block:: python
> :linenos:
> 
> Currently it only works without roles, e.g.:
> 
> .. code-block:: python
> 
> The branch is at 
> svn+ssh://svn.zope.org/repos/main/manuel/branches/chrism-codeblocks
> 
> The diff against the current head is as follows:
> 
> [chr...@snowpro manuel]$ svn diff 
> ===
> --- src/manuel/codeblock.py   (.../branches/chrism-codeblocks)
> (revision 107071)
> +++ src/manuel/codeblock.py   (.../trunk) (revision 107071)
> @@ -2,9 +2,7 @@
>   import manuel
>   import textwrap
> 
> -CODEBLOCK_START = re.compile(
> -r'(^\.\.\s*(invisible-)?code-block::?\s*python\b(?:\s*\:\w+\:)*)',
> -re.MULTILINE)
> +CODEBLOCK_START = 
> re.compile(r'^\.\.\s*(invisible-)?code-block::?\s*python\b', 
> re.MULTILINE)
>   CODEBLOCK_END = re.compile(r'(\n\Z|\n(?=\S))')
> 
> 
> @@ -15,8 +13,7 @@
> 
>   def find_code_blocks(document):
>   for region in document.find_regions(CODEBLOCK_START, CODEBLOCK_END):
> -start_end = CODEBLOCK_START.search(region.source).end()
> -source = textwrap.dedent(region.source[start_end:])
> +source = textwrap.dedent('\n'.join(region.source.splitlines()[1:]))
>   source_location = '%s:%d' % (document.location, region.lineno)
>   code = compile(source, source_location, 'exec', 0, True)
>   document.claim_region(region)
> 
> I submit it for Benji's consideration.
> ___
> Zope-Dev maillist  -  Zope-Dev@zope.org
> https://mail.zope.org/mailman/listinfo/zope-dev
> **  No cross posts or HTML encoding!  **
> (Related lists - 
>  https://mail.zope.org/mailman/listinfo/zope-announce
>  https://mail.zope.org/mailman/listinfo/zope )
> 

___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


[Zope-dev] small manuel bugfix

2009-12-25 Thread Chris McDonough
I added a branch of manuel to the Zope SVN that fixes the codeblock plugin when 
you use codeblock "roles" such as:

.. code-block:: python
:linenos:

Currently it only works without roles, e.g.:

.. code-block:: python

The branch is at 
svn+ssh://svn.zope.org/repos/main/manuel/branches/chrism-codeblocks

The diff against the current head is as follows:

[chr...@snowpro manuel]$ svn diff 
===
--- src/manuel/codeblock.py (.../branches/chrism-codeblocks)
(revision 107071)
+++ src/manuel/codeblock.py (.../trunk) (revision 107071)
@@ -2,9 +2,7 @@
  import manuel
  import textwrap

-CODEBLOCK_START = re.compile(
-r'(^\.\.\s*(invisible-)?code-block::?\s*python\b(?:\s*\:\w+\:)*)',
-re.MULTILINE)
+CODEBLOCK_START = re.compile(r'^\.\.\s*(invisible-)?code-block::?\s*python\b', 
re.MULTILINE)
  CODEBLOCK_END = re.compile(r'(\n\Z|\n(?=\S))')


@@ -15,8 +13,7 @@

  def find_code_blocks(document):
  for region in document.find_regions(CODEBLOCK_START, CODEBLOCK_END):
-start_end = CODEBLOCK_START.search(region.source).end()
-source = textwrap.dedent(region.source[start_end:])
+source = textwrap.dedent('\n'.join(region.source.splitlines()[1:]))
  source_location = '%s:%d' % (document.location, region.lineno)
  code = compile(source, source_location, 'exec', 0, True)
  document.claim_region(region)

I submit it for Benji's consideration.
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )