/* * [BglossCustomiser.java] * * Summary: Search gay and black glossary for
anchors and terms. * * Copyright: (c) 2007-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.2 2007-04-27 use enum for each embellishment letter. use CSS for single icons. */ package com.mindprod.qf; import com.mindprod.filter.ExtensionListFilter; import java.io.File; import java.io.FilenameFilter; import java.util.Arrays; import java.util.Iterator; import static com.mindprod.htmlmacros.macro.Global.configuration; /** * Search gay and black glossary for
anchors and terms. * * @author Roedy Green, Canadian Mind Products * @version 2.2 2007-04-27 use enum for each embellishment letter. use CSS for single icons. * @since 2007 */ public final class BglossCustomiser extends AbstractGlossCustomiser { /** * directory where we put the generated indexes. */ private static final String includeDirName; /** * directory where the bgloss is kept */ private static final String inputDirName; /** * root directory of website */ private static final String webrootDirname; /** * Iterator that coughs up next input file to process per prod. */ private static final Iterator fileIterator; static { // combine dirsWithMacros and dirsWithIncludes into dirsToProcess; webrootDirname = configuration.getLocalWebrootWithSlashes(); includeDirName = webrootDirname + "/bgloss/include/"; inputDirName = webrootDirname + "/bgloss/"; } static { // find all files of form E:\mindprod\bgloss\*.html FilenameFilter f = new ExtensionListFilter( "html" ); String[] filenames = new File( inputDirName ).list( f ); fileIterator = Arrays.asList( filenames ).iterator(); } /** * constructor */ public BglossCustomiser() { } /** * base name of glossary, e.g. lgloss jgloss used to build other names. * * @return name of glossary */ public String getBaseName() { return "bgloss"; } /** * estimate of how many entries in the index. Will be a bit larger than the number of files. * * @return estimated number of index entires in this glossary */ public int getEstimatedIndexEntries() { return ( 2000 ); } /** * get glossary enum associated with this embellisher * * @return glossary */ public Gloss getGlossEnum() { return Gloss.BGLOSS; } /** * directory where we put the generated indexes. Also where embellishments live * * @return directory when output files go files are, WITH TRAILING /. */ public String getIncludeDirName() { return includeDirName; } /** * Get directory where input files are, * * @return directory when input files are, WITH TRAILING /. */ public String getInputDirName() { return inputDirName; } /** * Get unqualified name of the next input file we are are scanning for anchors/terms * * @return unqualified filename. Watch \ which must be doubled in Java Strings. Indicates has no more files to * process either by repeating the last filename, or by returning null. */ public String getNextInFilename() { // return next file in list, null when done return fileIterator.hasNext() ? ( String ) fileIterator.next() : null; } /** * Do we need to produce index pages for each individual letter of the alphabet. * * @return true if individual indexes needed. */ public boolean needIndividualLetterIndexes() { return true; } } // end BGlossCustomiser