/* * [RenameIncludes.java] * * Summary: rename references to included files from *.html to *.htmlfrag. * * Copyright: (c) 2014-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 2014-04-21 initial release */ package com.mindprod.repair; import com.mindprod.commandline.CommandLine; import com.mindprod.common18.ST; import com.mindprod.filter.AllButSVNDirectoriesFilter; import com.mindprod.filter.ExtensionListFilter; import java.io.File; import java.io.IOException; import static java.lang.System.*; /** * rename references to included files from *.html to *.htmlfrag. *

* outside this program we use Take command to rename the files. * We use Funduc to repair the references. * We just prepare a Search/Replace Script * * @author Roedy Green, Canadian Mind Products * @version 1.0 2014-04-21 initial release * @since 2014-04-21 */ public class RenameIncludes { /** * but list of dirs and or filenames to process on the command line */ public static void main( final String[] args ) throws IOException { CommandLine commandLine = new CommandLine( args, new AllButSVNDirectoriesFilter(), new ExtensionListFilter( "html" ) ); out.println(); out.println(); out.println( "----------------------" ); for ( File file : commandLine ) { // ignore files named index.html if ( file.getName().equals( "index.html" ) ) { continue; } String abs = file.getAbsolutePath(); // will be \ delimited // we have E:\mindprod\jgloss\include\xxx.html final String backslashForm = ST.chopLeadingString( abs, "E:\\mindprod\\" ); // we now have jgloss\include\xxx.html final String slashForm = backslashForm.replace( '\\', '/' ); // we now have jgloss/include/xxx.html out.println( "[Search]" ); out.println( backslashForm ); out.println( "[Replace]" ); out.println( ST.chopTrailingString( backslashForm, ".html" ) + ".htmlfrag" ); out.println( "[Search]" ); out.println( slashForm ); out.println( "[Replace]" ); out.println( ST.chopTrailingString( slashForm, ".html" ) + ".htmlfrag" ); } } }