/* * [GglossHead.java] * * Summary: Produce the header on a Gay glossary *.html file. * * 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.common18.BigDate; 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 Gay glossary *.html file. * * @author Roedy Green, Canadian Mind Products * @version 1.8 2009-02-06 include go package in ZIP bundle. * @since 2009 */ public final class GglossHead extends Head { /** * Generate the header for a ggloss html document. * * @param parms parameters from macro command line. parm[0] = title description of fragment. * @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 ( !( 1 <= parms.length && parms.length <= 2 ) ) { throw new IllegalArgumentException( "GglossHead needs description, [lastReviewedDate]." ); } GglossCustomiser s = new GglossCustomiser(); String title = parms[ 0 ]; char letterCode = s.getLetterCode( title.charAt( 0 ) ); final String lastReviewedDate; if ( parms.length > 1 ) { lastReviewedDate = parms[ 1 ]; if ( !BigDate.isValid( lastReviewedDate ) ) { throw new IllegalArgumentException( "GglossHead lastReviewedDate must have be a valid date of form yyyy-mm-dd." ); } } else { lastReviewedDate = null; } String ancestorFile = s.getFilenameForLetterCode( letterCode ); // we don't create ancestor, just link to it. String ancestor = s.getDescriptionForLetterCode( letterCode ); String shortTitle = title; title = shortTitle + " : Gay & Black Glossary"; String description = configuration.getCompanyName() + " Glossary of Gay and Black Slang : " + shortTitle; String keywords = "gay, black, slang, buzzwords, terminology, glossary, Roedy Green, " + shortTitle; String icon = "icon16/ggloss.png"; String image = null; String sectionFile = "ggloss/ggloss.html"; String sectionTitle = "Gay & Black Glossary Home"; String subSectionFile = "ggloss/" + ancestorFile; return generalHead( title, shortTitle, description, shortTitle, "titleggloss", keywords, icon, null, image, null, null, sectionFile, sectionTitle, subSectionFile, ancestor, null, null, null, null, Indexing.LETTERINDEX, GoogleAdSense.NONE, lastReviewedDate, null ); } }