/* * [IndexWebsite.java] * * Summary: Indexes entire mindprod website. Invoked by qf.exe. * * Copyright: (c) 2005-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: * 2.0 2005-06-16 */ package com.mindprod.qf; import com.mindprod.htmlmacros.macro.Global; import com.mindprod.htmlmacros.support.Embellishment; import java.util.Collections; import static java.lang.System.*; /** * Indexes entire mindprod website. Invoked by qf.exe. * * @author Roedy Green, Canadian Mind Products * @version 2.0 2005-06-16 * @since 2005 */ public final class IndexWebsite { /** * Warns of duplicate entries */ private static void warnOfDups() { // entries are in an ArrayList of Entries, sort in natural order String prevName = ""; for ( IndexEntry entry : IndexEntry.indexEntries ) { final String thisName = entry.getHumanname(); if ( thisName.equals( prevName ) ) { // sometimes dups can't be helped. err.println( "Warning: duplicate: " + thisName + " in " + entry.getIndexGloss().getBareDir() ); } else { prevName = thisName; } } // end for } /** * index all mindprod.com glossaries * * @param args not used */ public static void main( String[] args ) { Global.installConfiguration( args ); Embellishment.fireup(); out.println( "Building indexes for entire website." ); AbstractGlossCustomiser[] customisers = Global.configuration.getGlossCustomisers(); // F I N D _ A N C H O R S for ( AbstractGlossCustomiser customiser : customisers ) { out.println( "Scanning " + customiser.getBaseName() + " for index entries..." ); FindAnchors.findAnchorsInGlossary( customiser ); } // S O R T out.println( "Sorting combined indexes..." ); Collections.sort( IndexEntry.indexEntries ); out.println( IndexEntry.indexEntries.size() + " entries sorted." ); warnOfDups(); // B U I L D _ I N D E X E S for ( AbstractGlossCustomiser customiser : customisers ) { // also builds xxxx.ser BuildIndexes.buildGlossaryIndex( customiser ); } out.println( "indexing done" ); System.exit( 0 ); // oddly will not stop without it. } // end main } // end IndexMindprod