/* * [HideFromKindle.java] * * Summary: Suppresses a bit of HTML from being included in a Kindle eBook version of the website. * * Copyright: (c) 2010-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 2010-12-28 initial version */ package com.mindprod.htmlmacros.macro; import static com.mindprod.htmlmacros.macro.Global.configuration; import static java.lang.System.*; /** * Suppresses a bit of HTML from being included in a Kindle eBook version of the website. * * @author Roedy Green, Canadian Mind Products * @version 1.0 2010-12-28 initial version * @since 2010 */ public final class HideFromKindle extends Macro { /** * how to use the macro */ private static final String USAGE = "\nHideFromKindle needs {some html not to include in Kindle book. No embedded " + "macros.}"; /** * Suppresses a bit of HTML from being included in a Kindle eBook. * * @param parms single parm containing HTML, no macros. suppressed if generating a Kindle Book. * @param quiet true if want output suppressed. * @param verbose @return expanded macro */ public String expandMacro( String[] parms, final boolean quiet, final boolean verbose ) { if ( !quiet ) { out.print( "K" ); } if ( parms.length != 1 ) { throw new IllegalArgumentException( USAGE ); } return configuration.isKindle() ? "" : parms[ 0 ]; } }