Returns HTML markup of "from" / "to" text lines side -- 0 or 1 indicating "from" or "to" text flag -- indicates if difference on line linenum -- line number (used for line number column) text -- line text to be marked up
(self,side,flag,linenum,text)
| 1857 | return fromlist,tolist,flaglist |
| 1858 | |
| 1859 | def _format_line(self,side,flag,linenum,text): |
| 1860 | """Returns HTML markup of "from" / "to" text lines |
| 1861 | |
| 1862 | side -- 0 or 1 indicating "from" or "to" text |
| 1863 | flag -- indicates if difference on line |
| 1864 | linenum -- line number (used for line number column) |
| 1865 | text -- line text to be marked up |
| 1866 | """ |
| 1867 | try: |
| 1868 | linenum = '%d' % linenum |
| 1869 | id = ' id="%s%s"' % (self._prefix[side],linenum) |
| 1870 | except TypeError: |
| 1871 | # handle blank lines where linenum is '>' or '' |
| 1872 | id = '' |
| 1873 | # replace those things that would get confused with HTML symbols |
| 1874 | text=text.replace("&","&").replace(">",">").replace("<","<") |
| 1875 | |
| 1876 | # make space non-breakable so they don't get compressed or line wrapped |
| 1877 | text = text.replace(' ',' ').rstrip() |
| 1878 | |
| 1879 | return '<td class="diff_header"%s>%s</td><td nowrap="nowrap">%s</td>' \ |
| 1880 | % (id,linenum,text) |
| 1881 | |
| 1882 | def _make_prefix(self): |
| 1883 | """Create unique anchor prefixes""" |
no test coverage detected