/* * [Twice.java] * * Summary: Repeats a word to hide it from the spell checker. * * Copyright: (c) 2012-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 2012-08-20 initial version */ package com.mindprod.htmlmacros.macro; import com.mindprod.fastcat.FastCat; import static java.lang.System.*; /** * Repeats a word to hide it from the spell checker. * * @author Roedy Green, Canadian Mind Products * @version 1.0 2012-08-20 initial version * @since 2012-08-20 */ public final class Twice extends Macro { /** * how to use the macro */ private static final String USAGE = "\nneed Twice someWord"; /** * guts to Generate * * @param word to double * * @return word twice separated by space */ private static String expand( final String word ) { final FastCat sb = new FastCat( 3 ); sb.append( word ); sb.append( " " ); sb.append( word ); return sb.toString(); } /** * expands * <!-- macro Twice way --> becomes way way * * @param parms word to display twice * @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( "T" ); } if ( parms.length != 1 ) { throw new IllegalArgumentException( "Need one parm.\n" + USAGE ); } return expand( parms[ 0 ] ); } }