" );
sb.append( acronymItem.getPlainAbbr() );
sb.append( "" );
}
}
else
{
// show acronym with link
final String cssClassForLink = Global.assignCSSClasses.assignCSSClass( url, fileBeingDistributed );
final String comboClassForLink = ( showMeans ? "acronymdef" : "acronym" ) + ( cssClassForLink != null
? " " + cssClassForLink
: "" );
sb.append( Tools.completeLink( url,
acronymItem.getPlainAbbr(),
comboClassForLink,
fileBeingDistributed ) );
}
}
}
if ( encloseInTd )
{
sb.append( "" );
}
if ( showMeans )
{
if ( !encloseInTd )
{
sb.append( " (" );
}
sb.append( acronymItem.getPrettyMeans() );
if ( !encloseInTd )
{
sb.append( ")" );
}
}
return sb.toString();
} // /method
/**
* guts of Acronym macro expansion without ref. Called by BestBrowsers and OnOracle.
*
* @param underscoredAbbr the short form of the acronym
*
* @return HTML expansion of the formula
*/
String expandNoRef( String underscoredAbbr )
{
final AcronymItem acronymItem = AcronymItem.getAcronymItem( underscoredAbbr );
if ( acronymItem == null )
{
throw new IllegalArgumentException( "macro Acronym: " + underscoredAbbr + " not a supported built-in acronym." );
}
return expand( acronymItem, false /* no td */, 2 /* with class */, 1 /* if first on page */, false /* no url */ );
} // /method
/**
* Generate Acronym formula
*
* @param parms formula without spaces or superscripts
* @param quiet true if want output suppressed.
* @param verbose @return expanded macro text
*/
public String expandMacro( String[] parms, final boolean quiet, final boolean verbose )
{
if ( !quiet )
{
out.print( "A" );
}
if ( !fileBeingProcessed.equals( prevFileBeingProcessed ) )
{
acronymsUsedOnThisPage.clear();
prevFileBeingProcessed = fileBeingProcessed;
}
String underscoredAbbr = null;
String tildeMeans = null;
String url = null;
boolean encloseInTd = false;
// 0 = no, 1 without class or abbr or other markup, 2 with class
int showAcronym = 2; // default
// 0=no 1=if first on page 2=always
int whenShowMeans = 1;
for ( String parm : parms )
{
switch ( parm )
{
case "see":
// force display of meaning all the time.
showAcronym = 2;
whenShowMeans = 2;
break;
case "means":
// just show expansion, not the acronym itself.
showAcronym = 0;
whenShowMeans = 2;
break;
case "td":
// separate acronym | mean. Markup must supply enclosing | .. |
encloseInTd = true;
showAcronym = 2;
whenShowMeans = 2;
break;
case "dummy":
// don't expand this as an acronym, it is just a word that looks like one.
showAcronym = 1;
whenShowMeans = 0;
break;
default:
if ( underscoredAbbr == null )
{
underscoredAbbr = parm;
}
else if ( tildeMeans == null )
{
tildeMeans = parm;
}
else if ( url == null )
{
url = parm;
}
else
{
throw new IllegalArgumentException( USAGE );
}
break;
}
} // end for
// look up meaning and url for built-in acronyms
AcronymItem acronymItem;
if ( tildeMeans == null )
{
// look it up, the normal case, table contains both singular and plural versions
acronymItem = AcronymItem.getAcronymItem( underscoredAbbr );
if ( acronymItem == null )
{
throw new IllegalArgumentException( "macro Acronym: "
+ underscoredAbbr
+ " not a supported built-in acronym." );
}
}
else
{
// user supplied meaning inline in the macro, build a new entry, but don't add it to the ccollection.
acronymItem = new AcronymItem( underscoredAbbr, AcronymItem.calcPlainAbbr( underscoredAbbr ), tildeMeans, url );
}
return expand( acronymItem, encloseInTd, showAcronym, whenShowMeans, true /* show url */ );
} // /method
// /methods
}