Use for line numbering
(self, txt)
| 109 | return txt |
| 110 | |
| 111 | def _number(self, txt): |
| 112 | """ Use <ol> for line numbering """ |
| 113 | # Fix Whitespace |
| 114 | txt = txt.replace('\t', ' '*TAB_LENGTH) |
| 115 | txt = txt.replace(" "*4, " ") |
| 116 | txt = txt.replace(" "*3, " ") |
| 117 | txt = txt.replace(" "*2, " ") |
| 118 | |
| 119 | # Add line numbers |
| 120 | lines = txt.splitlines() |
| 121 | txt = '<div class="codehilite"><pre><ol>\n' |
| 122 | for line in lines: |
| 123 | txt += '\t<li>%s</li>\n'% line |
| 124 | txt += '</ol></pre></div>\n' |
| 125 | return txt |
| 126 | |
| 127 | |
| 128 | def _getLang(self): |