/* * [SectionHead.java] * * Summary: Produce the header for an Section Heading. * * Copyright: (c) 2004-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.GoogleAdSense; import com.mindprod.htmlmacros.support.ImageAlignment; import com.mindprod.htmlmacros.support.Indexing; import com.mindprod.htmlmacros.support.Tools; import static java.lang.System.*; /** * Produce the header for an Section Heading. * * @author Roedy Green, Canadian Mind Products * @version 1.8 2009-02-06 include go package in ZIP bundle. * @since 2004 */ public final class SectionHead extends Head { /** * how to use the macro */ private static final String USAGE = "\nSectionHead macro needs title description keywords icon image [menu]"; /** * build code to display and link to the Bgloss master index and Java glossary * * @return generated html code */ private String buildExtraNavigation() { final String here = Tools.uPathName( fileBeingDistributed ); switch ( here ) { case "jgloss/jgloss.html": { final FastCat sb = new FastCat( 4 ); final String jglossImageRef = BuildImage.buildImgTag( "navigate/jgloss.png", "go to the Java Glossary Master Index", ImageAlignment.middle, "plain", fileBeingDistributed ); sb.append( Tools.completeLink( "jgloss/masterindex.html", jglossImageRef, "plain", fileBeingDistributed ) ); sb.append( '\n' ); final String bglossImageRef = BuildImage.buildImgTag( "navigate/bgloss.png", "go to the Computer Buyers’ Glossary Home", ImageAlignment.middle, "plain", fileBeingDistributed ); sb.append( Tools.completeLink( "bgloss/bgloss.html", bglossImageRef, "plain", fileBeingDistributed ) ); sb.append( '\n' ); return sb.toString(); } case "bgloss/bgloss.html": { final FastCat sb = new FastCat( 4 ); final String bglossImageRef = BuildImage.buildImgTag( "navigate/bgloss.png", "go to the Computer Buyers’ Master Index", ImageAlignment.middle, "plain", fileBeingDistributed ); sb.append( Tools.completeLink( "bgloss/masterindex.html", bglossImageRef, "plain", fileBeingDistributed ) ); final String jglossImageRef = BuildImage.buildImgTag( "navigate/jgloss.png", "go to the Java Glossary", ImageAlignment.middle, "plain", fileBeingDistributed ); sb.append( Tools.completeLink( "jgloss/jgloss.html", jglossImageRef, "plain", fileBeingDistributed ) ); sb.append( '\n' ); return sb.toString(); } default: return null; } } /** * Generate the header for a Section essay. * * @param parms parameters from macro command line. parms[0] = title description of fragment. parms[1] * = description parms[2] = keywords parms[3] = icon png icon for title bar parms[4] = * image for essay parms[5] = optional menu, LOCAL_WEBROOT_WITH_BACKSLASHES relative * @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( "S" ); } if ( parms.length != 5 ) { throw new IllegalArgumentException( USAGE ); } final String title = parms[ 0 ]; final String description = parms[ 1 ]; final String keywords = parms[ 2 ]; final String icon16 = parms[ 3 ]; final String topLeftOfPageImage = parms[ 4 ]; final String extraNavigation = buildExtraNavigation(); return generalHead( title, null, description, title, "titlesection", keywords, icon16, null, topLeftOfPageImage, null, extraNavigation, null, null, null, null, null, null, null, null, Indexing.NONE, GoogleAdSense.MEDIUM_RECTANGLE, null, null ); } }