Commit ead37349 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

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

parent 41c03c89
......@@ -15,12 +15,19 @@
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 highlight_cppm_authors(value, template, record):
li = record.publications.authors_cppm.split(',')
......@@ -29,4 +36,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
......@@ -50,13 +50,13 @@
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='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='text-decoration: underline;'>", '\\underline{')
s = s.replace('<span style="font-style: italic;">', '\textit{')
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="text-decoration: underline;">', '\\underline{')
s = s.replace('</span>', '}')
s = textwrap.fill("\\item %s" % s, initial_indent=' '*4, subsequent_indent=' '*4)
......
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