MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / _format_line

Method _format_line

tools/python-3.11.9-amd64/Lib/difflib.py:1859–1880  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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("&","&amp;").replace(">","&gt;").replace("<","&lt;")
1875
1876 # make space non-breakable so they don't get compressed or line wrapped
1877 text = text.replace(' ','&nbsp;').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"""

Callers 1

_collect_linesMethod · 0.95

Calls 2

replaceMethod · 0.45
rstripMethod · 0.45

Tested by

no test coverage detected