Class HtmlCompressor
- java.lang.Object
-
- com.googlecode.htmlcompressor.compressor.HtmlCompressor
-
- All Implemented Interfaces:
Compressor
public class HtmlCompressor extends Object implements Compressor
Class that compresses given HTML source by removing comments, extra spaces and lin<pre> while preserving content within <pre>, <textarea>, <script> and <style> tags.Blocks that should be additionally preserved could be marked with:
<!-- {{{ -->
...
<!-- }}} -->
or any number of user defined patterns.Content inside <script> or <style> tags could be optionally compressed using Yahoo YUI Compressor or Google Closure Compiler libraries.
- Author:
- Sergiy Kovalchuk
-
-
Field Summary
Fields Modifier and Type Field Description static StringALL_TAGSCould be passed tosetRemoveSurroundingSpacesmethod to remove all surrounding spaces (not recommended).static StringBLOCK_TAGS_MAXPredefined list of tags that are block-level by default, excluding<div>and<li>tags.static StringBLOCK_TAGS_MINPredefined list of tags that are very likely to be block-level.protected static PatternbooleanAttrPatternThe Constant booleanAttrPattern.protected static PatterncdataPatternThe Constant cdataPattern.protected static PatterncommentPatternThe Constant commentPattern.protected static PatterncondCommentPatternThe Constant condCommentPattern.protected static PatterndoctypePatternThe Constant doctypePattern.protected static PatternemptyPatternThe Constant emptyPattern.protected static PatterneventJsProtocolPatternThe Constant eventJsProtocolPattern.protected static PatterneventPattern1The Constant eventPattern1 (unmasked).protected static PatterneventPattern2The Constant eventPattern2.protected static PatternformMethodAttrPatternThe Constant formMethodAttrPattern.protected static PatternhttpProtocolPatternThe Constant httpProtocolPattern.protected static PatternhttpsProtocolPatternThe Constant httpsProtocolPattern.protected static PatterninputTypeAttrPatternThe Constant inputTypeAttrPattern.protected static PatternintertagPattern_CustomCustomThe Constant intertagPattern_CustomCustom.protected static PatternintertagPattern_CustomTagThe Constant intertagPattern_CustomTag.protected static PatternintertagPattern_TagCustomThe Constant intertagPattern_TagCustom.protected static PatternintertagPattern_TagTagThe Constant intertagPattern_TagTag.static StringJS_COMPRESSOR_CLOSUREThe Constant JS_COMPRESSOR_CLOSURE.static StringJS_COMPRESSOR_YUIThe Constant JS_COMPRESSOR_YUI.protected static PatternjsLangAttrPatternThe Constant jsLangAttrPattern.protected static PatternjsTypeAttrPatternThe Constant jsTypeAttrPattern.protected static PatternlineBreakPatternThe Constant lineBreakPattern.protected static PatternlinkRelAttrPatternThe Constant linkRelAttrPattern.protected static PatternlinkTypeAttrPatternThe Constant linkTypeAttrPattern.protected static PatternmultispacePatternThe Constant multispacePattern.static PatternPHP_TAG_PATTERNPredefined pattern that matches<?php ...protected static PatternprePatternThe Constant prePattern.protected static PatternrelExternalPatternThe Constant relExternalPattern.protected static PatternscriptPatternThe Constant scriptPattern.static PatternSERVER_SCRIPT_TAG_PATTERNPredefined pattern that matches<% ...static PatternSERVER_SIDE_INCLUDE_PATTERNPredefined pattern that matches<--# ...protected static PatternskipPatternThe Constant skipPattern.protected static PatternstylePatternThe Constant stylePattern.protected static PatternstyleTypeAttrPatternThe Constant styleTypeAttrPattern.protected static PatternsurroundingSpacesAllPatternThe Constant surroundingSpacesAllPattern.protected static PatternsurroundingSpacesMaxPatternThe Constant surroundingSpacesMaxPattern.protected static PatternsurroundingSpacesMinPatternThe Constant surroundingSpacesMinPattern.protected static PatterntagEndSpacePatternThe Constant tagEndSpacePattern.protected static PatterntagLastUnquotedValuePatternThe Constant tagLastUnquotedValuePattern.protected static PatterntagPropertyPatternThe Constant tagPropertyPattern.protected static PatterntagQuotePatternThe Constant tagQuotePattern.protected static PatterntaPatternThe Constant taPattern.protected static StringTEMP_COND_COMMENT_BLOCKThe Constant tempCondCommentBlock.protected static StringTEMP_EVENT_BLOCKThe Constant tempEventBlock.protected static StringTEMP_LINE_BREAK_BLOCKThe Constant tempLineBreakBlock.protected static StringTEMP_PRE_BLOCKThe Constant tempPreBlock.protected static StringTEMP_SCRIPT_BLOCKThe Constant tempScriptBlock.protected static StringTEMP_SKIP_BLOCKThe Constant tempSkipBlock.protected static StringTEMP_STYLE_BLOCKThe Constant tempStyleBlock.protected static StringTEMP_TEXT_AREA_BLOCKThe Constant tempTextAreaBlock.protected static StringTEMP_USER_BLOCKThe Constant tempUserBlock.protected static PatterntempCondCommentPatternThe Constant tempCondCommentPattern.protected static PatterntempEventPatternThe Constant tempEventPattern.protected static PatterntempLineBreakPatternThe Constant tempLineBreakPattern.protected static PatterntempPrePatternThe Constant tempPrePattern.protected static PatterntempScriptPatternThe Constant tempScriptPattern.protected static PatterntempSkipPatternThe Constant tempSkipPattern.protected static PatterntempStylePatternThe Constant tempStylePattern.protected static PatterntempTextAreaPatternThe Constant tempTextAreaPattern.protected static PatterntypeAttrPatternThe Constant typeAttrPattern.
-
Constructor Summary
Constructors Constructor Description HtmlCompressor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Stringcompress(String html)The main method that compresses given HTML source and returns compressed result.protected StringcompressCssStyles(String source)Compress css styles.protected StringcompressJavaScript(String source)Compress java script.protected HtmlCompressorcreateCompressorClone()Creates the compressor clone.protected voidendStatistics(String html)End statistics.CompressorgetCssCompressor()Returns CSS compressor implementation that will be used to compress inline CSS in HTML.CompressorgetJavaScriptCompressor()Returns JavaScript compressor implementation that will be used to compress inline JavaScript in HTML.List<Pattern>getPreservePatterns()Returns a list of Patterns defining custom preserving block rules.StringgetRemoveSurroundingSpaces()Returns a comma separated list of tags around which spaces will be removed.HtmlCompressorStatisticsgetStatistics()ReturnsHtmlCompressorStatisticsobject containing statistics of the last HTML compression, if enabled.intgetYuiCssLineBreak()Returns number of symbols per line Yahoo YUI Compressor will use during CSS compression.org.mozilla.javascript.ErrorReportergetYuiErrorReporter()ReturnsErrorReporterused by YUI Compressor to log error messages during JavasSript compression.intgetYuiJsLineBreak()Returns number of symbols per line Yahoo YUI Compressor will use during JavaScript compression.protected voidinitStatistics(String html)Inits the statistics.booleanisCompressCss()Returnstrueif CSS compression is enabled.booleanisCompressJavaScript()Returnstrueif JavaScript compression is enabled.booleanisEnabled()Returnstrueif compression is enabled.booleanisGenerateStatistics()Returnstrueif HTML compression statistics is generated.booleanisPreserveLineBreaks()Returnstrueif line breaks will be preserved.booleanisRemoveComments()Returnstrueif all HTML comments will be removed.booleanisRemoveFormAttributes()Returnstrueifmethod="get"attributes will be removed from<form>tags.booleanisRemoveHttpProtocol()ReturnstrueifHTTPprotocol will be removed fromhref,src,cite, andactiontag attributes.booleanisRemoveHttpsProtocol()ReturnstrueifHTTPSprotocol will be removed fromhref,src,cite, andactiontag attributes.booleanisRemoveInputAttributes()Returnstrueiftype="text"attributes will be removed from<input>tags.booleanisRemoveIntertagSpaces()Returnstrueif all inter-tag whitespace characters will be removed.booleanisRemoveJavaScriptProtocol()Returnstrueifjavascript:pseudo-protocol will be removed from inline event handlers.booleanisRemoveLinkAttributes()Returnstrueif unnecessary attributes will be removed from<link>tags.booleanisRemoveMultiSpaces()Returnstrueif all multiple whitespace characters will be replaced with single spaces.booleanisRemoveQuotes()Returnstrueif all unnecessary quotes will be removed from tag attributes.booleanisRemoveScriptAttributes()Returnstrueif unnecessary attributes will be removed from<script>tags.booleanisRemoveStyleAttributes()Returnstrueiftype="text/style"attributes will be removed from<style>tags.booleanisSimpleBooleanAttributes()Returnstrueif boolean attributes will be simplified.booleanisSimpleDoctype()Returnstrueif existing DOCTYPE declaration will be replaced with simple<!DOCTYPE html>declaration.booleanisYuiJsDisableOptimizations()Returnstrueif Yahoo YUI Compressor will disable all the built-in micro optimizations during JavaScript compression.booleanisYuiJsNoMunge()Returnstrueif Yahoo YUI Compressor will only minify javascript without obfuscating local symbols.booleanisYuiJsPreserveAllSemiColons()Returnstrueif Yahoo YUI Compressor will preserve unnecessary semicolons during JavaScript compression.protected StringpreserveBlocks(String html, List<String> preBlocks, List<String> taBlocks, List<String> scriptBlocks, List<String> styleBlocks, List<String> eventBlocks, List<String> condCommentBlocks, List<String> skipBlocks, List<String> lineBreakBlocks, List<List<String>> userBlocks)Preserve blocks.protected voidprocessCondCommentBlocks(List<String> condCommentBlocks)Process cond comment blocks.protected voidprocessEventBlocks(List<String> eventBlocks)Process event blocks.protected StringprocessHtml(String html)Process html.protected voidprocessLineBreakBlocks(List<String> lineBreakBlocks)Process line break blocks.protected voidprocessPreBlocks(List<String> preBlocks)Process pre blocks.protected voidprocessPreservedBlocks(List<String> preBlocks, List<String> taBlocks, List<String> scriptBlocks, List<String> styleBlocks, List<String> eventBlocks, List<String> condCommentBlocks, List<String> skipBlocks, List<String> lineBreakBlocks, List<List<String>> userBlocks)Process preserved blocks.protected voidprocessScriptBlocks(List<String> scriptBlocks)Process script blocks.protected voidprocessSkipBlocks(List<String> skipBlocks)Process skip blocks.protected voidprocessStyleBlocks(List<String> styleBlocks)Process style blocks.protected voidprocessTextAreaBlocks(List<String> taBlocks)Process text area blocks.protected voidprocessUserBlocks(List<List<String>> userBlocks)Process user blocks.protected StringremoveComments(String html)Removes the comments.protected StringremoveFormAttributes(String html)Removes the form attributes.protected StringremoveHttpProtocol(String html)Removes the http protocol.protected StringremoveHttpsProtocol(String html)Removes the https protocol.protected StringremoveInputAttributes(String html)Removes the input attributes.protected StringremoveIntertagSpaces(String html)Removes the intertag spaces.protected StringremoveJavaScriptProtocol(String source)Removes the java script protocol.protected StringremoveLinkAttributes(String html)Removes the link attributes.protected StringremoveMultiSpaces(String html)Removes the multi spaces.protected StringremoveQuotesInsideTags(String html)Removes the quotes inside tags.protected StringremoveScriptAttributes(String html)Removes the script attributes.protected StringremoveSpacesInsideTags(String html)Removes the spaces inside tags.protected StringremoveStyleAttributes(String html)Removes the style attributes.protected StringremoveSurroundingSpaces(String html)Removes the surrounding spaces.protected StringreturnBlocks(String html, List<String> preBlocks, List<String> taBlocks, List<String> scriptBlocks, List<String> styleBlocks, List<String> eventBlocks, List<String> condCommentBlocks, List<String> skipBlocks, List<String> lineBreakBlocks, List<List<String>> userBlocks)Return blocks.voidsetCompressCss(boolean compressCss)Enables CSS compression within <style> tags using Yahoo YUI Compressor if set totrue.voidsetCompressJavaScript(boolean compressJavaScript)Enables JavaScript compression within <script> tags using Yahoo YUI Compressor if set totrue.voidsetCssCompressor(Compressor cssCompressor)Sets CSS compressor implementation that will be used to compress inline CSS in HTML.voidsetEnabled(boolean enabled)If set tofalseall compression will be bypassed.voidsetGenerateStatistics(boolean generateStatistics)If set totrue, HTML compression statistics will be generated.voidsetJavaScriptCompressor(Compressor javaScriptCompressor)Sets JavaScript compressor implementation that will be used to compress inline JavaScript in HTML.voidsetPreserveLineBreaks(boolean preserveLineBreaks)If set totrue, line breaks will be preserved.voidsetPreservePatterns(List<Pattern> preservePatterns)This method allows setting custom block preservation rules defined by regular expression patterns.voidsetRemoveComments(boolean removeComments)If set totrueall HTML comments will be removed.voidsetRemoveFormAttributes(boolean removeFormAttributes)If set totrue,method="get"attributes will be removed from<form>tags.voidsetRemoveHttpProtocol(boolean removeHttpProtocol)If set totrue,HTTPprotocol will be removed fromhref,src,cite, andactiontag attributes.voidsetRemoveHttpsProtocol(boolean removeHttpsProtocol)If set totrue,HTTPSprotocol will be removed fromhref,src,cite, andactiontag attributes.voidsetRemoveInputAttributes(boolean removeInputAttributes)If set totrue,type="text"attributes will be removed from<input>tags.voidsetRemoveIntertagSpaces(boolean removeIntertagSpaces)If set totrueall inter-tag whitespace characters will be removed.voidsetRemoveJavaScriptProtocol(boolean removeJavaScriptProtocol)If set totrue,javascript:pseudo-protocol will be removed from inline event handlers.voidsetRemoveLinkAttributes(boolean removeLinkAttributes)If set totrue, following attributes will be removed from<link rel="stylesheet">and<link rel="alternate stylesheet">tags: type="text/css" type="text/plain"voidsetRemoveMultiSpaces(boolean removeMultiSpaces)If set totrueall multiple whitespace characters will be replaced with single spaces.voidsetRemoveQuotes(boolean removeQuotes)If set totrueall unnecessary quotes will be removed from tag attributes.voidsetRemoveScriptAttributes(boolean removeScriptAttributes)If set totrue, following attributes will be removed from<script>tags: type="text/javascript" type="application/javascript" language="javascript"voidsetRemoveStyleAttributes(boolean removeStyleAttributes)If set totrue,type="text/style"attributes will be removed from<style>tags.voidsetRemoveSurroundingSpaces(String tagList)Enables surrounding spaces removal around provided comma separated list of tags.voidsetSimpleBooleanAttributes(boolean simpleBooleanAttributes)If set totrue, any values of following boolean attributes will be removed: checked selected disabled readonlyvoidsetSimpleDoctype(boolean simpleDoctype)If set totrue, existing DOCTYPE declaration will be replaced with simple<!DOCTYPE html>declaration.voidsetYuiCssLineBreak(int yuiCssLineBreak)Tells Yahoo YUI Compressor to break lines after the specified number of symbols during CSS compression.voidsetYuiErrorReporter(org.mozilla.javascript.ErrorReporter yuiErrorReporter)SetsErrorReporterthat YUI Compressor will use for reporting errors during JavaScript compression.voidsetYuiJsDisableOptimizations(boolean yuiJsDisableOptimizations)Tells Yahoo YUI Compressor to disable all the built-in micro optimizations during JavaScript compression.voidsetYuiJsLineBreak(int yuiJsLineBreak)Tells Yahoo YUI Compressor to break lines after the specified number of symbols during JavaScript compression.voidsetYuiJsNoMunge(boolean yuiJsNoMunge)Tells Yahoo YUI Compressor to only minify javascript without obfuscating local symbols.voidsetYuiJsPreserveAllSemiColons(boolean yuiJsPreserveAllSemiColons)Tells Yahoo YUI Compressor to preserve unnecessary semicolons during JavaScript compression.protected StringsimpleBooleanAttributes(String html)Simple boolean attributes.protected StringsimpleDoctype(String html)Simple doctype.
-
-
-
Field Detail
-
JS_COMPRESSOR_YUI
public static final String JS_COMPRESSOR_YUI
The Constant JS_COMPRESSOR_YUI.- See Also:
- Constant Field Values
-
JS_COMPRESSOR_CLOSURE
public static final String JS_COMPRESSOR_CLOSURE
The Constant JS_COMPRESSOR_CLOSURE.- See Also:
- Constant Field Values
-
PHP_TAG_PATTERN
public static final Pattern PHP_TAG_PATTERN
Predefined pattern that matches<?php ... ?>tags. Could be passed inside a list tosetPreservePatternsmethod.
-
SERVER_SCRIPT_TAG_PATTERN
public static final Pattern SERVER_SCRIPT_TAG_PATTERN
Predefined pattern that matches<% ... %>tags. Could be passed inside a list tosetPreservePatternsmethod.
-
SERVER_SIDE_INCLUDE_PATTERN
public static final Pattern SERVER_SIDE_INCLUDE_PATTERN
Predefined pattern that matches<--# ... -->tags. Could be passed inside a list tosetPreservePatternsmethod.
-
BLOCK_TAGS_MIN
public static final String BLOCK_TAGS_MIN
Predefined list of tags that are very likely to be block-level. Could be passed tosetRemoveSurroundingSpacesmethod.- See Also:
- Constant Field Values
-
BLOCK_TAGS_MAX
public static final String BLOCK_TAGS_MAX
Predefined list of tags that are block-level by default, excluding<div>and<li>tags. Table tags are also included. Could be passed tosetRemoveSurroundingSpacesmethod.- See Also:
- Constant Field Values
-
ALL_TAGS
public static final String ALL_TAGS
Could be passed tosetRemoveSurroundingSpacesmethod to remove all surrounding spaces (not recommended).- See Also:
- Constant Field Values
-
TEMP_COND_COMMENT_BLOCK
protected static final String TEMP_COND_COMMENT_BLOCK
The Constant tempCondCommentBlock.- See Also:
- Constant Field Values
-
TEMP_PRE_BLOCK
protected static final String TEMP_PRE_BLOCK
The Constant tempPreBlock.- See Also:
- Constant Field Values
-
TEMP_TEXT_AREA_BLOCK
protected static final String TEMP_TEXT_AREA_BLOCK
The Constant tempTextAreaBlock.- See Also:
- Constant Field Values
-
TEMP_SCRIPT_BLOCK
protected static final String TEMP_SCRIPT_BLOCK
The Constant tempScriptBlock.- See Also:
- Constant Field Values
-
TEMP_STYLE_BLOCK
protected static final String TEMP_STYLE_BLOCK
The Constant tempStyleBlock.- See Also:
- Constant Field Values
-
TEMP_EVENT_BLOCK
protected static final String TEMP_EVENT_BLOCK
The Constant tempEventBlock.- See Also:
- Constant Field Values
-
TEMP_LINE_BREAK_BLOCK
protected static final String TEMP_LINE_BREAK_BLOCK
The Constant tempLineBreakBlock.- See Also:
- Constant Field Values
-
TEMP_SKIP_BLOCK
protected static final String TEMP_SKIP_BLOCK
The Constant tempSkipBlock.- See Also:
- Constant Field Values
-
TEMP_USER_BLOCK
protected static final String TEMP_USER_BLOCK
The Constant tempUserBlock.- See Also:
- Constant Field Values
-
emptyPattern
protected static final Pattern emptyPattern
The Constant emptyPattern.
-
skipPattern
protected static final Pattern skipPattern
The Constant skipPattern.
-
condCommentPattern
protected static final Pattern condCommentPattern
The Constant condCommentPattern.
-
commentPattern
protected static final Pattern commentPattern
The Constant commentPattern.
-
intertagPattern_TagTag
protected static final Pattern intertagPattern_TagTag
The Constant intertagPattern_TagTag.
-
intertagPattern_TagCustom
protected static final Pattern intertagPattern_TagCustom
The Constant intertagPattern_TagCustom.
-
intertagPattern_CustomTag
protected static final Pattern intertagPattern_CustomTag
The Constant intertagPattern_CustomTag.
-
intertagPattern_CustomCustom
protected static final Pattern intertagPattern_CustomCustom
The Constant intertagPattern_CustomCustom.
-
multispacePattern
protected static final Pattern multispacePattern
The Constant multispacePattern.
-
tagEndSpacePattern
protected static final Pattern tagEndSpacePattern
The Constant tagEndSpacePattern.
-
tagLastUnquotedValuePattern
protected static final Pattern tagLastUnquotedValuePattern
The Constant tagLastUnquotedValuePattern.
-
tagQuotePattern
protected static final Pattern tagQuotePattern
The Constant tagQuotePattern.
-
prePattern
protected static final Pattern prePattern
The Constant prePattern.
-
taPattern
protected static final Pattern taPattern
The Constant taPattern.
-
scriptPattern
protected static final Pattern scriptPattern
The Constant scriptPattern.
-
stylePattern
protected static final Pattern stylePattern
The Constant stylePattern.
-
tagPropertyPattern
protected static final Pattern tagPropertyPattern
The Constant tagPropertyPattern.
-
cdataPattern
protected static final Pattern cdataPattern
The Constant cdataPattern.
-
doctypePattern
protected static final Pattern doctypePattern
The Constant doctypePattern.
-
typeAttrPattern
protected static final Pattern typeAttrPattern
The Constant typeAttrPattern.
-
jsTypeAttrPattern
protected static final Pattern jsTypeAttrPattern
The Constant jsTypeAttrPattern.
-
jsLangAttrPattern
protected static final Pattern jsLangAttrPattern
The Constant jsLangAttrPattern.
-
styleTypeAttrPattern
protected static final Pattern styleTypeAttrPattern
The Constant styleTypeAttrPattern.
-
linkTypeAttrPattern
protected static final Pattern linkTypeAttrPattern
The Constant linkTypeAttrPattern.
-
linkRelAttrPattern
protected static final Pattern linkRelAttrPattern
The Constant linkRelAttrPattern.
-
formMethodAttrPattern
protected static final Pattern formMethodAttrPattern
The Constant formMethodAttrPattern.
-
inputTypeAttrPattern
protected static final Pattern inputTypeAttrPattern
The Constant inputTypeAttrPattern.
-
booleanAttrPattern
protected static final Pattern booleanAttrPattern
The Constant booleanAttrPattern.
-
eventJsProtocolPattern
protected static final Pattern eventJsProtocolPattern
The Constant eventJsProtocolPattern.
-
httpProtocolPattern
protected static final Pattern httpProtocolPattern
The Constant httpProtocolPattern.
-
httpsProtocolPattern
protected static final Pattern httpsProtocolPattern
The Constant httpsProtocolPattern.
-
relExternalPattern
protected static final Pattern relExternalPattern
The Constant relExternalPattern.
-
eventPattern1
protected static final Pattern eventPattern1
The Constant eventPattern1 (unmasked).
-
eventPattern2
protected static final Pattern eventPattern2
The Constant eventPattern2.
-
lineBreakPattern
protected static final Pattern lineBreakPattern
The Constant lineBreakPattern.
-
surroundingSpacesMinPattern
protected static final Pattern surroundingSpacesMinPattern
The Constant surroundingSpacesMinPattern.
-
surroundingSpacesMaxPattern
protected static final Pattern surroundingSpacesMaxPattern
The Constant surroundingSpacesMaxPattern.
-
surroundingSpacesAllPattern
protected static final Pattern surroundingSpacesAllPattern
The Constant surroundingSpacesAllPattern.
-
tempCondCommentPattern
protected static final Pattern tempCondCommentPattern
The Constant tempCondCommentPattern.
-
tempPrePattern
protected static final Pattern tempPrePattern
The Constant tempPrePattern.
-
tempTextAreaPattern
protected static final Pattern tempTextAreaPattern
The Constant tempTextAreaPattern.
-
tempScriptPattern
protected static final Pattern tempScriptPattern
The Constant tempScriptPattern.
-
tempStylePattern
protected static final Pattern tempStylePattern
The Constant tempStylePattern.
-
tempEventPattern
protected static final Pattern tempEventPattern
The Constant tempEventPattern.
-
tempSkipPattern
protected static final Pattern tempSkipPattern
The Constant tempSkipPattern.
-
tempLineBreakPattern
protected static final Pattern tempLineBreakPattern
The Constant tempLineBreakPattern.
-
-
Method Detail
-
compress
public String compress(String html)
The main method that compresses given HTML source and returns compressed result.- Specified by:
compressin interfaceCompressor- Parameters:
html- HTML content to compress- Returns:
- compressed content.
-
initStatistics
protected void initStatistics(String html)
Inits the statistics.- Parameters:
html- the html
-
endStatistics
protected void endStatistics(String html)
End statistics.- Parameters:
html- the html
-
preserveBlocks
protected String preserveBlocks(String html, List<String> preBlocks, List<String> taBlocks, List<String> scriptBlocks, List<String> styleBlocks, List<String> eventBlocks, List<String> condCommentBlocks, List<String> skipBlocks, List<String> lineBreakBlocks, List<List<String>> userBlocks)
Preserve blocks.- Parameters:
html- the htmlpreBlocks- the pre blockstaBlocks- the ta blocksscriptBlocks- the script blocksstyleBlocks- the style blockseventBlocks- the event blockscondCommentBlocks- the cond comment blocksskipBlocks- the skip blockslineBreakBlocks- the line break blocksuserBlocks- the user blocks- Returns:
- the string
-
returnBlocks
protected String returnBlocks(String html, List<String> preBlocks, List<String> taBlocks, List<String> scriptBlocks, List<String> styleBlocks, List<String> eventBlocks, List<String> condCommentBlocks, List<String> skipBlocks, List<String> lineBreakBlocks, List<List<String>> userBlocks)
Return blocks.- Parameters:
html- the htmlpreBlocks- the pre blockstaBlocks- the ta blocksscriptBlocks- the script blocksstyleBlocks- the style blockseventBlocks- the event blockscondCommentBlocks- the cond comment blocksskipBlocks- the skip blockslineBreakBlocks- the line break blocksuserBlocks- the user blocks- Returns:
- the string
-
processHtml
protected String processHtml(String html)
Process html.- Parameters:
html- the html- Returns:
- the string
-
removeSurroundingSpaces
protected String removeSurroundingSpaces(String html)
Removes the surrounding spaces.- Parameters:
html- the html- Returns:
- the string
-
removeQuotesInsideTags
protected String removeQuotesInsideTags(String html)
Removes the quotes inside tags.- Parameters:
html- the html- Returns:
- the string
-
removeSpacesInsideTags
protected String removeSpacesInsideTags(String html)
Removes the spaces inside tags.- Parameters:
html- the html- Returns:
- the string
-
removeMultiSpaces
protected String removeMultiSpaces(String html)
Removes the multi spaces.- Parameters:
html- the html- Returns:
- the string
-
removeIntertagSpaces
protected String removeIntertagSpaces(String html)
Removes the intertag spaces.- Parameters:
html- the html- Returns:
- the string
-
removeComments
protected String removeComments(String html)
Removes the comments.- Parameters:
html- the html- Returns:
- the string
-
simpleDoctype
protected String simpleDoctype(String html)
Simple doctype.- Parameters:
html- the html- Returns:
- the string
-
removeScriptAttributes
protected String removeScriptAttributes(String html)
Removes the script attributes.- Parameters:
html- the html- Returns:
- the string
-
removeStyleAttributes
protected String removeStyleAttributes(String html)
Removes the style attributes.- Parameters:
html- the html- Returns:
- the string
-
removeLinkAttributes
protected String removeLinkAttributes(String html)
Removes the link attributes.- Parameters:
html- the html- Returns:
- the string
-
removeFormAttributes
protected String removeFormAttributes(String html)
Removes the form attributes.- Parameters:
html- the html- Returns:
- the string
-
removeInputAttributes
protected String removeInputAttributes(String html)
Removes the input attributes.- Parameters:
html- the html- Returns:
- the string
-
simpleBooleanAttributes
protected String simpleBooleanAttributes(String html)
Simple boolean attributes.- Parameters:
html- the html- Returns:
- the string
-
removeHttpProtocol
protected String removeHttpProtocol(String html)
Removes the http protocol.- Parameters:
html- the html- Returns:
- the string
-
removeHttpsProtocol
protected String removeHttpsProtocol(String html)
Removes the https protocol.- Parameters:
html- the html- Returns:
- the string
-
processPreservedBlocks
protected void processPreservedBlocks(List<String> preBlocks, List<String> taBlocks, List<String> scriptBlocks, List<String> styleBlocks, List<String> eventBlocks, List<String> condCommentBlocks, List<String> skipBlocks, List<String> lineBreakBlocks, List<List<String>> userBlocks)
Process preserved blocks.- Parameters:
preBlocks- the pre blockstaBlocks- the ta blocksscriptBlocks- the script blocksstyleBlocks- the style blockseventBlocks- the event blockscondCommentBlocks- the cond comment blocksskipBlocks- the skip blockslineBreakBlocks- the line break blocksuserBlocks- the user blocks
-
processPreBlocks
protected void processPreBlocks(List<String> preBlocks)
Process pre blocks.- Parameters:
preBlocks- the pre blocks
-
processTextAreaBlocks
protected void processTextAreaBlocks(List<String> taBlocks)
Process text area blocks.- Parameters:
taBlocks- the ta blocks
-
processCondCommentBlocks
protected void processCondCommentBlocks(List<String> condCommentBlocks)
Process cond comment blocks.- Parameters:
condCommentBlocks- the cond comment blocks
-
processSkipBlocks
protected void processSkipBlocks(List<String> skipBlocks)
Process skip blocks.- Parameters:
skipBlocks- the skip blocks
-
processLineBreakBlocks
protected void processLineBreakBlocks(List<String> lineBreakBlocks)
Process line break blocks.- Parameters:
lineBreakBlocks- the line break blocks
-
processUserBlocks
protected void processUserBlocks(List<List<String>> userBlocks)
Process user blocks.- Parameters:
userBlocks- the user blocks
-
processEventBlocks
protected void processEventBlocks(List<String> eventBlocks)
Process event blocks.- Parameters:
eventBlocks- the event blocks
-
removeJavaScriptProtocol
protected String removeJavaScriptProtocol(String source)
Removes the java script protocol.- Parameters:
source- the source- Returns:
- the string
-
processScriptBlocks
protected void processScriptBlocks(List<String> scriptBlocks)
Process script blocks.- Parameters:
scriptBlocks- the script blocks
-
processStyleBlocks
protected void processStyleBlocks(List<String> styleBlocks)
Process style blocks.- Parameters:
styleBlocks- the style blocks
-
compressJavaScript
protected String compressJavaScript(String source)
Compress java script.- Parameters:
source- the source- Returns:
- the string
-
compressCssStyles
protected String compressCssStyles(String source)
Compress css styles.- Parameters:
source- the source- Returns:
- the string
-
createCompressorClone
protected HtmlCompressor createCompressorClone()
Creates the compressor clone.- Returns:
- the html compressor
-
isCompressJavaScript
public boolean isCompressJavaScript()
Returnstrueif JavaScript compression is enabled.- Returns:
- current state of JavaScript compression.
-
setCompressJavaScript
public void setCompressJavaScript(boolean compressJavaScript)
Enables JavaScript compression within <script> tags using Yahoo YUI Compressor if set totrue. Default isfalsefor performance reasons.Note: Compressing JavaScript is not recommended if pages are compressed dynamically on-the-fly because of performance impact. You should consider putting JavaScript into a separate file and compressing it using standalone YUICompressor for example.
- Parameters:
compressJavaScript- settrueto enable JavaScript compression. Default isfalse- See Also:
- Yahoo YUI Compressor
-
isCompressCss
public boolean isCompressCss()
Returnstrueif CSS compression is enabled.- Returns:
- current state of CSS compression.
-
setCompressCss
public void setCompressCss(boolean compressCss)
Enables CSS compression within <style> tags using Yahoo YUI Compressor if set totrue. Default isfalsefor performance reasons.Note: Compressing CSS is not recommended if pages are compressed dynamically on-the-fly because of performance impact. You should consider putting CSS into a separate file and compressing it using standalone YUICompressor for example.
- Parameters:
compressCss- settrueto enable CSS compression. Default isfalse- See Also:
- Yahoo YUI Compressor
-
isYuiJsNoMunge
public boolean isYuiJsNoMunge()
Returnstrueif Yahoo YUI Compressor will only minify javascript without obfuscating local symbols. This corresponds to--nomungecommand line option.- Returns:
nomungeparameter value used for JavaScript compression.- See Also:
- Yahoo YUI Compressor
-
setYuiJsNoMunge
public void setYuiJsNoMunge(boolean yuiJsNoMunge)
Tells Yahoo YUI Compressor to only minify javascript without obfuscating local symbols. This corresponds to--nomungecommand line option. This option has effect only if JavaScript compression is enabled. Default isfalse.- Parameters:
yuiJsNoMunge- settrueto enablenomungemode- See Also:
- Yahoo YUI Compressor
-
isYuiJsPreserveAllSemiColons
public boolean isYuiJsPreserveAllSemiColons()
Returnstrueif Yahoo YUI Compressor will preserve unnecessary semicolons during JavaScript compression. This corresponds to--preserve-semicommand line option.- Returns:
preserve-semiparameter value used for JavaScript compression.- See Also:
- Yahoo YUI Compressor
-
setYuiJsPreserveAllSemiColons
public void setYuiJsPreserveAllSemiColons(boolean yuiJsPreserveAllSemiColons)
Tells Yahoo YUI Compressor to preserve unnecessary semicolons during JavaScript compression. This corresponds to--preserve-semicommand line option. This option has effect only if JavaScript compression is enabled. Default isfalse.- Parameters:
yuiJsPreserveAllSemiColons- settrueto enablepreserve-semimode- See Also:
- Yahoo YUI Compressor
-
isYuiJsDisableOptimizations
public boolean isYuiJsDisableOptimizations()
Returnstrueif Yahoo YUI Compressor will disable all the built-in micro optimizations during JavaScript compression. This corresponds to--disable-optimizationscommand line option.- Returns:
disable-optimizationsparameter value used for JavaScript compression.- See Also:
- Yahoo YUI Compressor
-
setYuiJsDisableOptimizations
public void setYuiJsDisableOptimizations(boolean yuiJsDisableOptimizations)
Tells Yahoo YUI Compressor to disable all the built-in micro optimizations during JavaScript compression. This corresponds to--disable-optimizationscommand line option. This option has effect only if JavaScript compression is enabled. Default isfalse.- Parameters:
yuiJsDisableOptimizations- settrueto enabledisable-optimizationsmode- See Also:
- Yahoo YUI Compressor
-
getYuiJsLineBreak
public int getYuiJsLineBreak()
Returns number of symbols per line Yahoo YUI Compressor will use during JavaScript compression. This corresponds to--line-breakcommand line option.- Returns:
line-breakparameter value used for JavaScript compression.- See Also:
- Yahoo YUI Compressor
-
setYuiJsLineBreak
public void setYuiJsLineBreak(int yuiJsLineBreak)
Tells Yahoo YUI Compressor to break lines after the specified number of symbols during JavaScript compression. This corresponds to--line-breakcommand line option. This option has effect only if JavaScript compression is enabled. Default is-1to disable line breaks.- Parameters:
yuiJsLineBreak- set number of symbols per line- See Also:
- Yahoo YUI Compressor
-
getYuiCssLineBreak
public int getYuiCssLineBreak()
Returns number of symbols per line Yahoo YUI Compressor will use during CSS compression. This corresponds to--line-breakcommand line option.- Returns:
line-breakparameter value used for CSS compression.- See Also:
- Yahoo YUI Compressor
-
setYuiCssLineBreak
public void setYuiCssLineBreak(int yuiCssLineBreak)
Tells Yahoo YUI Compressor to break lines after the specified number of symbols during CSS compression. This corresponds to--line-breakcommand line option. This option has effect only if CSS compression is enabled. Default is-1to disable line breaks.- Parameters:
yuiCssLineBreak- set number of symbols per line- See Also:
- Yahoo YUI Compressor
-
isRemoveQuotes
public boolean isRemoveQuotes()
Returnstrueif all unnecessary quotes will be removed from tag attributes.- Returns:
- true, if is removes the quotes
-
setRemoveQuotes
public void setRemoveQuotes(boolean removeQuotes)
If set totrueall unnecessary quotes will be removed from tag attributes. Default isfalse.Note: Even though quotes are removed only when it is safe to do so, it still might break strict HTML validation. Turn this option on only if a page validation is not very important or to squeeze the most out of the compression. This option has no performance impact.
- Parameters:
removeQuotes- settrueto remove unnecessary quotes from tag attributes
-
isEnabled
public boolean isEnabled()
Returnstrueif compression is enabled.- Returns:
trueif compression is enabled.
-
setEnabled
public void setEnabled(boolean enabled)
If set tofalseall compression will be bypassed. Might be useful for testing purposes. Default istrue.- Parameters:
enabled- setfalseto bypass all compression
-
isRemoveComments
public boolean isRemoveComments()
Returnstrueif all HTML comments will be removed.- Returns:
trueif all HTML comments will be removed
-
setRemoveComments
public void setRemoveComments(boolean removeComments)
If set totrueall HTML comments will be removed. Default istrue.- Parameters:
removeComments- settrueto remove all HTML comments
-
isRemoveMultiSpaces
public boolean isRemoveMultiSpaces()
Returnstrueif all multiple whitespace characters will be replaced with single spaces.- Returns:
trueif all multiple whitespace characters will be replaced with single spaces.
-
setRemoveMultiSpaces
public void setRemoveMultiSpaces(boolean removeMultiSpaces)
If set totrueall multiple whitespace characters will be replaced with single spaces. Default istrue.- Parameters:
removeMultiSpaces- settrueto replace all multiple whitespace characters will single spaces.
-
isRemoveIntertagSpaces
public boolean isRemoveIntertagSpaces()
Returnstrueif all inter-tag whitespace characters will be removed.- Returns:
trueif all inter-tag whitespace characters will be removed.
-
setRemoveIntertagSpaces
public void setRemoveIntertagSpaces(boolean removeIntertagSpaces)
If set totrueall inter-tag whitespace characters will be removed. Default isfalse.Note: It is fairly safe to turn this option on unless you rely on spaces for page formatting. Even if you do, you can always preserve required spaces with
. This option has no performance impact.- Parameters:
removeIntertagSpaces- settrueto remove all inter-tag whitespace characters
-
getPreservePatterns
public List<Pattern> getPreservePatterns()
Returns a list of Patterns defining custom preserving block rules.- Returns:
- list of
Patternobjects defining rules for preserving block rules
-
setPreservePatterns
public void setPreservePatterns(List<Pattern> preservePatterns)
This method allows setting custom block preservation rules defined by regular expression patterns. Blocks that match provided patterns will be skipped during HTML compression.Custom preservation rules have higher priority than default rules. Priority between custom rules are defined by their position in a list (beginning of a list has higher priority).
Besides custom patterns, you can use 3 predefined patterns:
PHP_TAG_PATTERN,SERVER_SCRIPT_TAG_PATTERN,SERVER_SIDE_INCLUDE_PATTERN.- Parameters:
preservePatterns- List ofPatternobjects that will be used to skip matched blocks during compression
-
getYuiErrorReporter
public org.mozilla.javascript.ErrorReporter getYuiErrorReporter()
ReturnsErrorReporterused by YUI Compressor to log error messages during JavasSript compression.- Returns:
ErrorReporterused by YUI Compressor to log error messages during JavasSript compression- See Also:
- Yahoo YUI Compressor, Error Reporter Interface
-
setYuiErrorReporter
public void setYuiErrorReporter(org.mozilla.javascript.ErrorReporter yuiErrorReporter)
SetsErrorReporterthat YUI Compressor will use for reporting errors during JavaScript compression. If noErrorReporterwas providedYuiJavaScriptCompressor.DefaultErrorReporterwill be used which reports errors toSystem.errstream.- Parameters:
yuiErrorReporter-ErrorReporterthat will be used by YUI Compressor- See Also:
YuiJavaScriptCompressor.DefaultErrorReporter, Yahoo YUI Compressor, ErrorReporter Interface
-
getJavaScriptCompressor
public Compressor getJavaScriptCompressor()
Returns JavaScript compressor implementation that will be used to compress inline JavaScript in HTML.- Returns:
Compressorimplementation that will be used to compress inline JavaScript in HTML.- See Also:
YuiJavaScriptCompressor,ClosureJavaScriptCompressor, Yahoo YUI Compressor, Google Closure Compiler
-
setJavaScriptCompressor
public void setJavaScriptCompressor(Compressor javaScriptCompressor)
Sets JavaScript compressor implementation that will be used to compress inline JavaScript in HTML.HtmlCompressor currently comes with basic implementations for Yahoo YUI Compressor (called
YuiJavaScriptCompressor) and Google Closure Compiler (calledClosureJavaScriptCompressor) that should be enough for most cases, but users can also create their own JavaScript compressors for custom needs.If no compressor is set
YuiJavaScriptCompressorwill be used by default.- Parameters:
javaScriptCompressor-Compressorimplementation that will be used for inline JavaScript compression- See Also:
YuiJavaScriptCompressor,ClosureJavaScriptCompressor, Yahoo YUI Compressor, Google Closure Compiler
-
getCssCompressor
public Compressor getCssCompressor()
Returns CSS compressor implementation that will be used to compress inline CSS in HTML.- Returns:
Compressorimplementation that will be used to compress inline CSS in HTML.- See Also:
YuiCssCompressor, Yahoo YUI Compressor
-
setCssCompressor
public void setCssCompressor(Compressor cssCompressor)
Sets CSS compressor implementation that will be used to compress inline CSS in HTML.HtmlCompressor currently comes with basic implementation for Yahoo YUI Compressor (called
YuiCssCompressor), but users can also create their own CSS compressors for custom needs.If no compressor is set
YuiCssCompressorwill be used by default.- Parameters:
cssCompressor-Compressorimplementation that will be used for inline CSS compression- See Also:
YuiCssCompressor, Yahoo YUI Compressor
-
isSimpleDoctype
public boolean isSimpleDoctype()
Returnstrueif existing DOCTYPE declaration will be replaced with simple<!DOCTYPE html>declaration.- Returns:
trueif existing DOCTYPE declaration will be replaced with simple<!DOCTYPE html>declaration.
-
setSimpleDoctype
public void setSimpleDoctype(boolean simpleDoctype)
If set totrue, existing DOCTYPE declaration will be replaced with simple<!DOCTYPE html>declaration. Default isfalse.- Parameters:
simpleDoctype- settrueto replace existing DOCTYPE declaration with<!DOCTYPE html>
-
isRemoveScriptAttributes
public boolean isRemoveScriptAttributes()
Returnstrueif unnecessary attributes will be removed from<script>tags.- Returns:
trueif unnecessary attributes will be removed from<script>tags
-
setRemoveScriptAttributes
public void setRemoveScriptAttributes(boolean removeScriptAttributes)
If set totrue, following attributes will be removed from<script>tags:- type="text/javascript"
- type="application/javascript"
- language="javascript"
Default is
false.- Parameters:
removeScriptAttributes- settrueto remove unnecessary attributes from<script>tags
-
isRemoveStyleAttributes
public boolean isRemoveStyleAttributes()
Returnstrueiftype="text/style"attributes will be removed from<style>tags.- Returns:
trueiftype="text/style"attributes will be removed from<style>tags
-
setRemoveStyleAttributes
public void setRemoveStyleAttributes(boolean removeStyleAttributes)
If set totrue,type="text/style"attributes will be removed from<style>tags. Default isfalse.- Parameters:
removeStyleAttributes- settrueto removetype="text/style"attributes from<style>tags
-
isRemoveLinkAttributes
public boolean isRemoveLinkAttributes()
Returnstrueif unnecessary attributes will be removed from<link>tags.- Returns:
trueif unnecessary attributes will be removed from<link>tags
-
setRemoveLinkAttributes
public void setRemoveLinkAttributes(boolean removeLinkAttributes)
If set totrue, following attributes will be removed from<link rel="stylesheet">and<link rel="alternate stylesheet">tags:- type="text/css"
- type="text/plain"
Default is
false.- Parameters:
removeLinkAttributes- settrueto remove unnecessary attributes from<link>tags
-
isRemoveFormAttributes
public boolean isRemoveFormAttributes()
Returnstrueifmethod="get"attributes will be removed from<form>tags.- Returns:
trueifmethod="get"attributes will be removed from<form>tags
-
setRemoveFormAttributes
public void setRemoveFormAttributes(boolean removeFormAttributes)
If set totrue,method="get"attributes will be removed from<form>tags. Default isfalse.- Parameters:
removeFormAttributes- settrueto removemethod="get"attributes from<form>tags
-
isRemoveInputAttributes
public boolean isRemoveInputAttributes()
Returnstrueiftype="text"attributes will be removed from<input>tags.- Returns:
trueiftype="text"attributes will be removed from<input>tags
-
setRemoveInputAttributes
public void setRemoveInputAttributes(boolean removeInputAttributes)
If set totrue,type="text"attributes will be removed from<input>tags. Default isfalse.- Parameters:
removeInputAttributes- settrueto removetype="text"attributes from<input>tags
-
isSimpleBooleanAttributes
public boolean isSimpleBooleanAttributes()
Returnstrueif boolean attributes will be simplified.- Returns:
trueif boolean attributes will be simplified
-
setSimpleBooleanAttributes
public void setSimpleBooleanAttributes(boolean simpleBooleanAttributes)
If set totrue, any values of following boolean attributes will be removed:- checked
- selected
- disabled
- readonly
For example,
<input readonly="readonly">would become<input readonly>Default is
false.- Parameters:
simpleBooleanAttributes- settrueto simplify boolean attributes
-
isRemoveJavaScriptProtocol
public boolean isRemoveJavaScriptProtocol()
Returnstrueifjavascript:pseudo-protocol will be removed from inline event handlers.- Returns:
trueifjavascript:pseudo-protocol will be removed from inline event handlers.
-
setRemoveJavaScriptProtocol
public void setRemoveJavaScriptProtocol(boolean removeJavaScriptProtocol)
If set totrue,javascript:pseudo-protocol will be removed from inline event handlers.For example,
<a onclick="javascript:alert()">would become<a onclick="alert()">Default is
false.- Parameters:
removeJavaScriptProtocol- settrueto removejavascript:pseudo-protocol from inline event handlers.
-
isRemoveHttpProtocol
public boolean isRemoveHttpProtocol()
ReturnstrueifHTTPprotocol will be removed fromhref,src,cite, andactiontag attributes.- Returns:
trueifHTTPprotocol will be removed fromhref,src,cite, andactiontag attributes.
-
setRemoveHttpProtocol
public void setRemoveHttpProtocol(boolean removeHttpProtocol)
If set totrue,HTTPprotocol will be removed fromhref,src,cite, andactiontag attributes. URL without a protocol would make a browser use document's current protocol instead.Tags marked with
rel="external"will be skipped.For example:
<a href="http://example.com"> <script src="http://google.com/js.js" rel="external">would become:
<a href="//example.com"> <script src="http://google.com/js.js" rel="external">Default is
false.- Parameters:
removeHttpProtocol- settrueto removeHTTPprotocol from tag attributes
-
isRemoveHttpsProtocol
public boolean isRemoveHttpsProtocol()
ReturnstrueifHTTPSprotocol will be removed fromhref,src,cite, andactiontag attributes.- Returns:
trueifHTTPSprotocol will be removed fromhref,src,cite, andactiontag attributes.
-
setRemoveHttpsProtocol
public void setRemoveHttpsProtocol(boolean removeHttpsProtocol)
If set totrue,HTTPSprotocol will be removed fromhref,src,cite, andactiontag attributes. URL without a protocol would make a browser use document's current protocol instead.Tags marked with
rel="external"will be skipped.For example:
<a href="https://example.com"> <script src="https://google.com/js.js" rel="external">would become:
<a href="//example.com"> <script src="https://google.com/js.js" rel="external">Default is
false.- Parameters:
removeHttpsProtocol- settrueto removeHTTPprotocol from tag attributes
-
isGenerateStatistics
public boolean isGenerateStatistics()
Returnstrueif HTML compression statistics is generated.- Returns:
trueif HTML compression statistics is generated
-
setGenerateStatistics
public void setGenerateStatistics(boolean generateStatistics)
If set totrue, HTML compression statistics will be generated.Important: Enabling statistics makes HTML compressor not thread safe.
Default is
false.- Parameters:
generateStatistics- settrueto generate HTML compression statistics- See Also:
getStatistics()
-
getStatistics
public HtmlCompressorStatistics getStatistics()
ReturnsHtmlCompressorStatisticsobject containing statistics of the last HTML compression, if enabled. Should be called aftercompress(String)- Returns:
HtmlCompressorStatisticsobject containing last HTML compression statistics- See Also:
HtmlCompressorStatistics,setGenerateStatistics(boolean)
-
isPreserveLineBreaks
public boolean isPreserveLineBreaks()
Returnstrueif line breaks will be preserved.- Returns:
trueif line breaks will be preserved.
-
setPreserveLineBreaks
public void setPreserveLineBreaks(boolean preserveLineBreaks)
If set totrue, line breaks will be preserved.Default is
false.- Parameters:
preserveLineBreaks- settrueto preserve line breaks
-
getRemoveSurroundingSpaces
public String getRemoveSurroundingSpaces()
Returns a comma separated list of tags around which spaces will be removed.- Returns:
- a comma separated list of tags around which spaces will be removed.
-
setRemoveSurroundingSpaces
public void setRemoveSurroundingSpaces(String tagList)
Enables surrounding spaces removal around provided comma separated list of tags.Besides custom defined lists, you can pass one of 3 predefined lists of tags:
BLOCK_TAGS_MIN,BLOCK_TAGS_MAX,ALL_TAGS.- Parameters:
tagList- a comma separated list of tags around which spaces will be removed
-
-