Browse Source

Fix #1949 (#1950)

pull/1962/head
Victor Fabre 7 years ago
committed by Edward
parent
commit
8057306e15
  1. 3
      sapl/relatorios/views.py
  2. 11
      sapl/utils.py

3
sapl/relatorios/views.py

@ -795,7 +795,8 @@ def relatorio_sessao_plenaria(request, pk):
for idx in range(len(lst_expedientes)):
txt_expedientes = lst_expedientes[idx]['txt_expediente']
txt_expedientes = TrocaTag(txt_expedientes, '<table', 'table>', 6, 6, 'expedientes')
txt_expedientes = TrocaTag(txt_expedientes, '<table', 'table>', 6, 6,
'expedientes', '</para><blockTable style = "', 'blockTable><para>')
lst_expedientes[idx]['txt_expediente'] = txt_expedientes
pdf = pdf_sessao_plenaria_gerar.principal(

11
sapl/utils.py

@ -688,7 +688,7 @@ def ExtraiTag(texto, posicao):
return i + 1
def TrocaTag(texto, startTag, endTag, sizeStart, sizeEnd, styleName):
def TrocaTag(texto, startTag, endTag, sizeStart, sizeEnd, styleName, subinitiTag, subendTag):
textoSaida = ''
insideTag = 0
i = 0
@ -697,16 +697,19 @@ def TrocaTag(texto, startTag, endTag, sizeStart, sizeEnd, styleName):
if '<tbody>' in texto:
texto = texto.replace('<tbody>', '')
texto = texto.replace('</tbody>', '')
if '<p>' in texto:
texto = texto.replace('<p>', '')
texto = texto.replace('</p>', '')
while (i < len(texto)):
shard = texto[i:i + sizeStart]
if (shard == startTag):
i = ExtraiTag(texto, i)
textoSaida += '</para><blockTable style = "' + styleName + '">'
textoSaida += subinitiTag + styleName + '">'
insideTag = 1
else:
if (insideTag == 1):
if (texto[i:i + sizeEnd] == endTag):
textoSaida += 'blockTable><para>'
textoSaida += subendTag
insideTag = 0
i += sizeEnd
else:
@ -735,4 +738,4 @@ def RemoveTag(texto):
return textoSaida
def remover_acentos(string):
return unicodedata.normalize('NFKD', string).encode('ASCII', 'ignore').decode()
return unicodedata.normalize('NFKD', string).encode('ASCII', 'ignore').decode()

Loading…
Cancel
Save