/* * [CarolHead.java] * * Summary: Produce the header for a Christmas Carol, greatly stripped down from what we usually produce. * * 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.fastcat.FastCat; import com.mindprod.htmlmacros.support.BuildImage; import com.mindprod.htmlmacros.support.ImageAlignment; import static com.mindprod.entities.DeEntifyStrings.stripHTMLTags; import static com.mindprod.htmlmacros.macro.Global.configuration; import static java.lang.System.*; /** * Produce the header for a Christmas Carol, greatly stripped down from what we usually produce. * * @author Roedy Green, Canadian Mind Products * @version 1.8 2009-02-06 include go package in ZIP bundle. * @since 2009 */ public final class CarolHead extends Head { // declarations /** * how to use the macro */ private static final String USAGE = "\nCarolHead macro needs title image [author] [coyrightyear]"; // /declarations // methods /** * Generate the header Christmas carol, stripped down from usual head. * * @param parms parameters from macro command line. parms[0] = title description of fragment. parms[1] * @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( "C" ); } if ( !( 2 <= parms.length && parms.length <= 4 ) ) { throw new IllegalArgumentException( USAGE ); } final String title = parms[ 0 ]; // image lives in image/carol final String image = "carol/" + parms[ 1 ]; final String keywords = "Christmas,Christmas carol song sheets,Christmas carols,Christmas music,big print," + "carol lyrics,carols,easy-to-read,for visually impaired," + "large collection of Christmas carols,large font," + "large print,large type,printable carol sheets,printable,printable song sheets," + "song sheets"; final String copyrightHolderForPage; final int firstCopyrightYear; if ( parms.length == 4 ) { copyrightHolderForPage = parms[ 2 ]; firstCopyrightYear = Integer.parseInt( parms[ 3 ] ); } else { copyrightHolderForPage = "public domain"; firstCopyrightYear = 0; } final String sectionTitle = "carols"; final String sectionLink = "carols.html"; final String icon16 = "icon16/holly.png"; final FastCat sb = new FastCat( 10 ); sb.append( configuration.getDoctypeDefault( fileBeingDistributed ) ); sb.append( buildInvisHead( stripHTMLTags( title ) /* title */, stripHTMLTags( title ) /* shortTitle */, stripHTMLTags( title ) /* desc */, keywords, icon16, firstCopyrightYear, copyrightHolderForPage ) ); // append body sb.append( "\n" ); // do the you-are-here, how we got to this page. sb.append( buildBreadcrumbs( false /* is not home page */, sectionLink, sectionTitle, null, null, null, null, title ) ); sb.append( "\n

" ); sb.append( title ); sb.append( " " ); sb.append( BuildImage.buildImgTag( image, "Christmas icon", ImageAlignment.middle, null, fileBeingDistributed ) ); sb.append( "

\n" ); sb.append( "" ); return sb.toString(); } // /method // /methods }