Returns HTML file of side by side comparison with change highlights Arguments: fromlines -- list of "from" lines tolines -- list of "to" lines fromdesc -- "from" file column header string todesc -- "to" file column header string context -- set
(self, fromlines, tolines, fromdesc='', todesc='',
context=False, numlines=5, *, charset='utf-8')
| 1703 | self._charjunk = charjunk |
| 1704 | |
| 1705 | def make_file(self, fromlines, tolines, fromdesc='', todesc='', |
| 1706 | context=False, numlines=5, *, charset='utf-8'): |
| 1707 | """Returns HTML file of side by side comparison with change highlights |
| 1708 | |
| 1709 | Arguments: |
| 1710 | fromlines -- list of "from" lines |
| 1711 | tolines -- list of "to" lines |
| 1712 | fromdesc -- "from" file column header string |
| 1713 | todesc -- "to" file column header string |
| 1714 | context -- set to True for contextual differences (defaults to False |
| 1715 | which shows full differences). |
| 1716 | numlines -- number of context lines. When context is set True, |
| 1717 | controls number of lines displayed before and after the change. |
| 1718 | When context is False, controls the number of lines to place |
| 1719 | the "next" link anchors before the next change (so click of |
| 1720 | "next" link jumps to just before the change). |
| 1721 | charset -- charset of the HTML document |
| 1722 | """ |
| 1723 | |
| 1724 | return (self._file_template % dict( |
| 1725 | styles=self._styles, |
| 1726 | legend=self._legend, |
| 1727 | table=self.make_table(fromlines, tolines, fromdesc, todesc, |
| 1728 | context=context, numlines=numlines), |
| 1729 | charset=charset |
| 1730 | )).encode(charset, 'xmlcharrefreplace').decode(charset) |
| 1731 | |
| 1732 | def _tab_newline_replace(self,fromlines,tolines): |
| 1733 | """Returns from/to line lists with tabs expanded and newlines removed. |
no test coverage detected