/* * [Newsgroup.java] * * Summary: Generate a reference newsgroup. * * Copyright: (c) 2006-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 static java.lang.System.*; /** * Generate a reference newsgroup. * * @author Roedy Green, Canadian Mind Products * @version 1.8 2009-02-06 include go package in ZIP bundle. * @since 2006-02-22 */ public final class Newsgroup extends Macro { /** how to use the macro */ /** * how to use the macro */ private static final String USAGE = "\nNewsgroup macro needs newsgroupName"; /** * guts to Generate reference to a newsgroup. * * @param newsgroup newsgroup name as a dottedString * * @return expanded href to link to Google's access to that newsgroup */ private static String expand( String newsgroup ) { // appears as newsgroup name preceded by clickable yellow google star and // followed by clickable orange newsgroup star final FastCat sb = new FastCat( 8 ); sb.append( "" ); sb.append( newsgroup, "" ); /* htmlvalidator says news: not news:// */ // no need for   star makes its own space. sb.append( "" ); return sb.toString(); } /** * typical use: Generates a reference to the equivalent Google * Group * * @param parms name of newsgroup as a dotted string * @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( "N" ); } if ( parms.length == 0 ) { return "Google Groups"; } else if ( parms.length != 1 ) { throw new IllegalArgumentException( USAGE ); } String newsgroup = parms[ 0 ]; return expand( newsgroup ); } }