OLD | NEW |
(Empty) | |
| 1 [# Safely display user-content text, such a program source code, with |
| 2 line numbers and the ability to comment (if enabled). |
| 3 |
| 4 Other EZT variables used: |
| 5 revision: revision ID string. |
| 6 file_lines: List of lines in the file. Each line |
| 7 has a line number, line content, and list of published and unpublished |
| 8 comments. |
| 9 should_prettify: whether the text should be syntax highlighted. |
| 10 prettify_class: additional CSS class used to tell prettify.js how to |
| 11 best syntax highlight this source file. |
| 12 ] |
| 13 |
| 14 [# Display the line numbers and source lines in separate columns. |
| 15 See corresponding comments L1, L2, L3 and S1, S2, S3 below. |
| 16 This is messy because the pre tags have significant whitespace, so we |
| 17 break lines inside the tags themslves to make our templates readable. |
| 18 The table has class "opened" or "closed" and the published comment cells |
| 19 and their corresponding gutter cells are conditionally displayed by the |
| 20 CSS rules for the "ifOpened" class. The "hide published comments" link |
| 21 toggles the table's open/closed state.] |
| 22 <table class="opened" id="review_comment_area"><tr> |
| 23 <td id="nums"> |
| 24 [# L1. Start with a nocursor row at the top to space the line numbers down the |
| 25 same amount as the source code lines w/ their initial cursor_hidden row.] |
| 26 <pre><table width="100%"><tr class="nocursor"><td></td></tr></table></pre> |
| 27 |
| 28 [# L2. Display each line number in a row that we can refer |
| 29 to by ID, and make each line number a self-link w/ anchor. |
| 30 If that source line has any published comments, add a nocursor row |
| 31 for spacing to match the corresponding cursor_hidden row, and a gutter |
| 32 cell. The height of the gutter cell is set by JS. Same for unpublished |
| 33 comments.] |
| 34 <pre><table width="100%" id="nums_table_0">[for file_lines]<tr id="gr_svn[revisi
on]_[file_lines.num]" |
| 35 ><td id="[file_lines.num]"><a href="#[file_lines.num]">[file_lines.num]</a></td>
</tr |
| 36 >[end]</table></pre> |
| 37 |
| 38 [# L3. Finish the line numbers column with another nocursor row to match |
| 39 the spacing of the source code column's final cursor_hidden row.] |
| 40 <pre><table width="100%"><tr class="nocursor"><td></td></tr></table></pre> |
| 41 </td> |
| 42 <td id="lines"> |
| 43 |
| 44 [# S1. Start the source code column with a cursor row. ] |
| 45 <pre><table width="100%"><tr class="cursor_stop cursor_hidden"><td></td></tr></t
able></pre> |
| 46 |
| 47 [# S2. Display each source code line in a table row and cell |
| 48 that we can identify by id.] |
| 49 <pre [if-any should_prettify]class="prettyprint [prettify_class]"[end]><table id
="src_table_0">[for file_lines]<tr |
| 50 id=sl_svn[revision]_[file_lines.num] |
| 51 ><td class="source">[file_lines.line]<br></td></tr |
| 52 >[end]</table></pre> |
| 53 |
| 54 [# S3. Finish the line numbers column with another cursor stop.] |
| 55 <pre><table width="100%"><tr class="cursor_stop cursor_hidden"><td></td></tr></t
able></pre> |
| 56 </td> |
| 57 </tr></table> |
OLD | NEW |