Wed, 13 Aug 2014 14:50:00 -0700
Added tag jdk8u40-b01 for changeset bf89a471779d
jjg@2061 | 1 | #!/bin/bash |
jjg@1455 | 2 | # |
jjg@2061 | 3 | # Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. |
jjg@1455 | 4 | # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
jjg@1455 | 5 | # |
jjg@1455 | 6 | # This code is free software; you can redistribute it and/or modify it |
jjg@1455 | 7 | # under the terms of the GNU General Public License version 2 only, as |
jjg@1455 | 8 | # published by the Free Software Foundation. |
jjg@1455 | 9 | # |
jjg@1455 | 10 | # This code is distributed in the hope that it will be useful, but WITHOUT |
jjg@1455 | 11 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
jjg@1455 | 12 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
jjg@1455 | 13 | # version 2 for more details (a copy is included in the LICENSE file that |
jjg@1455 | 14 | # accompanied this code). |
jjg@1455 | 15 | # |
jjg@1455 | 16 | # You should have received a copy of the GNU General Public License version |
jjg@1455 | 17 | # 2 along with this work; if not, write to the Free Software Foundation, |
jjg@1455 | 18 | # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
jjg@1455 | 19 | # |
jjg@1455 | 20 | # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
jjg@1455 | 21 | # or visit www.oracle.com if you need additional information or have any |
jjg@1455 | 22 | # questions. |
jjg@1455 | 23 | # |
jjg@1455 | 24 | |
jjg@1455 | 25 | # Run the "tidy" program over the files in a directory. |
jjg@2061 | 26 | # The "tidy" program must be on your PATH. |
jjg@1455 | 27 | # |
jjg@1455 | 28 | # Usage: |
jjg@1455 | 29 | # sh tidy.sh <dir> |
jjg@1455 | 30 | # |
jjg@1455 | 31 | # The "tidy" program will be run on each HTML file in <dir>, |
jjg@1455 | 32 | # and the output placed in the corresponding location in a new |
jjg@1455 | 33 | # directory <dir>.tidy. The console output from running "tidy" will |
jjg@1455 | 34 | # be saved in a corresponding file with an additional .tidy extension. |
jjg@1455 | 35 | # |
jjg@1455 | 36 | # Non-HTML files will be copied without modification from <dir> to |
jjg@1455 | 37 | # <dir>.tidy, so that relative links within the directory tree are |
jjg@1455 | 38 | # unaffected. |
jjg@1455 | 39 | |
jjg@1455 | 40 | dir=$1 |
jjg@1455 | 41 | odir=$dir.tidy |
jjg@1455 | 42 | |
jjg@1455 | 43 | ( cd $dir ; find . -type f ) | \ |
jjg@1455 | 44 | while read file ; do |
jjg@1455 | 45 | mkdir -p $odir/$(dirname $file) |
jjg@1455 | 46 | case $file in |
jjg@1455 | 47 | *.html ) |
jjg@1455 | 48 | cat $dir/$file | tidy 1>$odir/$file 2>$odir/$file.tidy |
jjg@1455 | 49 | ;; |
jjg@1455 | 50 | * ) cp $dir/$file $odir/$file |
jjg@1455 | 51 | ;; |
jjg@1455 | 52 | esac |
jjg@1455 | 53 | done |