cubicweb/pyramid/debug_toolbar_templates/debug_source_code.mako
changeset 12771 70597b447fb7
equal deleted inserted replaced
12770:be0864a2eec8 12771:70597b447fb7
       
     1 <html>
       
     2 <head>
       
     3     <title>${file_path}</title>
       
     4 </head>
       
     5 <body>
       
     6     <h2>${file_path}</h2>
       
     7 
       
     8     % if has_pygments:
       
     9     ${highlight_html(content, "python", linenos=True, hl_lines=lines, lineanchors="line")}
       
    10     % else:
       
    11     <table class="rawtable">
       
    12     % for line_number, source_line in enumerate(content.split("\n"), start=1):
       
    13         <tr>
       
    14         <td class="line_number">
       
    15             <pre>${line_number}</pre>
       
    16         </td>
       
    17         <td>
       
    18             % if line_number in lines:
       
    19             <a class="highlight-line" name="line-${line_number}">
       
    20             % else:
       
    21             <a name="line-${line_number}">
       
    22             % endif
       
    23                 <pre>${source_line.rstrip()} </pre>
       
    24             </a>
       
    25         </td>
       
    26         </tr>
       
    27     % endfor
       
    28     </table>
       
    29     % endif
       
    30 
       
    31     <style>
       
    32     h2 {
       
    33         text-align: center;
       
    34         width: 100%%;
       
    35         color: #fefefe;
       
    36         background-color: #333333;
       
    37         padding: 10px;
       
    38         font-family: sans;
       
    39         margin: 0;
       
    40     }
       
    41 
       
    42     body {
       
    43         margin: 0;
       
    44     }
       
    45 
       
    46     .highlighttable, .rawtable {
       
    47         margin: auto;
       
    48         font-size: larger;
       
    49         border: 2px solid black;
       
    50         border-top: 0;
       
    51         border-bottom: 0;
       
    52     }
       
    53 
       
    54     .rawtable {
       
    55         padding: 10px;
       
    56     }
       
    57 
       
    58     pre {
       
    59         margin: 0;
       
    60     }
       
    61 
       
    62     .line_number {
       
    63         text-align: right;
       
    64     }
       
    65 
       
    66     .rawtable td {
       
    67         padding: 0;
       
    68     }
       
    69 
       
    70     .hll {
       
    71         display: block;
       
    72     }
       
    73 
       
    74     .highlight-line > pre {
       
    75         background-color: #ffffcc;
       
    76     }
       
    77 
       
    78     ${css}
       
    79 
       
    80     </style>
       
    81 </body>
       
    82 </html>