index.tex 2.29 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{enumitem}
\begin{document}
{{extend 'layout_tools.html'}}
{{
    import re
    import textwrap
    #
    # HEADER
    #
    if list.header_flag:
        title = get_title(tool, dbui.UNDEF_ID)
        date = request.now.strftime("%d %b %Y")
    
        response.write("\n\\begin{flushleft}\n")
        response.write("\\textsc{\LARGE Publications %s -- %s}\n" % (title, date))
        response.write("\end{flushleft}\n")
    pass

    #
    # BODY
    #
    for key in paths_keys:
      
      
        level = key.count('/') 
        if  level == 0:
            response.write("\n\n\section*{%s}" % key, escape=False)
        
        else:
            indent = 1.2 * (level - 1)
            response.write("\n\hangindent=%sem" % indent, escape=False)
            response.write("\n\hangafter=0", escape=False)
36
            response.write("\n\\noindent \\textsc{%s}\\vspace{1ex}\n\n" % key.split('/')[-1])
37 38 39 40 41 42 43 44 45 46 47 48
        pass
      
      
        if key not in paths_data:
            continue

        margin = 1.6 * level
        response.write("\n  \\begin{enumerate}[leftmargin=%sem]" % margin, escape=False)
        
        for record in paths_data[key]:
            
            s = record.replace('<br>', '')    
LE GAC Renaud's avatar
LE GAC Renaud committed
49 50 51
            s = s.replace('<b>', '\textbf{').replace('</b>', '}')
            s = s.replace('<i>', '\emph{').replace('</i>', '}')
            s = s.replace('<u>', '\underline{').replace('</u>', '}')
52
            
53 54 55
            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{')
56
            
57
            s = s.replace('<span style="font-style: italic;">', '\\textit{')
LE GAC Renaud's avatar
LE GAC Renaud committed
58
            s = s.replace('<span style="font-weight: bold;">', '\textbf{')
59
            s = s.replace('<span style="text-decoration: underline;">', '\\underline{')
LE GAC Renaud's avatar
LE GAC Renaud committed
60 61

            s = s.replace('</span>', '}')            
62 63 64 65 66 67 68 69 70
            s = textwrap.fill("\\item %s" % s, initial_indent=' '*4, subsequent_indent=' '*4)
            response.write("\n%s" % s, escape=False)
            
        pass
        response.write("\n  \\end{enumerate}", escape=False)
    pass
}} 
\end{document}
{{include}}