/* * [PhoneHead.java] * * Summary: Produce the header on a Phone number document for one letter. * * 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 static com.mindprod.htmlmacros.macro.Global.configuration; import static java.lang.System.*; /** * Produce the header on a Phone number document for one letter. * * @author Roedy Green, Canadian Mind Products * @version 1.8 2009-02-06 include go package in ZIP bundle. * @since 2009 */ public final class PhoneHead extends Macro { /** * how to use the macro */ private static final String USAGE = "\nPhoneHead macro needs a letter."; /** * @param letter letter of the alphabet this page handles * * @return expanded macro HTML */ private String expand( char letter ) { String shortTitle = ( ( '0' <= letter && letter <= '9' ) ? "digit " : "letter " ) + letter; String title = "[" + letter + "] Phone Numbers of Computer Vendors"; String description = configuration.getCompanyName() + " phone number list of computer vendors beginning with the " + shortTitle; String keywords = "telephone, directory, white pages, yellow pages, book, listing, list tel, computer, vendor, contact"; String icon = "icon16/phone.png"; String image = "icon64/phone.png"; String sectionFile = "phone/phonelists.html"; String sectionTitle = "Phone List Home"; String subSectionFile = null; String subSectionTitle = null; Head head = new Head(); head.setFileBeingProcessedAndFileBeingDistributed( fileBeingProcessed, fileBeingDistributed ); return head.generalHead( title, shortTitle, description, shortTitle, "titlephonelist", keywords, icon, null, image, null, null, sectionFile, sectionTitle, subSectionFile, subSectionTitle, null, null, null, null, Indexing.PHONE, GoogleAdSense.BANNER, null, null ); } /** * Generate the header for a phone letter index document. * * @param parms parameters from macro command line. parm[0] = 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( "P" ); } if ( parms.length != 1 ) { throw new IllegalArgumentException( USAGE ); } // unqualified e.g. sniff.html String letter = parms[ 0 ]; return expand( Character.toUpperCase( letter.charAt( 0 ) ) ); } }