- From: David Ross <work@rossy.co.uk>
- Date: Mon, 13 Oct 2003 11:37:54 +0100
- To: html-tidy@w3.org
I've just written this simple script interface to the kate text editor to run a document through tidy. I noticed you have links to editors with tidy support. I thought you may wish to include this in conjunction with kate too. I'll send this to the kate developers as well. If you would like a quick howto on the install etc just let me know. Regards, David ========= START CODE ========= #!/bin/bash # Kate script interface to html tidy # Version 1 - 13/10/03 # by David Ross http://www.rossy.co.uk ################ # Start Config # ################ # Specify any options you want to pass to tidy tidyoptions="-iu --wrap 0 --doctype transitional" # File to write errors to errfile="/tmp/tidy.err" # Do you want a prompt before showing errors # If you don't have "xmessage" set to 0 errprompt=1 # 0=No & 1=Yes ############## # Start Code # ############## # Get the active document number doc=`dcop $1 KateMainWindow0 currentDocumentIfaceNumber` # Get the current html from kate DATAIN=`dcop $1 EditInterface#$doc text` # Run the html through tidy DATAOUT=`echo $DATAIN | tidy $tidyoptions 2> $errfile` # Only send back the tidied version if there is valid html if [ `echo $DATAOUT|grep -c "DOCTYPE"` -gt 0 ];then dcop $1 EditInterface#$doc setText "$DATAOUT" fi # Open a new document with the error code should errors arise if [ `cat $errfile|grep -c "No warnings or errors were found"` -eq 0 ];then if [ $errprompt -eq 1 ];then xmessage -center -buttons "Yes:1,No:0" "Errors were found Do you want to see them?" fi if [ $? -eq 1 ] || [ $errprompt -eq 0 ];then dcop kate KateMainWindow0 openURL "$errfile" fi fi ========== END CODE ========== ****************************************************************** NHS Argyll and Clyde The information contained in this message may be confidential or legally privileged and is intended for the addressee only. If you have received this message in error or there are any problems please notify the originator immediately. The unauthorised use, disclosure, copying or alteration of this message is strictly forbidden. ******************************************************************
Received on Monday, 13 October 2003 06:55:37 UTC