Class PrettyPrinter
- java.lang.Object
-
- com.google.common.css.compiler.passes.CodePrinter
-
- com.google.common.css.compiler.passes.PrettyPrinter
-
- All Implemented Interfaces:
CssCompilerPass
public class PrettyPrinter extends CodePrinter implements CssCompilerPass
A pretty-printer forCssTreeinstances. This is work in progress. Look at PrettyPrinterTest to see what's supported.
-
-
Constructor Summary
Constructors Constructor Description PrettyPrinter(VisitController visitController)PrettyPrinter(VisitController visitController, CodeBuffer buffer, GssSourceMapGenerator generator)PrettyPrinter(VisitController visitController, GssSourceMapGenerator generator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected CssTreeVisitorcreateVisitor(VisitController visitController, CodeBuffer codeBuffer)Constructs the visitor required by the subclass.java.lang.StringgetPrettyPrintedString()voidrunPass()PrettyPrintersetPreserveComments(boolean preserve)Whether comments in the CSS nodes are preserved in the pretty printed output.voidsetStripQuotes(boolean stripQuotes)Whether to strip quotes from certain values.-
Methods inherited from class com.google.common.css.compiler.passes.CodePrinter
getOutputBuffer, resetBuffer, setPreserveMarkedComments, visit
-
-
-
-
Constructor Detail
-
PrettyPrinter
public PrettyPrinter(VisitController visitController, @Nullable CodeBuffer buffer, @Nullable GssSourceMapGenerator generator)
-
PrettyPrinter
public PrettyPrinter(VisitController visitController, GssSourceMapGenerator generator)
-
PrettyPrinter
public PrettyPrinter(VisitController visitController)
-
-
Method Detail
-
setStripQuotes
public void setStripQuotes(boolean stripQuotes)
Whether to strip quotes from certain values. This facilitates tests that want to compare trees.
-
setPreserveComments
public PrettyPrinter setPreserveComments(boolean preserve)
Whether comments in the CSS nodes are preserved in the pretty printed output.Note: Comments layout is not guaranteed, since detailed position information in the input files is not preserved by the parser. Line breaks are added after every comment with current identation as best effort.
-
getPrettyPrintedString
public java.lang.String getPrettyPrintedString()
-
createVisitor
protected CssTreeVisitor createVisitor(VisitController visitController, CodeBuffer codeBuffer)
Description copied from class:CodePrinterConstructs the visitor required by the subclass. This visitor'senter*methods will be called after the source map generator'sstartSourceMappingmethod and before itsendSourceMappingmethod.- Specified by:
createVisitorin classCodePrinter
-
runPass
public void runPass()
- Specified by:
runPassin interfaceCssCompilerPass
-
-