texdiff 0.2.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,112 @@
1
+ Metadata-Version: 2.4
2
+ Name: texdiff
3
+ Version: 0.2.0
4
+ Summary: AST-driven semantic diff for LaTeX documents
5
+ Author: GoBobr
6
+ License: MIT License
7
+
8
+ Copyright (c) 2026 GoBobr
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Project-URL: Homepage, https://github.com/GoBobr/texdiff
29
+ Keywords: latex,diff,latexdiff,ast,track-changes
30
+ Classifier: Development Status :: 2 - Pre-Alpha
31
+ Classifier: Intended Audience :: Science/Research
32
+ Classifier: License :: OSI Approved :: MIT License
33
+ Classifier: Programming Language :: Python :: 3
34
+ Classifier: Programming Language :: Python :: 3.10
35
+ Classifier: Programming Language :: Python :: 3.11
36
+ Classifier: Programming Language :: Python :: 3.12
37
+ Classifier: Topic :: Text Processing :: Markup :: LaTeX
38
+ Requires-Python: >=3.10
39
+ Description-Content-Type: text/markdown
40
+ License-File: LICENSE
41
+ Requires-Dist: pylatexenc>=2.10
42
+ Provides-Extra: dev
43
+ Requires-Dist: pytest>=7; extra == "dev"
44
+ Requires-Dist: pytest-cov>=4; extra == "dev"
45
+ Provides-Extra: docs
46
+ Requires-Dist: mkdocs>=1.5; extra == "docs"
47
+ Requires-Dist: mkdocs-material>=9; extra == "docs"
48
+ Requires-Dist: mkdocstrings[python]>=0.24; extra == "docs"
49
+ Requires-Dist: pymdown-extensions>=10; extra == "docs"
50
+ Dynamic: license-file
51
+
52
+ # texdiff
53
+
54
+ **AST-driven semantic diff for LaTeX documents.**
55
+
56
+ `texdiff` compares two revisions of a LaTeX document and produces a single
57
+ marked-up `diff.tex` that compiles with `pdflatex` — added text in blue,
58
+ deleted text struck out — while preserving the original document's styling,
59
+ cross-references and custom classes.
60
+
61
+ ## Why
62
+
63
+ [`latexdiff`](https://www.ctan.org/pkg/latexdiff) is the de-facto standard for
64
+ review-marked LaTeX, but it diffs *token soup*: it guesses word boundaries with
65
+ regexes and re-injects markup into the merged text, hoping braces still
66
+ balance. On real-world documents the result is markup that crosses brace /
67
+ environment boundaries, glues old and new table cells together, and corrupts
68
+ listings — which is why every serious latexdiff user eventually ends up
69
+ maintaining a pile of fragile pre/post-processing scripts around it.
70
+
71
+ `texdiff` takes the other road: **diff the tree, never the text.**
72
+
73
+ 1. Parse old and new documents into a LaTeX syntax tree
74
+ ([pylatexenc](https://github.com/phfaist/pylatexenc) — a faithful concrete
75
+ syntax tree carrying exact source spans, no macro expansion).
76
+ 2. Align the trees level by level (document → environments → groups → text
77
+ runs) with difflib-style sequence matching. A change can never leak across
78
+ a node boundary.
79
+ 3. Walk the merged tree and emit `\DIFadd{...}` / `\DIFdel{...}` markup —
80
+ latexdiff-compatible rendering, valid by construction.
81
+
82
+ Restructured tables (re-ordered rows, changed column layouts), math,
83
+ listings and verbatim environments are handled as atomic or row-aligned
84
+ blocks instead of being shredded by a word diff.
85
+
86
+ Multi-file sources are flattened automatically (`\input`/`\include`
87
+ resolved relative to each file, like `latexdiff --flatten`), and the
88
+ preamble of the new revision is used verbatim so custom classes and
89
+ macros keep working.
90
+
91
+ ## Usage
92
+
93
+ ```sh
94
+ texdiff old/main.tex new/main.tex > diff.tex # \input expansion built in
95
+ pdflatex diff.tex # done - no pre/postprocessing
96
+ texdiff old.tex new.tex -o diff.tex --check # + fail loudly if it won't compile
97
+ texdiff old.tex new.tex --stats # "611 unchanged, 29 added, ..."
98
+ ```
99
+
100
+ ```sh
101
+ pip install texdiff # or from a checkout:
102
+ pip install -e ".[dev]" && pytest
103
+ ```
104
+
105
+ Status: **v0.2.0** — core pipeline plus flattening, row-granular table
106
+ alignment, preamble policy, `--check` and a compile-guaranteed corpus in
107
+ CI; validated on a 65-page generated longtable-heavy document. See the
108
+ [roadmap](https://gobobr.github.io/texdiff/roadmap/) for what is next.
109
+
110
+ ## License
111
+
112
+ MIT
@@ -0,0 +1,19 @@
1
+ texdiff/__init__.py,sha256=ISoBdBHEbstR5ydBF3kjTsMvhWxxc3pL_Ufz-Gw9tKw,1023
2
+ texdiff/align.py,sha256=5JiN4YLE9Xa7ymr1xOeuzOWSebVNyX8QAJDOT6LM7rM,7532
3
+ texdiff/api.py,sha256=qZ7ZxmzTIpJV_RRpDbRj-hW5bIRObiKm6xBjy97cFd8,11867
4
+ texdiff/check.py,sha256=Wpqst1nbGh2RYZPUWmXrsYfNX0zECo5SRmkrfOcOwOE,1820
5
+ texdiff/cli.py,sha256=xFiaLutQu9hdFVJz6QWKgLuK_XTCCXv-MPkkdwaxW8E,2560
6
+ texdiff/emit.py,sha256=BaeCVpO_zCa3BMlvuu-fVE7U_--B5qk5nW7Ffl1zuEM,48764
7
+ texdiff/flatten.py,sha256=qfizn6-uhxmAjyNPdJbImPyA875ZwufagFz7x9mHQqY,6804
8
+ texdiff/nodes.py,sha256=J1y9X55Xy3nGpHk5uMxsO8-obYclelsOhTuTfHobtXs,6122
9
+ texdiff/oldlines.py,sha256=lue8HSyOnOf92Zm4ypI2qpYi85eLJhuWQ5K7eqvs5sM,1907
10
+ texdiff/parse.py,sha256=CVRNYDwIhYMKjOK0VzvSAOZPrdQUCVGQE5kbPpu1Bpc,18684
11
+ texdiff/preamble.py,sha256=XaueZ_AX7JiHVcSyzAdjaXGI9Eq_PYfipMuwQXCsF0Y,15046
12
+ texdiff/tables.py,sha256=Pkkass34goAHyBNHQbBEGY5FEPmKP1ZBIa8QYp2LoXM,19608
13
+ texdiff/textdiff.py,sha256=gs8HeLA8__ts-NvQWJCqOS-wtXtQbxaPZk459qKdJvE,5199
14
+ texdiff-0.2.0.dist-info/licenses/LICENSE,sha256=fUppg5evqA2g0mRPkqN6nZf05_CMWDbB7eCJLLm77LI,1063
15
+ texdiff-0.2.0.dist-info/METADATA,sha256=mH-acVMi3RkOPtDYq1w0h24zjgwJzFp7zJ19DluhBoE,4950
16
+ texdiff-0.2.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
17
+ texdiff-0.2.0.dist-info/entry_points.txt,sha256=dwCa4uRkbpmQY1DySP66BMbj45-zNRPufkY3fJ19OIs,45
18
+ texdiff-0.2.0.dist-info/top_level.txt,sha256=_h2FYJPSZ88JDmjQNW15BoBM4-XaosFBS8UAAyveSok,8
19
+ texdiff-0.2.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.0.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ texdiff = texdiff.cli:main
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 GoBobr
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ texdiff