summaryrefslogtreecommitdiffstats
path: root/Doc/lib/libdifflib.tex
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2004-08-29 16:34:40 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2004-08-29 16:34:40 (GMT)
commite064b41f5ac046fc361fa80af551f5bfab01141c (patch)
tree803e0b0152e38d58174856dcc1bc3754b2229b2c /Doc/lib/libdifflib.tex
parent87fa785f0f8ce187db2bd55871dc18fd57bc9f4e (diff)
downloadcpython-e064b41f5ac046fc361fa80af551f5bfab01141c.zip
cpython-e064b41f5ac046fc361fa80af551f5bfab01141c.tar.gz
cpython-e064b41f5ac046fc361fa80af551f5bfab01141c.tar.bz2
Patch #914575: difflib side by side diff support, diff.py s/b/s HTML option.
Diffstat (limited to 'Doc/lib/libdifflib.tex')
-rw-r--r--Doc/lib/libdifflib.tex73
1 files changed, 73 insertions, 0 deletions
diff --git a/Doc/lib/libdifflib.tex b/Doc/lib/libdifflib.tex
index fc588ff..4256e87 100644
--- a/Doc/lib/libdifflib.tex
+++ b/Doc/lib/libdifflib.tex
@@ -52,6 +52,79 @@
characters.
\end{classdesc*}
+\begin{classdesc*}{HtmlDiff}
+
+ This class can be used to create an HTML table (or a complete HTML file
+ containing the table) showing a side by side, line by line comparision
+ of text with inter-line and intra-line change highlights. The table can
+ be generated in either full or contextual difference mode.
+
+ The constructor for this class is:
+
+ \begin{funcdesc}{__init__}{
+ \optional{, tabsize
+ \optional{, wrapcolumn
+ \optional{, linejunk
+ \optional{, charjunk}}}}}
+
+ Initializes instance of \class{HtmlDiff}.
+
+ \var{tabsize} is an optional keyword argument to specify tab stop spacing
+ and defaults to \code{8}.
+
+ \var{wrapcolumn} is an optional keyword to specify column number where
+ lines are broken and wrapped, defaults to \code{None} where lines are not
+ wrapped.
+
+ \var{linejunk} and \var{charjunk} are optional keyword arguments passed
+ into \code{ndiff()} (used to by \class{HtmlDiff} to generate the
+ side by side HTML differences). See \code{ndiff()} documentation for
+ argument default values and descriptions.
+ \end{funcdesc}
+
+ The following methods are public:
+
+ \begin{funcdesc}{make_file}{fromlines, tolines
+ \optional{, fromdesc
+ \optional{, todesc
+ \optional{, context
+ \optional{, numlines}}}}}
+ Compares \var{fromlines} and \var{tolines} (lists of strings) and returns
+ a string which is a complete HTML file containing a table showing line by
+ line differences with inter-line and intra-line changes highlighted.
+
+ \var{fromdesc} and \var{todesc} are optional keyword arguments to specify
+ from/to file column header strings (both default to an empty string).
+
+ \var{context} and \var{numlines} are both optional keyword arguments.
+ Set \var{context} to \code{True} when contextual differences are to be
+ shown, else the default is \code{False} to show the full files.
+ \var{numlines} defaults to \code{5}. When \var{context} is \code{True}
+ \var{numlines} controls the number of context lines which surround the
+ difference highlights. When \var{context} is \code{False} \var{numlines}
+ controls the number of lines which are shown before a difference
+ highlight when using the "next" hyperlinks (setting to zero would cause
+ the "next" hyperlinks to place the next difference highlight at the top of
+ the browser without any leading context).
+ \end{funcdesc}
+
+ \begin{funcdesc}{make_table}{fromlines, tolines
+ \optional{, fromdesc
+ \optional{, todesc
+ \optional{, context}}}}
+ Compares \var{fromlines} and \var{tolines} (lists of strings) and returns
+ a string which is a complete HTML table showing line by line differences
+ with inter-line and intra-line changes highlighted.
+
+ The arguments of this method are a subset of those for the
+ \code{make_file} method. Refer to the \code{make_file} method
+ documentation.
+ \end{funcdesc}
+
+ \file{Tools/scripts/ndiff.py} is a command-line front-end to this class
+ and contains a good example of its use.
+\end{classdesc*}
+
\begin{funcdesc}{context_diff}{a, b\optional{, fromfile\optional{, tofile
\optional{, fromfiledate\optional{, tofiledate\optional{, n
\optional{, lineterm}}}}}}}