Commit 124b96d7 authored by Bartek Górny's avatar Bartek Górny

fix - if the last found word was close to the end, the last part was not returned

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@10709 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent ef070390
......@@ -45,7 +45,8 @@ def generateParts(context,text,sw,tags,trail,maxlines):
sw=sw.translate(tr).strip().split()
test=lambda w:w.translate(tr).strip().lower() in sw
i=0
for aw in text:
length=len(text)
for counter,aw in enumerate(text):
if i==maxlines:
raise StopIteration
if test(aw):
......@@ -57,6 +58,10 @@ def generateParts(context,text,sw,tags,trail,maxlines):
i+=1
yield par
par=Part(tags,trail)
if counter==length-1:
if par.has:
par.chain.reverse()
yield par # return the last marked part
def cutFound(context,txt,sw,tags,trail,maxlines):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment