Commit 8fc7a80a authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Add the post processing remove_undef, clean and fix a bug in the view list.tex.

parent 41c03c89
......@@ -15,12 +15,26 @@
its current representation
record
The record
The record: record[tablename][fieldname]
or record.tablename.fieldname
Each function must return a string with the new record
representation.
"""
import plugin_dbui
import re
from gluon import current
def clean(value, template, record):
value = re.sub(', *,', ',', value) # ",," or ", ," or ...
value = re.sub(' *, *', ', ', value) # " ,"
value = re.sub(',$', '', value) # comma at the end of string
return value
def highlight_cppm_authors(value, template, record):
li = record.publications.authors_cppm.split(',')
......@@ -29,4 +43,10 @@ def highlight_cppm_authors(value, template, record):
author = author.strip()
value = value.replace(author, '<u>%s</u>' % author)
return value
\ No newline at end of file
return value
def remove_undef(value, template, record):
undef = current.T(plugin_dbui.UNDEF)
return re.sub(', *%s *,' % undef, ',', value)
\ No newline at end of file
......@@ -46,16 +46,16 @@
for record in paths_data[key]:
s = record.replace('<br>', '')
s = s.replace('<b>', '\textbf{').replace('</b>', '}')
s = s.replace('<b>', '\\textbf{').replace('</b>', '}')
s = s.replace('<i>', '\emph{').replace('</i>', '}')
s = s.replace('<u>', '\underline{').replace('</u>', '}')
s = s.replace("<span style='font-style: italic;'>", '\textit{')
s = s.replace("<span style='font-weight: bold;'>", '\textbf{')
s = s.replace("<span style='font-style: italic;'>", '\\textit{')
s = s.replace("<span style='font-weight: bold;'>", '\\textbf{')
s = s.replace("<span style='text-decoration: underline;'>", '\underline{')
s = s.replace('<span style="font-style: italic;">', '\textit{')
s = s.replace('<span style="font-weight: bold;">', '\textbf{')
s = s.replace('<span style="font-style: italic;">', '\\textit{')
s = s.replace('<span style="font-weight: bold;">', '\\textbf{')
s = s.replace('<span style="text-decoration: underline;">', '\underline{')
s = s.replace('</span>', '}')
......
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