473,749 Members | 2,546 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Generating side-by-side differences in HTML

The difflib.py module and the diff.py tools script in Python 2.4 alpha
3 now support generating side by side (with intra line differences) in
HTML format. I have found this useful for performing build release
comparisons (I use a script to generate a main page showing all the
files that were changed in a build with hyperlinks to side by side
differences for each of those files). I also find it useful for
generating HTML test reports to show differences between actual and
expected log files. In addition I use it for supplementing Doxygen
generated HTML with side by side differences of files that were
changed.

Example usages:

<DOS_CMD_LINE >
c:/python2x/Tools/Scripts/diff.py -m file1.txt file2.txt > some.html
</DOS_CMD_LINE>

<SOME_PYTHON_SC RIPT>
import difflib
file1 = 'file1.txt'
file2 = 'file2.txt'
lines1 = open(file1).rea dlines()
lines2 = open(file2).rea dlines()
differ = difflib.HtmlDif f(tabsize=4,wra pcolumn=80)
html = differ.make_fil e(lines1,lines2 ,file1,file2,co ntext=True,numl ines=10)
f = open('some.html ','w')
f.write(html)
f.close()
</SOME_PYTHON_SCR IPT>

'tabsize' defaults to 8
'wrapcolumn' defaults to None (no line wrapping)
'context' defaults to False (shows full file vs. just showing diffs +
context)
'numlines' defaults to 5

You can try out the code either by installing Python 2.4 alpha 3 or
you can obtain the patched files (and example output) from:
https://sourceforge.net/tracker/?fun...&group_id=5470

Enjoy,
Dan Gass
Jul 18 '05 #1
0 1904

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
2055
by: paul | last post by:
Hi, I'd like to generate PDF files from my Php website. I've found PDFLib to make it... but i'd like to have your views. It is the best I can find ? Are there any other PDF generating lib ? Is there a totally free PDF generating lib ? Thanks in advance,
3
10720
by: skn | last post by:
Hello., Does the python compiler provide an option to generate a .pyo(optimized byte code file) from a .py (source file)? For generating .pyc I know that I only have to pass the source file name as an argument to py_compile.py. But for generating .pyo, I could not find anything. Any clues/help will be greatly appreciated.
3
2132
by: Steve Dussinger | last post by:
Hi All: I am attempting to use an XSL stylesheet to take data from an existing DOM document, and place it into a different existing DOM document. The problem I'm having is that I get the following exception from Xalan-J (version 2.5.2), because I am not generating a single root node from my stylesheet: "Can't have more than one root on a DOM!"
7
7287
by: eric.gagnon | last post by:
In a program randomly generating 10 000 000 alphanumeric codes of 16 characters in length (Ex.: "ZAZAZAZAZAZAZ156"), what would be an efficient way to ensure that I do not generate duplicates? STL set, map? Could you give me a little code example? Thank you.
10
1964
by: Al Christoph | last post by:
Please forgive me if this is the wrong place to post this. The last place I posted got me a fairly rude response. I guess vb.db people just don't want to think about XML as database. At any rate, here is what I posted: I have downloaded the final production version of VS 2005 pro after testing with Team version. I wonder if I've been screwed or if it's just too early on a Sunday morning. It seems to me that it was relatively trivial to...
6
5542
by: Poul Møller Hansen | last post by:
I have made a stored procedure, containing this part for generating a unique reference number. SET i = 0; REPEAT SET i = i + 1; SELECT RAND() INTO reference FROM SYSIBM.SYSDUMMY1; SET p_reference = ref_prefix || SUBSTR(CAST(reference AS CHAR(12)),3);
3
9443
by: Raed Sawalha | last post by:
Hello when I serialize an object an error generated using this function public string SerializeObject(object oClassObject,System.Type oClassType) { XmlSerializer oSerializer = new XmlSerializer(oClassType); System.Text.StringBuilder strBuilder = new System.Text.StringBuilder(); System.IO.TextWriter writer = new System.IO.StringWriter(strBuilder); try { oSerializer.Serialize(writer,oClassObject); }
1
2209
by: Nathan Sokalski | last post by:
Visual Studio 2005 recently stopped generating the *.designer.vb files for my *.aspx and *.ascx files. I am using Service Pack 1, and do not believe I did anything differently than normal prior to this happening. Is there anything that could have caused this? Does anyone know of a way to fix it? Thanks. -- Nathan Sokalski njsokalski@hotmail.com http://www.nathansokalski.com/
0
1858
by: Aswanth | last post by:
I'm Generating Reports in SSRS-2005.. Previously I got the Data from One Database & Generated Reports.. Now I used to get the Data from Two Different Databases(ie Database-1 & Database-2) & to generate the Reports.. I'm having one Stored Procedure(Get_Data) which will combine Two databases & get the data from them.. It is working fine for Me..(I tested in Sql Server Management Studio).. But it is Not working fine in my Visual Studio.. ...
0
1882
by: Aswanth | last post by:
I'm Working with Asp.Net with C#.. & I'm Generating Reports in SSRS-2005.. Till Now I'm Generating Reports in SSRS-2005 with Stored Procedure.. in Which I'm Generating Reports for One Particular User Details(ie I wrote Stored Procedure for Getting One Users Details).. Now I Want to Generate the Reports for Different Users DYNAMICALLY (Here, I wrote another Stored Procedure which contains UsersID's as Input...
0
8832
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9562
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9386
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9254
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8255
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6799
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4608
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4879
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3319
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.