/* * [RenderInline.java] * * Summary: Renders a string of tokens into inline HTML, usually representing Java source code. * * Copyright: (c) 2009-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.7 2009-04-12 shorter style names, improved highlighting. */ package com.mindprod.jdisplayaux; import com.mindprod.fastcat.FastCat; import com.mindprod.jtokens.Token; /** * Renders a string of tokens into inline HTML, usually representing Java source code. *

* Used by com.mindprod.htmlmacros.jdisplay to expand very short snippets inline. * HTML we display in an iframe has been pre-built. * * @author Roedy Green, Canadian Mind Products * @version 1.7 2009-04-12 shorter style names, improved highlighting. * @see com.mindprod.jprep.JPrep#buildIframe * @since 2007 */ final class RenderInline { /** * expand a tokens to CSS-style HTML * * @param tokens array of tokens to convert to the equivalent css HTML * * @return the equivalent markup HTML */ static String expand( Token[] tokens ) { if ( tokens == null ) { return ""; } final FastCat sb = new FastCat( tokens.length ); for ( Token token : tokens ) { sb.append( token.getHTML() ); } // end for return sb.toString(); } // end expand }