/* * [Species.java] * * Summary: Displays species name in latin and English. * * Copyright: (c) 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.0 2017-03-04 initial version */ package com.mindprod.htmlmacros.macro; import com.mindprod.fastcat.FastCat; import static java.lang.System.*; /** * Displays species name in latin and English. * * @author Roedy Green, Canadian Mind Products * @version 1.0 2017-03-04 initial version * @since 2017-03-04 */ public final class Species extends Macro { /** * how to use the macro */ private static final String USAGE = "\nSpecies macro needs \"english\" \"latin\""; /** * expand the Species macrco * * @param english English name of the species * @param latin latin name of the species * * @return the expanded HTML text for the macro */ private static String expand( final String english, final String latin ) { final FastCat sb = new FastCat( 6 ); sb.append( "", english, "" ); sb.append( " (", latin, ")" ); return sb.toString(); } /** * @param parms parsed parameters for the macro, often alternating field name and value. * Parameters have lead and * trail spaces removed, but otherwise are intact. If you want & changed to & use * com.mindprod.entities.DeEntifyStrings.deEntifyHTML( parms[i], ' ' ); If you want & changed to * & use EntifyStrings.entifyHTML ( parms[i] ) * @param quiet true if want optional output suppressed. * @param verbose true if want extra output. * * @return the expanded HTML text for the macro */ public String expandMacro( final String[] parms, final boolean quiet, final boolean verbose ) { if ( !quiet ) { out.print( "S" ); } if ( parms.length != 2 ) { throw new IllegalArgumentException( USAGE ); } return expand( parms[ 0 ], parms[ 1 ] ); } }