use of python std functions
Former-commit-id: b914354d3226c57eb0cb3ecf27a8037425c6cae9
This commit is contained in:
parent
da30e65c29
commit
89f2e8426b
@ -78,20 +78,13 @@ def findSentence(content, position):
|
||||
quoteStack.pop()
|
||||
elif c in quotesFwd:
|
||||
quoteStack.insert(0, quotesFwd[c])
|
||||
cend = len(content)
|
||||
translation_start = 0
|
||||
for i in xrange(end, cend):
|
||||
if content[i] == '\t':
|
||||
translation_start = i+1
|
||||
break
|
||||
translation_end = cend
|
||||
for i in xrange(translation_start, cend):
|
||||
if content[i] == '\n':
|
||||
translation_end = i
|
||||
break
|
||||
translation = ''
|
||||
if translation_start > 0:
|
||||
translation = content[translation_start:translation_end].strip()
|
||||
translationStart = content.find('\t',end)
|
||||
if translationStart >= 0:
|
||||
translationEnd = content.find('\n',translationStart)
|
||||
if translationEnd == -1:
|
||||
translationEnd = len(content)
|
||||
translation = content[translationStart+1:translationEnd].strip()
|
||||
return content[start:end].strip(), translation
|
||||
|
||||
|
||||
@ -121,6 +114,7 @@ def markupVocabExp(definition):
|
||||
'reading': definition['reading'] or unicode(),
|
||||
'glossary': definition['glossary'],
|
||||
'sentence': definition.get('sentence'),
|
||||
'translation': definition.get('translation'),
|
||||
'summary': summary
|
||||
}
|
||||
|
||||
@ -132,6 +126,7 @@ def markupVocabReading(definition):
|
||||
'reading': unicode(),
|
||||
'glossary': definition['glossary'],
|
||||
'sentence': definition.get('sentence'),
|
||||
'translation': definition.get('translation'),
|
||||
'summary': definition['reading']
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user