File: PKG-INFO

package info (click to toggle)
python-ghdiff 0.4-2
  • links: PTS
  • area: main
  • in suites: bookworm, bullseye, buster, forky, sid, trixie
  • size: 116 kB
  • sloc: python: 230; makefile: 3
file content (157 lines) | stat: -rw-r--r-- 5,610 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
Metadata-Version: 1.1
Name: ghdiff
Version: 0.4
Summary: Generate Github-style HTML for unified diffs.
Home-page: https://github.com/kilink/ghdiff
Author: Patrick Strawderman
Author-email: patrick@kilink.net
License: MIT
Description: .. image:: https://secure.travis-ci.org/kilink/ghdiff.png?branch=master
           :target: http://travis-ci.org/kilink/ghdiff
        
        .. image:: https://coveralls.io/repos/kilink/ghdiff/badge.png
           :target: https://coveralls.io/r/kilink/ghdiff
        
        ghdiff
        ======
        
        Generate Github-style HTML for unified diffs.
        
        Changes
        -------
        
        
        0.4 (2014-06-13)
        ~~~~~~~~~~~~~~~~
        
        * Add iPython magic (mgaitan)
        
        0.3 (2014-04-06)
        ~~~~~~~~~~~~~~~~
        
        * Fix Python 3 issue when running as a command-line script.
        
        0.2
        ~~~
        
        * Detect character encoding when reading files (Nyoroon)
        * PEP-8 clean up (laulaz)
        * Fix display problem when text line is too long (laulaz)
        
        0.1
        ~~~
        
        * initial release.
        
        diff
        ====
        
        Generate a diff and output Github-style HTML for it.
        
        .. code-block:: pycon
        
            >>> import ghdiff
            >>> from six import print_
            >>> print_(ghdiff.diff("a\nb", "b\nb"))
            <style type="text/css">
            ...
            </style>
            <div class="diff">
                <div class="control">@@&nbsp;-1,2&nbsp;+1,2&nbsp;@@
                </div>
                <div class="delete">-a</div>
                <div class="">&nbsp;b</div>
                <div class="insert">+b</div>
            </div>
        
        The css option controls whether or not the output includes CSS.
        
        .. code-block:: pycon
        
            >>> print_(ghdiff.diff("blah blah blah\nb", "blah zxqq blah\nb", css=False))
            <div class="diff">
                <div class="control">@@&nbsp;-1,2&nbsp;+1,2&nbsp;@@
                </div>
                <div class="delete">-blah&nbsp;<span class="highlight">blah</span>&nbsp;blah</div>
                <div class="insert">+blah&nbsp;<span class="highlight">zxqq</span>&nbsp;blah</div>
                <div class="">&nbsp;b</div>
            </div>
        
        diff accepts lists of strings representing lines as well.
        
        .. code-block:: pycon
        
            >>> print_(ghdiff.diff(["blah blah blah", "b"], ["blah zxqq blah", "b"]))
            <style type="text/css">
            ...
            </style>
            <div class="diff">
                <div class="control">@@&nbsp;-1,2&nbsp;+1,2&nbsp;@@
                </div>
                <div class="delete">-blah&nbsp;<span class="highlight">blah</span>&nbsp;blah</div>
                <div class="insert">+blah&nbsp;<span class="highlight">zxqq</span>&nbsp;blah</div>
                <div class="">&nbsp;b</div>
            </div>
        
        IPython magic
        =============
        
        ghdiff also works as an IPython magic:
        
        .. code-block:: python
        
            In[1]: %load_ext ghdiff
        
            In[2]: %ghdiff var1 var2
        
        See a `notebook example <http://nbviewer.ipython.org/github/kilink/ghdiff/blob/master/demo.ipynb>`_
        
        
        colorize
        ========
        
        colorize takes an existing unified diff and outputs Github-style markup.
        
        .. code-block:: python
        
            >>> print_(ghdiff.colorize("""\
            ... index 921100e..8b177e1 100755
            ... --- a/src/ghdiff.py
            ... +++ b/src/ghdiff.py
            ... @@ -10,20 +10,24 @@ def escape(text):
            ...  default_css = \"\"\"\
            ...  <style type="text/css">
            ...  %s
            ... -</style>\"\"\" % (open(os.path.join(os.path.dirname(__file__), "default.css")).read(),)
            ... +</style>
            ... +\"\"\" % (open(os.path.join(os.path.dirname(__file__), "default.css")).read(),)
            ... +"""))
            <style type="text/css">
            ...
            </style>
            <div class="diff">
            <div class="control">@@&nbsp;-10,20&nbsp;+10,24&nbsp;@@&nbsp;def&nbsp;escape(text):</div>
            <div class="">&nbsp;default_css&nbsp;=&nbsp;"""&nbsp;&lt;style&nbsp;type="text/css"&gt;</div>
            <div class="">&nbsp;%s</div>
            <div class="delete">-&lt;/style&gt;"""&nbsp;%&nbsp;(open(os.path.join(os.path.dirname(__file__),&nbsp;"default.css")).read(),)</div>
            <div class="insert">+&lt;/style&gt;</div>
            <div class="insert">+"""&nbsp;%&nbsp;(open(os.path.join(os.path.dirname(__file__),&nbsp;"default.css")).read(),)</div>
            <div class="insert">+</div>
            </div>
        
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Natural Language :: English
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Framework :: IPython
Classifier: Topic :: Software Development
Classifier: Topic :: Utilities