/* * [PruneFoot.java] * * Summary: Remove iframe reference from the footer of an HTML page generated with macro Foot. * * Copyright: (c) 2009-2017 Roedy Green, Canadian Mind Products, http://mindprod.com * * Licence: This software may be copied and used freely for any purpose but military. * http://mindprod.com/contact/nonmil.html * * Requires: JDK 1.8+ * * Created with: JetBrains IntelliJ IDEA IDE http://www.jetbrains.com/idea/ * * Version History: * 1.0 2009-06-02 initial version */ package com.mindprod.repair; import com.mindprod.commandline.CommandLine; import com.mindprod.common18.EIO; import com.mindprod.filter.AllButSVNDirectoriesFilter; import com.mindprod.filter.ExtensionListFilter; import com.mindprod.hunkio.HunkIO; import java.io.File; import java.io.IOException; import static java.lang.System.*; /** * Remove iframe reference from the footer of an HTML page generated with macro Foot. * * @author Roedy Green, Canadian Mind Products * @version 1.0 2009-06-02 initial version * @since 2009-06-02 */ public class PruneFoot { private static final String END_MARKER = ""; /** * we replace link to separate footer with some canned inline text */ private static final String NON_MIL = "The information on this page is for non-military use only.
Military use" + " includes use by defence contractors."; private static final String START_MARKER = " final int estSize = big.length() - ( end - start ) + NON_MIL.length(); StringBuilder gc = new StringBuilder( estSize ); gc.append( big.substring( 0, start ) ); gc.append( NON_MIL ); gc.append( big.substring( end ) ); assert estSize == gc.length() : "bad size estimate"; HunkIO.writeEntireFile( file, gc.toString() ); } catch ( IOException e ) { e.printStackTrace( err ); err.println(); System.exit( 1 ); } } } }