HTML Tidy
0.1
|
00001 #ifndef __PPRINT_H__ 00002 #define __PPRINT_H__ 00003 00004 /* pprint.h -- pretty print parse tree 00005 00006 (c) 1998-2007 (W3C) MIT, ERCIM, Keio University 00007 See tidy.h for the copyright notice. 00008 00009 CVS Info: 00010 $Author: arnaud02 $ 00011 $Date: 2007/02/11 09:45:08 $ 00012 $Revision: 1.9 $ 00013 00014 */ 00015 00016 #include "forward.h" 00017 00018 /* 00019 Block-level and unknown elements are printed on 00020 new lines and their contents indented 2 spaces 00021 00022 Inline elements are printed inline. 00023 00024 Inline content is wrapped on spaces (except in 00025 attribute values or preformatted text, after 00026 start tags and before end tags 00027 */ 00028 00029 #define NORMAL 0u 00030 #define PREFORMATTED 1u 00031 #define COMMENT 2u 00032 #define ATTRIBVALUE 4u 00033 #define NOWRAP 8u 00034 #define CDATA 16u 00035 00036 00037 /* The pretty printer keeps at most two lines of text in the 00038 ** buffer before flushing output. We need to capture the 00039 ** indent state (indent level) at the _beginning_ of _each_ 00040 ** line, not the end of just the second line. 00041 ** 00042 ** We must also keep track "In Attribute" and "In String" 00043 ** states at the _end_ of each line, 00044 */ 00045 00046 typedef struct _TidyIndent 00047 { 00048 int spaces; 00049 int attrValStart; 00050 int attrStringStart; 00051 } TidyIndent; 00052 00053 typedef struct _TidyPrintImpl 00054 { 00055 TidyAllocator *allocator; /* Allocator */ 00056 00057 uint *linebuf; 00058 uint lbufsize; 00059 uint linelen; 00060 uint wraphere; 00061 00062 uint ixInd; 00063 TidyIndent indent[2]; /* Two lines worth of indent state */ 00064 } TidyPrintImpl; 00065 00066 00067 #if 0 && SUPPORT_ASIAN_ENCODINGS 00068 /* #431953 - start RJ Wraplen adjusted for smooth international ride */ 00069 uint CWrapLen( TidyDocImpl* doc, uint ind ); 00070 #endif 00071 00072 void TY_(InitPrintBuf)( TidyDocImpl* doc ); 00073 void TY_(FreePrintBuf)( TidyDocImpl* doc ); 00074 00075 void TY_(PFlushLine)( TidyDocImpl* doc, uint indent ); 00076 00077 00078 /* print just the content of the body element. 00079 ** useful when you want to reuse material from 00080 ** other documents. 00081 ** 00082 ** -- Sebastiano Vigna <vigna@dsi.unimi.it> 00083 */ 00084 00085 void TY_(PrintBody)( TidyDocImpl* doc ); /* you can print an entire document */ 00086 /* node as body using PPrintTree() */ 00087 00088 void TY_(PPrintTree)( TidyDocImpl* doc, uint mode, uint indent, Node *node ); 00089 00090 void TY_(PPrintXMLTree)( TidyDocImpl* doc, uint mode, uint indent, Node *node ); 00091 00092 00093 #endif /* __PPRINT_H__ */