Re: [AD] genexamp.py minor problem

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On Wed, 2005-04-20 at 11:55 +0200, Evert Glebbeek wrote:
> The expackf example has a two line credit list. The genexamp.py script 
> doesn't handle this properly at the moment: it assumes the second line is 
> part of the example description. The fix would be to skip until the first 
> blank line after the opening credits.
> I worked around this for now by simply not applying the offending patch 
> because my Python skills are too weak (as in, non existant) to do anything 
> about it.
> 

Here's the patch. You need no skills to edit python code, that's the
nice thing about it :) I simply added a while loop to discard everything
to the next empty line if it finds a credits line.

-- 
Elias Pschernig
Index: misc/genexamp.py
===================================================================
RCS file: /cvsroot/alleg/allegro/misc/genexamp.py,v
retrieving revision 1.10
diff -u -p -r1.10 genexamp.py
--- misc/genexamp.py	11 Apr 2005 11:51:56 -0000	1.10
+++ misc/genexamp.py	20 Apr 2005 10:42:56 -0000
@@ -153,8 +153,11 @@ def retrieve_source_data(file_name):
 
    # post-process comment, removing initial credits
    while len(comment):
-      if not string.strip(comment[0]) or comment_line.search(comment[0]):
+      if string.strip(comment[0]) == "":
          comment.pop(0)
+      elif comment_line.search(comment[0]):
+         while len(comment) and string.strip(comment[0]) != "":
+            comment.pop(0)
       else:
          break
    return comment, dic


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/