/* * [GglossLetterHead.java] * * Summary: Produce the header on a Java Glossary letter index document. * * 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.8 2009-02-06 include go package in ZIP bundle. */ package com.mindprod.htmlmacros.macro; import com.mindprod.htmlmacros.support.GoogleAdSense; import com.mindprod.htmlmacros.support.Indexing; import com.mindprod.qf.GglossCustomiser; import static com.mindprod.htmlmacros.macro.Global.configuration; import static java.lang.System.*; /** * Produce the header on a Java Glossary letter index document. * * @author Roedy Green, Canadian Mind Products * @version 1.8 2009-02-06 include go package in ZIP bundle. * @since 2009 */ public final class GglossLetterHead extends Head { private static final String GGLOSSLETTERHEAD_SYNTAX_ERROR = "GglossLetterHead macro needs a letterCode."; /** * Generate the header for a ggloss html document. * * @param letterCode code A-Z 0 * ~ * * @return expanded macro HTML */ private String expand( char letterCode ) { final GglossCustomiser s = new GglossCustomiser(); final String title = s.getTitleForLetterCode( letterCode ) + " : Gay & Black Glossary"; final String shortTitle = s.getDescriptionForLetterCode( letterCode ); final String description = configuration.getCompanyName() + " Gay & Black glossary : " + s.getDescriptionForLetterCode( letterCode ); final String keywords = "gay, black, slang, buzzwords, terminology, glossary, Roedy Green"; final String icon = "icon16/ggloss.png"; final String image = null; final String sectionFile = "ggloss/ggloss.html"; final String sectionTitle = "Gay & Black Glossary Home"; return generalHead( title, null, description, shortTitle, "titlegglossindex", keywords, icon, null, image, null, null, sectionFile, sectionTitle, null, null, null, null, null, null, Indexing.LETTERINDEX, GoogleAdSense.NONE, null, null ); } /** * Generate the header for a Gay glossary letter index document. * * @param parms parameters from macro command line. parm[0] = letterCode. 0=all numbers *=all * punctuation ~=master index A-Z=letter * @param quiet true if want output suppressed. * @param verbose @return expanded macro HTML */ public String expandMacro( String[] parms, final boolean quiet, final boolean verbose ) { if ( !quiet ) { out.print( "H" ); } if ( parms.length != 1 || parms[ 0 ].length() == 0 ) { throw new IllegalArgumentException( GGLOSSLETTERHEAD_SYNTAX_ERROR ); } // already converted to a letter code. char letterCode = Character.toUpperCase( parms[ 0 ].charAt( 0 ) ); return expand( letterCode ); } }