/* * [WebRing.java] * * Summary: Generate a WebRing Nav Bar. * * Copyright: (c) 2007-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 com.mindprod.htmlmacros.macro.Global.configuration; import static java.lang.System.*; /** * Generate a WebRing Nav Bar. * * @author Roedy Green, Canadian Mind Products * @version 1.8 2009-02-06 include go package in ZIP bundle. * @since 2007-04-06 */ @SuppressWarnings( { "WeakerAccess" } ) public final class WebRing extends Macro { /** * how to use the macro */ private static final String USAGE = "\nWebRing macro needs just a numeric u, the WebRing id."; /** * guts to Generate WebRing reference. * * @param u the Webring id number. * * @return html to link to a webring */ private static String expand( long u ) { final String br = configuration.getBr(); final FastCat sb = new FastCat( 27 ); // http://ss.webring.org/navbar?f=j;y=roedygr;u=10002294&comid= sb.append( "
\n" ); sb.append( "\n" ); sb.append( "\n" ); // suspect f=j means javaScript sb.append( "\n" ); sb.append( "\n" ); sb.append( "\n" ); sb.append( "Powered by WebRing." ); sb.append( "\n" ); sb.append( "
\n" ); return sb.toString(); } /** * use: :<!-- macro WebRing 88 --> u# WebringRid to generate a WebRing nav bar. * * @param parms u# as a 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 ) throws IllegalArgumentException { if ( !quiet ) { out.print( "W" ); } if ( parms.length != 1 ) { throw new IllegalArgumentException( USAGE ); } // the WebRing id. final long u; try { u = Long.parseLong( parms[ 0 ].trim() ); } catch ( NumberFormatException e ) { throw new IllegalArgumentException( USAGE ); } return expand( u ); } }