legi2pdf: don't balance last part of BQR

This commit is contained in:
Frédéric Péters 2014-11-27 10:42:46 +01:00
parent da6f1b7fdb
commit 53ae4db926
1 changed files with 13 additions and 12 deletions

View File

@ -304,18 +304,19 @@ def convertLegi2Tex(input, outputFileName, annexes, d, draft=0, toc=True,
(u'TABELLIO--', u'\hyp{}'),]:
doc = doc.replace(before, after)
# look for end of parts and change the multicol environment not to have
# balanced columns
parts = doc.split('\n% end part')
for i, part in enumerate(parts):
if i == 0:
continue
parts[i] = part.replace(r'\end{multicols}', r'\end{multicols*}', 1)
reversed_previous_part = parts[i-1][::-1]
reversed_previous_part = reversed_previous_part.replace(
r'\begin{multicols}'[::-1], r'\begin{multicols*}'[::-1], 1)
parts[i-1] = reversed_previous_part[::-1]
doc = '\n% adjusted end part'.join(parts)
if not style == 'bqr':
# look for end of parts and change the multicol environment not to have
# balanced columns
parts = doc.split('\n% end part')
for i, part in enumerate(parts):
if i == 0:
continue
parts[i] = part.replace(r'\end{multicols}', r'\end{multicols*}', 1)
reversed_previous_part = parts[i-1][::-1]
reversed_previous_part = reversed_previous_part.replace(
r'\begin{multicols}'[::-1], r'\begin{multicols*}'[::-1], 1)
parts[i-1] = reversed_previous_part[::-1]
doc = '\n% adjusted end part'.join(parts)
outputStream.write(doc.encode('utf-8'))
finally: