HTML Tidy  5.9.15
The HTACG Tidy HTML Project
HTML and XML Pretty Printing

Detailed Description

These functions and structures form the internal API for document printing.

Data Structures

struct  TidyIndent
 A record of the state of a single line, capturing the indent level, in-attribute, and in-string state of a line. More...
 
struct  TidyPrintImpl
 The pretty-printing buffer. More...
 

Enumerations

enum  PrettyPrintMode {
  NORMAL = 0u ,
  PREFORMATTED = 1u ,
  COMMENT = 2u ,
  ATTRIBVALUE = 4u ,
  NOWRAP = 8u ,
  CDATA = 16u
}
 This typedef represents the current pretty-printing mode, and instructs the printer behavior per the content currently being output. More...
 

Functions

TY_PRIVATE void TY_❪FreePrintBuf❫ (TidyDocImpl *doc)
 Deallocates and free a Tidy document's pretty-printing buffer. More...
 
TY_PRIVATE void TY_❪InitPrintBuf❫ (TidyDocImpl *doc)
 Allocates and initializes the pretty-printing buffer for a Tidy document. More...
 
TY_PRIVATE void TY_❪PFlushLine❫ (TidyDocImpl *doc, uint indent)
 Flushes the current buffer to the actual output sink. More...
 
TY_PRIVATE void TY_❪PPrintTree❫ (TidyDocImpl *doc, uint mode, uint indent, Node *node)
 Print the HTML document tree for the given document using the given node as the root of the document. More...
 
TY_PRIVATE void TY_❪PPrintXMLTree❫ (TidyDocImpl *doc, uint mode, uint indent, Node *node)
 Print the XML document tree for the given document using the given node as the root of the document. More...
 
TY_PRIVATE void TY_❪PrintBody❫ (TidyDocImpl *doc)
 Print just the content of the HTML body element, which is useful when want to reuse material from other documents. More...
 

Data Structure Documentation

◆ TidyIndent

struct TidyIndent

A record of the state of a single line, capturing the indent level, in-attribute, and in-string state of a line.

Instances of this record are used by the pretty-printing buffer.

The pretty printer keeps at most two lines of text in the buffer before flushing output. We need to capture the indent state (indent level) at the beginning of each line, not the end of just the second line.

We must also keep track "In Attribute" and "In String" states at the end of each line,

Data Fields
int attrStringStart Attribute in-string state.
int attrValStart Attribute in-value state.
int spaces Indent level of the line.

◆ TidyPrintImpl

struct TidyPrintImpl

The pretty-printing buffer.

Data Fields
TidyAllocator * allocator Allocator.
TidyIndent indent[2] Two lines worth of indent state.
uint ixInd Index into the indent[] array.
uint lbufsize Current size of the buffer.
uint line Current line.
uint * linebuf The line buffer proper.
uint linelen Current line length.
uint wraphere Point in the line to wrap text.

Enumeration Type Documentation

◆ PrettyPrintMode

This typedef represents the current pretty-printing mode, and instructs the printer behavior per the content currently being output.

Enumerator
NORMAL 

Normal output.

PREFORMATTED 

Preformatted output.

COMMENT 

Comment.

ATTRIBVALUE 

An attribute's value.

NOWRAP 

Content that should not be wrapped.

CDATA 

CDATA content.

Function Documentation

◆ TY_❪FreePrintBuf❫()

TY_PRIVATE void TY_❪FreePrintBuf❫ ( TidyDocImpl *  doc)

Deallocates and free a Tidy document's pretty-printing buffer.

◆ TY_❪InitPrintBuf❫()

TY_PRIVATE void TY_❪InitPrintBuf❫ ( TidyDocImpl *  doc)

Allocates and initializes the pretty-printing buffer for a Tidy document.

◆ TY_❪PFlushLine❫()

TY_PRIVATE void TY_❪PFlushLine❫ ( TidyDocImpl *  doc,
uint  indent 
)

Flushes the current buffer to the actual output sink.

◆ TY_❪PPrintTree❫()

TY_PRIVATE void TY_❪PPrintTree❫ ( TidyDocImpl *  doc,
uint  mode,
uint  indent,
Node *  node 
)

Print the HTML document tree for the given document using the given node as the root of the document.

Note that you can print an entire document node as body using PPrintTree()

◆ TY_❪PPrintXMLTree❫()

TY_PRIVATE void TY_❪PPrintXMLTree❫ ( TidyDocImpl *  doc,
uint  mode,
uint  indent,
Node *  node 
)

Print the XML document tree for the given document using the given node as the root of the document.

◆ TY_❪PrintBody❫()

TY_PRIVATE void TY_❪PrintBody❫ ( TidyDocImpl *  doc)

Print just the content of the HTML body element, which is useful when want to reuse material from other documents.

– Sebastiano Vigna vigna.nosp@m.@dsi.nosp@m..unim.nosp@m.i.it