diff --git a/.gitmodules b/.gitmodules index b14b78f..fd7ecbe 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "lib/curlcpp"] path = lib/curlcpp url = https://github.com/JosephP91/curlcpp.git +[submodule "lib/tidy"] + path = lib/tidy + url = https://github.com/htacg/tidy-html5.git diff --git a/CMakeLists.txt b/CMakeLists.txt index d649a2a..12f0707 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,7 +38,7 @@ add_executable(${PROJECT_NAME} ) target_link_libraries(${PROJECT_NAME} - tidy + lib-tidy ${PUGIXML_LIBRARIES} curlcpp ) diff --git a/lib/tidy b/lib/tidy new file mode 160000 index 0000000..2e383c6 --- /dev/null +++ b/lib/tidy @@ -0,0 +1 @@ +Subproject commit 2e383c602957245ff4bc566d1760b525924234cb diff --git a/lib/tidy/CMakeLists.txt b/lib/tidy/CMakeLists.txt deleted file mode 100644 index ff2a851..0000000 --- a/lib/tidy/CMakeLists.txt +++ /dev/null @@ -1,62 +0,0 @@ -cmake_minimum_required(VERSION 2.6 FATAL_ERROR) -project(tidy C) - -option(SUPPORT_UTF16_ENCODINGS "Support Unicode documents" ON) -option(SUPPORT_ACCESSIBILITY_CHECKS "Support W3C WAI checks" ON) -option(SUPPORT_ASIAN_ENCODINGS "Support Big5 and ShiftJIS docs" ON) -option(DMALLOC "Use dmalloc for memory debugging" OFF) - -add_library(${PROJECT_NAME} - src/access.c - src/attrs.c - src/istack.c - src/parser.c - src/tags.c - src/entities.c - src/lexer.c - src/pprint.c - src/clean.c - src/localize.c - src/config.c - src/alloc.c - src/attrask.c - src/attrdict.c - src/attrget.c - src/buffio.c - src/fileio.c - src/streamio.c - src/tagask.c - src/tmbstr.c - src/utf8.c - src/tidylib.c - src/mappedio.c - src/gdoc.c -) - -include_directories( - ${CMAKE_CURRENT_SOURCE_DIR}/src - ${CMAKE_CURRENT_SOURCE_DIR}/include/tidy -) - -set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wall -O0 -fno-omit-frame-pointer -g") -set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Wall -O3 -fomit-frame-pointer") - -if (SUPPORT_UTF16_ENCODINGS) - add_definitions(-DSUPPORT_UTF16_ENCODINGS=1) -else(SUPPORT_UTF16_ENCODINGS) - add_definitions(-DSUPPORT_UTF16_ENCODINGS=0) -endif(SUPPORT_UTF16_ENCODINGS) -if (SUPPORT_ACCESSIBILITY_CHECKS) - add_definitions(-DSUPPORT_ACCESSIBILITY_CHECKS=1) -else(SUPPORT_ACCESSIBILITY_CHECKS) - add_definitions(-DSUPPORT_ACCESSIBILITY_CHECKS=0) -endif(SUPPORT_ACCESSIBILITY_CHECKS) -if (SUPPORT_ASIAN_ENCODINGS) - add_definitions(-DSUPPORT_ASIAN_ENCODINGS=1) -else(SUPPORT_ASIAN_ENCODINGS) - add_definitions(-DSUPPORT_ASIAN_ENCODINGS=0) -endif(SUPPORT_ASIAN_ENCODINGS) -if (DMALLOC) - add_definitions(-DDMALLOC) - target_link_libraries(${PROJECT_NAME} dmalloc) -endif(DMALLOC) diff --git a/lib/tidy/Makefile b/lib/tidy/Makefile deleted file mode 100644 index f45e72b..0000000 --- a/lib/tidy/Makefile +++ /dev/null @@ -1,37 +0,0 @@ -HTML2MARKDOWN=html2text -GIT=git -GITFLAGS= -DOXYGEN=doxygen -DOXYGENFLAGS= - -.PHONEY: api-docs -all: bin/tidy - -bin/tidy: - $(MAKE) -C build/gmake - $(MAKE) -C build/gmake doc - -.FORCE: -# dummy target to force other targets to always get remade - -README.md: README.html .FORCE - $(HTML2MARKDOWN) $(HTML2MARKDOWNFLAGS) $< > $@ - -src/version.h: .FORCE - $(GIT) $(GITFLAGS) log --pretty=format:'static const char TY_(release_date)[] = "https://github.com/w3c/tidy-html5/tree/%h";' -n 1 > $@ - -quickref.html: htmldoc/quickref.html .FORCE - cp $< $@ - -api-docs: - $(DOXYGEN) $(DOXYGENFLAGS) htmldoc/doxygen.cfg - -install: - sudo $(MAKE) install -C build/gmake - -version: all src/version.h README.md quickref.html - -clean: - $(MAKE) clean -C build/gmake - $(RM) test/testall.log - $(RM) -r test/tmp diff --git a/lib/tidy/README.html b/lib/tidy/README.html deleted file mode 100644 index 05a1eaa..0000000 --- a/lib/tidy/README.html +++ /dev/null @@ -1,44 +0,0 @@ - -
- -This repo is an experimental fork of the code from - tidy.sourceforge.net. -This source code in this version supports processing of HTML5 documents. -The changes for HTML5 support started from a - patch developed by Björn Höhrmann.
- -For more information, see - w3c.github.com/tidy-html5 - -
For Linux/BSD/OSX platforms, you can build and install the
-tidy
command-line tool from the source code using the
-following steps.
make -C build/gmake/
make install -C build/gmake/
Note that you will either need to run make install
as root,
-or with sudo make install
.
For Linux/BSD/OSX platforms, you can build and install the
-tidylib
shared library (for use in building other
-applications) from the source code using the following steps.
Note that you will either need to run make install
as root,
-or with sudo make install
.
- HTML Tidy
- 0.1
-
-
- |
-
-
-
-
-
-
_TidyAllocator | |
_TidyAllocatorVtbl | |
_TidyBuffer | |
_TidyInputSource | |
_TidyOutputSink | |
TidyAttr | |
TidyDoc | |
TidyNode | |
TidyOption |
- HTML Tidy
- 0.1
-
-
- |
-
-
-
-
-
-
Go to the source code of this file.
--Data Structures | |
struct | _TidyBuffer |
-Functions | |
void TIDY_CALL | tidyBufInit (TidyBuffer *buf) |
void TIDY_CALL | tidyBufInitWithAllocator (TidyBuffer *buf, TidyAllocator *allocator) |
void TIDY_CALL | tidyBufAlloc (TidyBuffer *buf, uint allocSize) |
void TIDY_CALL | tidyBufAllocWithAllocator (TidyBuffer *buf, TidyAllocator *allocator, uint allocSize) |
void TIDY_CALL | tidyBufCheckAlloc (TidyBuffer *buf, uint allocSize, uint chunkSize) |
void TIDY_CALL | tidyBufFree (TidyBuffer *buf) |
void TIDY_CALL | tidyBufClear (TidyBuffer *buf) |
void TIDY_CALL | tidyBufAttach (TidyBuffer *buf, byte *bp, uint size) |
void TIDY_CALL | tidyBufDetach (TidyBuffer *buf) |
void TIDY_CALL | tidyBufAppend (TidyBuffer *buf, void *vp, uint size) |
void TIDY_CALL | tidyBufPutByte (TidyBuffer *buf, byte bv) |
int TIDY_CALL | tidyBufPopByte (TidyBuffer *buf) |
int TIDY_CALL | tidyBufGetByte (TidyBuffer *buf) |
Bool TIDY_CALL | tidyBufEndOfInput (TidyBuffer *buf) |
void TIDY_CALL | tidyBufUngetByte (TidyBuffer *buf, byte bv) |
void TIDY_CALL | tidyInitInputBuffer (TidyInputSource *inp, TidyBuffer *buf) |
void TIDY_CALL | tidyInitOutputBuffer (TidyOutputSink *outp, TidyBuffer *buf) |
(c) 1998-2007 (W3C) MIT, ERCIM, Keio University See tidy.h for the copyright notice.
-CVS Info :
-Requires buffer to automatically grow as bytes are added. Must keep track of current read and write points.
-void TIDY_CALL tidyBufInit | -( | -TidyBuffer * | -buf | ) | -- |
Initialize data structure using the default allocator
- -void TIDY_CALL tidyBufInitWithAllocator | -( | -TidyBuffer * | -buf, | -
- | - | TidyAllocator * | -allocator | -
- | ) | -- |
Initialize data structure using the given custom allocator
- -void TIDY_CALL tidyBufAlloc | -( | -TidyBuffer * | -buf, | -
- | - | uint | -allocSize | -
- | ) | -- |
Free current buffer, allocate given amount, reset input pointer, use the default allocator
- -void TIDY_CALL tidyBufAllocWithAllocator | -( | -TidyBuffer * | -buf, | -
- | - | TidyAllocator * | -allocator, | -
- | - | uint | -allocSize | -
- | ) | -- |
Free current buffer, allocate given amount, reset input pointer, use the given custom allocator
- -void TIDY_CALL tidyBufCheckAlloc | -( | -TidyBuffer * | -buf, | -
- | - | uint | -allocSize, | -
- | - | uint | -chunkSize | -
- | ) | -- |
Expand buffer to given size. Chunk size is minimum growth. Pass 0 for default of 256 bytes.
- -void TIDY_CALL tidyBufFree | -( | -TidyBuffer * | -buf | ) | -- |
Free current contents and zero out
- -void TIDY_CALL tidyBufClear | -( | -TidyBuffer * | -buf | ) | -- |
Set buffer bytes to 0
- -void TIDY_CALL tidyBufAttach | -( | -TidyBuffer * | -buf, | -
- | - | byte * | -bp, | -
- | - | uint | -size | -
- | ) | -- |
Attach to existing buffer
- -void TIDY_CALL tidyBufDetach | -( | -TidyBuffer * | -buf | ) | -- |
Detach from buffer. Caller must free.
- -void TIDY_CALL tidyBufAppend | -( | -TidyBuffer * | -buf, | -
- | - | void * | -vp, | -
- | - | uint | -size | -
- | ) | -- |
Append bytes to buffer. Expand if necessary.
- -void TIDY_CALL tidyBufPutByte | -( | -TidyBuffer * | -buf, | -
- | - | byte | -bv | -
- | ) | -- |
Append one byte to buffer. Expand if necessary.
- -int TIDY_CALL tidyBufPopByte | -( | -TidyBuffer * | -buf | ) | -- |
Get byte from end of buffer
- -int TIDY_CALL tidyBufGetByte | -( | -TidyBuffer * | -buf | ) | -- |
Get byte from front of buffer. Increment input offset.
- -Bool TIDY_CALL tidyBufEndOfInput | -( | -TidyBuffer * | -buf | ) | -- |
At end of buffer?
- -void TIDY_CALL tidyBufUngetByte | -( | -TidyBuffer * | -buf, | -
- | - | byte | -bv | -
- | ) | -- |
Put a byte back into the buffer. Decrement input offset.
- -void TIDY_CALL tidyInitInputBuffer | -( | -TidyInputSource * | -inp, | -
- | - | TidyBuffer * | -buf | -
- | ) | -- |
Initialize a buffer input source
- -void TIDY_CALL tidyInitOutputBuffer | -( | -TidyOutputSink * | -outp, | -
- | - | TidyBuffer * | -buf | -
- | ) | -- |
Initialize a buffer output sink
- -
- HTML Tidy
- 0.1
-
-
- |
-
-
-
-
-
-
00001 #ifndef __TIDY_BUFFIO_H__ -00002 #define __TIDY_BUFFIO_H__ -00003 -00004 /** @file buffio.h - Treat buffer as an I/O stream. -00005 -00006 (c) 1998-2007 (W3C) MIT, ERCIM, Keio University -00007 See tidy.h for the copyright notice. -00008 -00009 CVS Info : -00010 -00011 $Author: arnaud02 $ -00012 $Date: 2007/01/23 11:17:45 $ -00013 $Revision: 1.9 $ -00014 -00015 Requires buffer to automatically grow as bytes are added. -00016 Must keep track of current read and write points. -00017 -00018 */ -00019 -00020 #include "platform.h" -00021 #include "tidy.h" -00022 -00023 #ifdef __cplusplus -00024 extern "C" { -00025 #endif -00026 -00027 /** TidyBuffer - A chunk of memory */ -00028 TIDY_STRUCT -00029 struct _TidyBuffer -00030 { -00031 TidyAllocator* allocator; /**< Memory allocator */ -00032 byte* bp; /**< Pointer to bytes */ -00033 uint size; /**< # bytes currently in use */ -00034 uint allocated; /**< # bytes allocated */ -00035 uint next; /**< Offset of current input position */ -00036 }; -00037 -00038 /** Initialize data structure using the default allocator */ -00039 TIDY_EXPORT void TIDY_CALL tidyBufInit( TidyBuffer* buf ); -00040 -00041 /** Initialize data structure using the given custom allocator */ -00042 TIDY_EXPORT void TIDY_CALL tidyBufInitWithAllocator( TidyBuffer* buf, TidyAllocator* allocator ); -00043 -00044 /** Free current buffer, allocate given amount, reset input pointer, -00045 use the default allocator */ -00046 TIDY_EXPORT void TIDY_CALL tidyBufAlloc( TidyBuffer* buf, uint allocSize ); -00047 -00048 /** Free current buffer, allocate given amount, reset input pointer, -00049 use the given custom allocator */ -00050 TIDY_EXPORT void TIDY_CALL tidyBufAllocWithAllocator( TidyBuffer* buf, -00051 TidyAllocator* allocator, -00052 uint allocSize ); -00053 -00054 /** Expand buffer to given size. -00055 ** Chunk size is minimum growth. Pass 0 for default of 256 bytes. -00056 */ -00057 TIDY_EXPORT void TIDY_CALL tidyBufCheckAlloc( TidyBuffer* buf, -00058 uint allocSize, uint chunkSize ); -00059 -00060 /** Free current contents and zero out */ -00061 TIDY_EXPORT void TIDY_CALL tidyBufFree( TidyBuffer* buf ); -00062 -00063 /** Set buffer bytes to 0 */ -00064 TIDY_EXPORT void TIDY_CALL tidyBufClear( TidyBuffer* buf ); -00065 -00066 /** Attach to existing buffer */ -00067 TIDY_EXPORT void TIDY_CALL tidyBufAttach( TidyBuffer* buf, byte* bp, uint size ); -00068 -00069 /** Detach from buffer. Caller must free. */ -00070 TIDY_EXPORT void TIDY_CALL tidyBufDetach( TidyBuffer* buf ); -00071 -00072 -00073 /** Append bytes to buffer. Expand if necessary. */ -00074 TIDY_EXPORT void TIDY_CALL tidyBufAppend( TidyBuffer* buf, void* vp, uint size ); -00075 -00076 /** Append one byte to buffer. Expand if necessary. */ -00077 TIDY_EXPORT void TIDY_CALL tidyBufPutByte( TidyBuffer* buf, byte bv ); -00078 -00079 /** Get byte from end of buffer */ -00080 TIDY_EXPORT int TIDY_CALL tidyBufPopByte( TidyBuffer* buf ); -00081 -00082 -00083 /** Get byte from front of buffer. Increment input offset. */ -00084 TIDY_EXPORT int TIDY_CALL tidyBufGetByte( TidyBuffer* buf ); -00085 -00086 /** At end of buffer? */ -00087 TIDY_EXPORT Bool TIDY_CALL tidyBufEndOfInput( TidyBuffer* buf ); -00088 -00089 /** Put a byte back into the buffer. Decrement input offset. */ -00090 TIDY_EXPORT void TIDY_CALL tidyBufUngetByte( TidyBuffer* buf, byte bv ); -00091 -00092 -00093 /************** -00094 TIDY -00095 **************/ -00096 -00097 /* Forward declarations -00098 */ -00099 -00100 /** Initialize a buffer input source */ -00101 TIDY_EXPORT void TIDY_CALL tidyInitInputBuffer( TidyInputSource* inp, TidyBuffer* buf ); -00102 -00103 /** Initialize a buffer output sink */ -00104 TIDY_EXPORT void TIDY_CALL tidyInitOutputBuffer( TidyOutputSink* outp, TidyBuffer* buf ); -00105 -00106 #ifdef __cplusplus -00107 } -00108 #endif -00109 #endif /* __TIDY_BUFFIO_H__ */ -00110 -00111 /* -00112 * local variables: -00113 * mode: c -00114 * indent-tabs-mode: nil -00115 * c-basic-offset: 4 -00116 * eval: (c-set-offset 'substatement-open 0) -00117 * end: -00118 */ -
- HTML Tidy
- 0.1
-
-
- |
-
-
-
-
-
-
| TidyDoc |
| _TidyAllocatorVtbl | _TidyOutputSink | ||
TidyNode | _TidyBuffer | |||||
TidyAttr | TidyOption | _TidyAllocator | _TidyInputSource | |||
- HTML Tidy
- 0.1
-
-
- |
-
-
-
-
-
-
The functions tidyAttrGet{AttributeName} are deprecated and should be replaced by tidyAttrGetById. For instance, tidyAttrGetID( TidyNode tnod ) can be replaced by tidyAttrGetById( TidyNode tnod, TidyAttr_ID ). This avoids a potential name clash with tidyAttrGetId for case-insensitive languages.
- -The functions tidyAttrIs{AttributeName} are deprecated and should be replaced by tidyAttrGetId.
- -The functions tidyNodeIs{ElementName} are deprecated and should be replaced by tidyNodeGetId.
- -
- HTML Tidy
- 0.1
-
-
- |
-
-
-
-
-
-
- HTML Tidy
- 0.1
-
-
- |
-
-
-
-
-
-
- HTML Tidy
- 0.1
-
-
- |
-
-
-
-
-
-
- HTML Tidy
- 0.1
-
-
- |
-
-
-
-
-
-
- HTML Tidy
- 0.1
-
-
- |
-
-
-
-
-
-
- HTML Tidy
- 0.1
-
-
- |
-
-
-
-
-
-
- HTML Tidy
- 0.1
-
-
- |
-
-
-
-
-
-
- HTML Tidy
- 0.1
-
-
- |
-
-
-
-
-
-
- HTML Tidy
- 0.1
-
-
- |
-
-
-
-
-
-
-Modules | |
Deprecated attribute retrieval per AttrId | |
-Functions | |
-TidyAttr TIDY_CALL | tidyAttrGetById (TidyNode tnod, TidyAttrId attId) |
Lookup an attribute from a given node
-
- HTML Tidy
- 0.1
-
-
- |
-
-
-
-
-
-
-Functions | |
-TidyAttr TIDY_CALL | tidyAttrGetHREF (TidyNode tnod) |
-TidyAttr TIDY_CALL | tidyAttrGetSRC (TidyNode tnod) |
-TidyAttr TIDY_CALL | tidyAttrGetID (TidyNode tnod) |
-TidyAttr TIDY_CALL | tidyAttrGetNAME (TidyNode tnod) |
-TidyAttr TIDY_CALL | tidyAttrGetSUMMARY (TidyNode tnod) |
-TidyAttr TIDY_CALL | tidyAttrGetALT (TidyNode tnod) |
-TidyAttr TIDY_CALL | tidyAttrGetLONGDESC (TidyNode tnod) |
-TidyAttr TIDY_CALL | tidyAttrGetUSEMAP (TidyNode tnod) |
-TidyAttr TIDY_CALL | tidyAttrGetISMAP (TidyNode tnod) |
-TidyAttr TIDY_CALL | tidyAttrGetLANGUAGE (TidyNode tnod) |
-TidyAttr TIDY_CALL | tidyAttrGetTYPE (TidyNode tnod) |
-TidyAttr TIDY_CALL | tidyAttrGetVALUE (TidyNode tnod) |
-TidyAttr TIDY_CALL | tidyAttrGetCONTENT (TidyNode tnod) |
-TidyAttr TIDY_CALL | tidyAttrGetTITLE (TidyNode tnod) |
-TidyAttr TIDY_CALL | tidyAttrGetXMLNS (TidyNode tnod) |
-TidyAttr TIDY_CALL | tidyAttrGetDATAFLD (TidyNode tnod) |
-TidyAttr TIDY_CALL | tidyAttrGetWIDTH (TidyNode tnod) |
-TidyAttr TIDY_CALL | tidyAttrGetHEIGHT (TidyNode tnod) |
-TidyAttr TIDY_CALL | tidyAttrGetFOR (TidyNode tnod) |
-TidyAttr TIDY_CALL | tidyAttrGetSELECTED (TidyNode tnod) |
-TidyAttr TIDY_CALL | tidyAttrGetCHECKED (TidyNode tnod) |
-TidyAttr TIDY_CALL | tidyAttrGetLANG (TidyNode tnod) |
-TidyAttr TIDY_CALL | tidyAttrGetTARGET (TidyNode tnod) |
-TidyAttr TIDY_CALL | tidyAttrGetHTTP_EQUIV (TidyNode tnod) |
-TidyAttr TIDY_CALL | tidyAttrGetREL (TidyNode tnod) |
-TidyAttr TIDY_CALL | tidyAttrGetOnMOUSEMOVE (TidyNode tnod) |
-TidyAttr TIDY_CALL | tidyAttrGetOnMOUSEDOWN (TidyNode tnod) |
-TidyAttr TIDY_CALL | tidyAttrGetOnMOUSEUP (TidyNode tnod) |
-TidyAttr TIDY_CALL | tidyAttrGetOnCLICK (TidyNode tnod) |
-TidyAttr TIDY_CALL | tidyAttrGetOnMOUSEOVER (TidyNode tnod) |
-TidyAttr TIDY_CALL | tidyAttrGetOnMOUSEOUT (TidyNode tnod) |
-TidyAttr TIDY_CALL | tidyAttrGetOnKEYDOWN (TidyNode tnod) |
-TidyAttr TIDY_CALL | tidyAttrGetOnKEYUP (TidyNode tnod) |
-TidyAttr TIDY_CALL | tidyAttrGetOnKEYPRESS (TidyNode tnod) |
-TidyAttr TIDY_CALL | tidyAttrGetOnFOCUS (TidyNode tnod) |
-TidyAttr TIDY_CALL | tidyAttrGetOnBLUR (TidyNode tnod) |
-TidyAttr TIDY_CALL | tidyAttrGetBGCOLOR (TidyNode tnod) |
-TidyAttr TIDY_CALL | tidyAttrGetLINK (TidyNode tnod) |
-TidyAttr TIDY_CALL | tidyAttrGetALINK (TidyNode tnod) |
-TidyAttr TIDY_CALL | tidyAttrGetVLINK (TidyNode tnod) |
-TidyAttr TIDY_CALL | tidyAttrGetTEXT (TidyNode tnod) |
-TidyAttr TIDY_CALL | tidyAttrGetSTYLE (TidyNode tnod) |
-TidyAttr TIDY_CALL | tidyAttrGetABBR (TidyNode tnod) |
-TidyAttr TIDY_CALL | tidyAttrGetCOLSPAN (TidyNode tnod) |
-TidyAttr TIDY_CALL | tidyAttrGetROWSPAN (TidyNode tnod) |
- HTML Tidy
- 0.1
-
-
- |
-
-
-
-
-
-
-Functions | |
-Bool TIDY_CALL | tidyAttrIsHREF (TidyAttr tattr) |
-Bool TIDY_CALL | tidyAttrIsSRC (TidyAttr tattr) |
-Bool TIDY_CALL | tidyAttrIsID (TidyAttr tattr) |
-Bool TIDY_CALL | tidyAttrIsNAME (TidyAttr tattr) |
-Bool TIDY_CALL | tidyAttrIsSUMMARY (TidyAttr tattr) |
-Bool TIDY_CALL | tidyAttrIsALT (TidyAttr tattr) |
-Bool TIDY_CALL | tidyAttrIsLONGDESC (TidyAttr tattr) |
-Bool TIDY_CALL | tidyAttrIsUSEMAP (TidyAttr tattr) |
-Bool TIDY_CALL | tidyAttrIsISMAP (TidyAttr tattr) |
-Bool TIDY_CALL | tidyAttrIsLANGUAGE (TidyAttr tattr) |
-Bool TIDY_CALL | tidyAttrIsTYPE (TidyAttr tattr) |
-Bool TIDY_CALL | tidyAttrIsVALUE (TidyAttr tattr) |
-Bool TIDY_CALL | tidyAttrIsCONTENT (TidyAttr tattr) |
-Bool TIDY_CALL | tidyAttrIsTITLE (TidyAttr tattr) |
-Bool TIDY_CALL | tidyAttrIsXMLNS (TidyAttr tattr) |
-Bool TIDY_CALL | tidyAttrIsDATAFLD (TidyAttr tattr) |
-Bool TIDY_CALL | tidyAttrIsWIDTH (TidyAttr tattr) |
-Bool TIDY_CALL | tidyAttrIsHEIGHT (TidyAttr tattr) |
-Bool TIDY_CALL | tidyAttrIsFOR (TidyAttr tattr) |
-Bool TIDY_CALL | tidyAttrIsSELECTED (TidyAttr tattr) |
-Bool TIDY_CALL | tidyAttrIsCHECKED (TidyAttr tattr) |
-Bool TIDY_CALL | tidyAttrIsLANG (TidyAttr tattr) |
-Bool TIDY_CALL | tidyAttrIsTARGET (TidyAttr tattr) |
-Bool TIDY_CALL | tidyAttrIsHTTP_EQUIV (TidyAttr tattr) |
-Bool TIDY_CALL | tidyAttrIsREL (TidyAttr tattr) |
-Bool TIDY_CALL | tidyAttrIsOnMOUSEMOVE (TidyAttr tattr) |
-Bool TIDY_CALL | tidyAttrIsOnMOUSEDOWN (TidyAttr tattr) |
-Bool TIDY_CALL | tidyAttrIsOnMOUSEUP (TidyAttr tattr) |
-Bool TIDY_CALL | tidyAttrIsOnCLICK (TidyAttr tattr) |
-Bool TIDY_CALL | tidyAttrIsOnMOUSEOVER (TidyAttr tattr) |
-Bool TIDY_CALL | tidyAttrIsOnMOUSEOUT (TidyAttr tattr) |
-Bool TIDY_CALL | tidyAttrIsOnKEYDOWN (TidyAttr tattr) |
-Bool TIDY_CALL | tidyAttrIsOnKEYUP (TidyAttr tattr) |
-Bool TIDY_CALL | tidyAttrIsOnKEYPRESS (TidyAttr tattr) |
-Bool TIDY_CALL | tidyAttrIsOnFOCUS (TidyAttr tattr) |
-Bool TIDY_CALL | tidyAttrIsOnBLUR (TidyAttr tattr) |
-Bool TIDY_CALL | tidyAttrIsBGCOLOR (TidyAttr tattr) |
-Bool TIDY_CALL | tidyAttrIsLINK (TidyAttr tattr) |
-Bool TIDY_CALL | tidyAttrIsALINK (TidyAttr tattr) |
-Bool TIDY_CALL | tidyAttrIsVLINK (TidyAttr tattr) |
-Bool TIDY_CALL | tidyAttrIsTEXT (TidyAttr tattr) |
-Bool TIDY_CALL | tidyAttrIsSTYLE (TidyAttr tattr) |
-Bool TIDY_CALL | tidyAttrIsABBR (TidyAttr tattr) |
-Bool TIDY_CALL | tidyAttrIsCOLSPAN (TidyAttr tattr) |
-Bool TIDY_CALL | tidyAttrIsROWSPAN (TidyAttr tattr) |
- HTML Tidy
- 0.1
-
-
- |
-
-
-
-
-
-
-Modules | |
Deprecated attribute interrogation per AttrId | |
-Functions | |
-TidyAttrId TIDY_CALL | tidyAttrGetId (TidyAttr tattr) |
-Bool TIDY_CALL | tidyAttrIsEvent (TidyAttr tattr) |
-Bool TIDY_CALL | tidyAttrIsProp (TidyAttr tattr) |
Get information about any given attribute.
-
- HTML Tidy
- 0.1
-
-
- |
-
-
-
-
-
-
-Functions | |
-TidyDoc TIDY_CALL | tidyCreate (void) |
-TidyDoc TIDY_CALL | tidyCreateWithAllocator (TidyAllocator *allocator) |
-void TIDY_CALL | tidyRelease (TidyDoc tdoc) |
void TIDY_CALL | tidySetAppData (TidyDoc tdoc, void *appData) |
void *TIDY_CALL | tidyGetAppData (TidyDoc tdoc) |
ctmbstr TIDY_CALL | tidyReleaseDate (void) |
int TIDY_CALL | tidyStatus (TidyDoc tdoc) |
int TIDY_CALL | tidyDetectedHtmlVersion (TidyDoc tdoc) |
Bool TIDY_CALL | tidyDetectedXhtml (TidyDoc tdoc) |
Bool TIDY_CALL | tidyDetectedGenericXml (TidyDoc tdoc) |
uint TIDY_CALL | tidyErrorCount (TidyDoc tdoc) |
uint TIDY_CALL | tidyWarningCount (TidyDoc tdoc) |
uint TIDY_CALL | tidyAccessWarningCount (TidyDoc tdoc) |
uint TIDY_CALL | tidyConfigErrorCount (TidyDoc tdoc) |
int TIDY_CALL | tidyLoadConfig (TidyDoc tdoc, ctmbstr configFile) |
int TIDY_CALL | tidyLoadConfigEnc (TidyDoc tdoc, ctmbstr configFile, ctmbstr charenc) |
-Bool TIDY_CALL | tidyFileExists (TidyDoc tdoc, ctmbstr filename) |
int TIDY_CALL | tidySetCharEncoding (TidyDoc tdoc, ctmbstr encnam) |
int TIDY_CALL | tidySetInCharEncoding (TidyDoc tdoc, ctmbstr encnam) |
int TIDY_CALL | tidySetOutCharEncoding (TidyDoc tdoc, ctmbstr encnam) |
int TIDY_CALL | tidyOptSaveFile (TidyDoc tdoc, ctmbstr cfgfil) |
int TIDY_CALL | tidyOptSaveSink (TidyDoc tdoc, TidyOutputSink *sink) |
void TIDY_CALL | tidyErrorSummary (TidyDoc tdoc) |
void TIDY_CALL | tidyGeneralInfo (TidyDoc tdoc) |
Tidy public interface
-Several functions return an integer document status:
-- 0 -> SUCCESS - >0 -> 1 == TIDY WARNING, 2 == TIDY ERROR - <0 -> SEVERE ERROR -
The following is a short example program.
--include <tidy.h>
-
-include <buffio.h>
-
-include <stdio.h>
-
-include <errno.h>
-
int main(int argc, char **argv ) -{ - const char* input = "<title>Foo</title><p>Foo!"; - TidyBuffer output; - TidyBuffer errbuf; - int rc = -1; - Bool ok;
TidyDoc tdoc = tidyCreate(); // Initialize "document" - tidyBufInit( &output ); - tidyBufInit( &errbuf ); - printf( "Tidying:\t\%s\\n", input );
ok = tidyOptSetBool( tdoc, TidyXhtmlOut, yes ); // Convert to XHTML - if ( ok ) - rc = tidySetErrorBuffer( tdoc, &errbuf ); // Capture diagnostics - if ( rc >= 0 ) - rc = tidyParseString( tdoc, input ); // Parse the input - if ( rc >= 0 ) - rc = tidyCleanAndRepair( tdoc ); // Tidy it up! - if ( rc >= 0 ) - rc = tidyRunDiagnostics( tdoc ); // Kvetch - if ( rc > 1 ) // If error, force output. - rc = ( tidyOptSetBool(tdoc, TidyForceOutput, yes) ? rc : -1 ); - if ( rc >= 0 ) - rc = tidySaveBuffer( tdoc, &output ); // Pretty Print
if ( rc >= 0 ) - { - if ( rc > 0 ) - printf( "\\nDiagnostics:\\n\\n\%s", errbuf.bp ); - printf( "\\nAnd here is the result:\\n\\n\%s", output.bp ); - } - else - printf( "A severe error (\%d) occurred.\\n", rc );
tidyBufFree( &output ); - tidyBufFree( &errbuf ); - tidyRelease( tdoc ); - return rc; -} -
void TIDY_CALL tidySetAppData | -( | -TidyDoc | -tdoc, | -
- | - | void * | -appData | -
- | ) | -- |
Let application store a chunk of data w/ each Tidy instance. Useful for callbacks.
- -void* TIDY_CALL tidyGetAppData | -( | -TidyDoc | -tdoc | ) | -- |
Get application data set previously
- -ctmbstr TIDY_CALL tidyReleaseDate | -( | -void | -) | -- |
Get release date (version) for current library
- -int TIDY_CALL tidyStatus | -( | -TidyDoc | -tdoc | ) | -- |
Get status of current document.
- -int TIDY_CALL tidyDetectedHtmlVersion | -( | -TidyDoc | -tdoc | ) | -- |
Detected HTML version: 0, 2, 3 or 4
- -Bool TIDY_CALL tidyDetectedXhtml | -( | -TidyDoc | -tdoc | ) | -- |
Input is XHTML?
- -Bool TIDY_CALL tidyDetectedGenericXml | -( | -TidyDoc | -tdoc | ) | -- |
Input is generic XML (not HTML or XHTML)?
- -uint TIDY_CALL tidyErrorCount | -( | -TidyDoc | -tdoc | ) | -- |
Number of Tidy errors encountered. If > 0, output is suppressed unless TidyForceOutput is set.
- -uint TIDY_CALL tidyWarningCount | -( | -TidyDoc | -tdoc | ) | -- |
Number of Tidy warnings encountered.
- -uint TIDY_CALL tidyAccessWarningCount | -( | -TidyDoc | -tdoc | ) | -- |
Number of Tidy accessibility warnings encountered.
- -uint TIDY_CALL tidyConfigErrorCount | -( | -TidyDoc | -tdoc | ) | -- |
Number of Tidy configuration errors encountered.
- -int TIDY_CALL tidyLoadConfig | -( | -TidyDoc | -tdoc, | -
- | - | ctmbstr | -configFile | -
- | ) | -- |
Load an ASCII Tidy configuration file
- -int TIDY_CALL tidyLoadConfigEnc | -( | -TidyDoc | -tdoc, | -
- | - | ctmbstr | -configFile, | -
- | - | ctmbstr | -charenc | -
- | ) | -- |
Load a Tidy configuration file with the specified character encoding
- -int TIDY_CALL tidySetCharEncoding | -( | -TidyDoc | -tdoc, | -
- | - | ctmbstr | -encnam | -
- | ) | -- |
Set the input/output character encoding for parsing markup. Values include: ascii, latin1, raw, utf8, iso2022, mac, win1252, utf16le, utf16be, utf16, big5 and shiftjis. Case in-sensitive.
- -int TIDY_CALL tidySetInCharEncoding | -( | -TidyDoc | -tdoc, | -
- | - | ctmbstr | -encnam | -
- | ) | -- |
Set the input encoding for parsing markup. As for tidySetCharEncoding but only affects the input encoding
- -int TIDY_CALL tidySetOutCharEncoding | -( | -TidyDoc | -tdoc, | -
- | - | ctmbstr | -encnam | -
- | ) | -- |
Set the output encoding.
- -int TIDY_CALL tidyOptSaveFile | -( | -TidyDoc | -tdoc, | -
- | - | ctmbstr | -cfgfil | -
- | ) | -- |
Save current settings to named file. Only non-default values are written.
- -int TIDY_CALL tidyOptSaveSink | -( | -TidyDoc | -tdoc, | -
- | - | TidyOutputSink * | -sink | -
- | ) | -- |
Save current settings to given output sink. Only non-default values are written.
- -void TIDY_CALL tidyErrorSummary | -( | -TidyDoc | -tdoc | ) | -- |
Write more complete information about errors to current error sink.
- -void TIDY_CALL tidyGeneralInfo | -( | -TidyDoc | -tdoc | ) | -- |
Write more general information about markup to current error sink.
- -
- HTML Tidy
- 0.1
-
-
- |
-
-
-
-
-
-
-Functions | |
int TIDY_CALL | tidyCleanAndRepair (TidyDoc tdoc) |
int TIDY_CALL | tidyRunDiagnostics (TidyDoc tdoc) |
int TIDY_CALL tidyCleanAndRepair | -( | -TidyDoc | -tdoc | ) | -- |
Execute configured cleanup and repair operations on parsed markup
- -int TIDY_CALL tidyRunDiagnostics | -( | -TidyDoc | -tdoc | ) | -- |
Run configured diagnostics on parsed and repaired markup. Must call tidyCleanAndRepair() first.
- -
- HTML Tidy
- 0.1
-
-
- |
-
-
-
-
-
-
-Typedefs | |
typedef Bool(TIDY_CALL * | TidyOptCallback )(ctmbstr option, ctmbstr value) |
-Functions | |
-Bool TIDY_CALL | tidySetOptionCallback (TidyDoc tdoc, TidyOptCallback pOptCallback) |
TidyOptionId TIDY_CALL | tidyOptGetIdForName (ctmbstr optnam) |
TidyIterator TIDY_CALL | tidyGetOptionList (TidyDoc tdoc) |
TidyOption TIDY_CALL | tidyGetNextOption (TidyDoc tdoc, TidyIterator *pos) |
TidyOption TIDY_CALL | tidyGetOption (TidyDoc tdoc, TidyOptionId optId) |
TidyOption TIDY_CALL | tidyGetOptionByName (TidyDoc tdoc, ctmbstr optnam) |
TidyOptionId TIDY_CALL | tidyOptGetId (TidyOption opt) |
ctmbstr TIDY_CALL | tidyOptGetName (TidyOption opt) |
TidyOptionType TIDY_CALL | tidyOptGetType (TidyOption opt) |
Bool TIDY_CALL | tidyOptIsReadOnly (TidyOption opt) |
TidyConfigCategory TIDY_CALL | tidyOptGetCategory (TidyOption opt) |
ctmbstr TIDY_CALL | tidyOptGetDefault (TidyOption opt) |
ulong TIDY_CALL | tidyOptGetDefaultInt (TidyOption opt) |
Bool TIDY_CALL | tidyOptGetDefaultBool (TidyOption opt) |
TidyIterator TIDY_CALL | tidyOptGetPickList (TidyOption opt) |
ctmbstr TIDY_CALL | tidyOptGetNextPick (TidyOption opt, TidyIterator *pos) |
ctmbstr TIDY_CALL | tidyOptGetValue (TidyDoc tdoc, TidyOptionId optId) |
Bool TIDY_CALL | tidyOptSetValue (TidyDoc tdoc, TidyOptionId optId, ctmbstr val) |
Bool TIDY_CALL | tidyOptParseValue (TidyDoc tdoc, ctmbstr optnam, ctmbstr val) |
ulong TIDY_CALL | tidyOptGetInt (TidyDoc tdoc, TidyOptionId optId) |
Bool TIDY_CALL | tidyOptSetInt (TidyDoc tdoc, TidyOptionId optId, ulong val) |
Bool TIDY_CALL | tidyOptGetBool (TidyDoc tdoc, TidyOptionId optId) |
Bool TIDY_CALL | tidyOptSetBool (TidyDoc tdoc, TidyOptionId optId, Bool val) |
Bool TIDY_CALL | tidyOptResetToDefault (TidyDoc tdoc, TidyOptionId opt) |
Bool TIDY_CALL | tidyOptResetAllToDefault (TidyDoc tdoc) |
Bool TIDY_CALL | tidyOptSnapshot (TidyDoc tdoc) |
Bool TIDY_CALL | tidyOptResetToSnapshot (TidyDoc tdoc) |
Bool TIDY_CALL | tidyOptDiffThanDefault (TidyDoc tdoc) |
Bool TIDY_CALL | tidyOptDiffThanSnapshot (TidyDoc tdoc) |
Bool TIDY_CALL | tidyOptCopyConfig (TidyDoc tdocTo, TidyDoc tdocFrom) |
ctmbstr TIDY_CALL | tidyOptGetEncName (TidyDoc tdoc, TidyOptionId optId) |
ctmbstr TIDY_CALL | tidyOptGetCurrPick (TidyDoc tdoc, TidyOptionId optId) |
TidyIterator TIDY_CALL | tidyOptGetDeclTagList (TidyDoc tdoc) |
ctmbstr TIDY_CALL | tidyOptGetNextDeclTag (TidyDoc tdoc, TidyOptionId optId, TidyIterator *iter) |
ctmbstr TIDY_CALL | tidyOptGetDoc (TidyDoc tdoc, TidyOption opt) |
TidyIterator TIDY_CALL | tidyOptGetDocLinksList (TidyDoc tdoc, TidyOption opt) |
TidyOption TIDY_CALL | tidyOptGetNextDocLinks (TidyDoc tdoc, TidyIterator *pos) |
Functions for getting and setting Tidy configuration options.
-typedef Bool(TIDY_CALL * TidyOptCallback)(ctmbstr option, ctmbstr value) | -
Applications using TidyLib may want to augment command-line and configuration file options. Setting this callback allows an application developer to examine command-line and configuration file options after TidyLib has examined them and failed to recognize them.
- -TidyOptionId TIDY_CALL tidyOptGetIdForName | -( | -ctmbstr | -optnam | ) | -- |
Get option ID by name
- -TidyIterator TIDY_CALL tidyGetOptionList | -( | -TidyDoc | -tdoc | ) | -- |
Get iterator for list of option Example:
--TidyIterator itOpt = tidyGetOptionList( tdoc ); -while ( itOpt ) -{ - TidyOption opt = tidyGetNextOption( tdoc, &itOpt ); - .. get/set option values .. -} --
TidyOption TIDY_CALL tidyGetNextOption | -( | -TidyDoc | -tdoc, | -
- | - | TidyIterator * | -pos | -
- | ) | -- |
Get next Option
- -TidyOption TIDY_CALL tidyGetOption | -( | -TidyDoc | -tdoc, | -
- | - | TidyOptionId | -optId | -
- | ) | -- |
Lookup option by ID
- -TidyOption TIDY_CALL tidyGetOptionByName | -( | -TidyDoc | -tdoc, | -
- | - | ctmbstr | -optnam | -
- | ) | -- |
Lookup option by name
- -TidyOptionId TIDY_CALL tidyOptGetId | -( | -TidyOption | -opt | ) | -- |
Get ID of given Option
- -ctmbstr TIDY_CALL tidyOptGetName | -( | -TidyOption | -opt | ) | -- |
Get name of given Option
- -TidyOptionType TIDY_CALL tidyOptGetType | -( | -TidyOption | -opt | ) | -- |
Get datatype of given Option
- -Bool TIDY_CALL tidyOptIsReadOnly | -( | -TidyOption | -opt | ) | -- |
Is Option read-only?
- -TidyConfigCategory TIDY_CALL tidyOptGetCategory | -( | -TidyOption | -opt | ) | -- |
Get category of given Option
- -ctmbstr TIDY_CALL tidyOptGetDefault | -( | -TidyOption | -opt | ) | -- |
Get default value of given Option as a string
- -ulong TIDY_CALL tidyOptGetDefaultInt | -( | -TidyOption | -opt | ) | -- |
Get default value of given Option as an unsigned integer
- -Bool TIDY_CALL tidyOptGetDefaultBool | -( | -TidyOption | -opt | ) | -- |
Get default value of given Option as a Boolean value
- -TidyIterator TIDY_CALL tidyOptGetPickList | -( | -TidyOption | -opt | ) | -- |
Iterate over Option "pick list"
- -ctmbstr TIDY_CALL tidyOptGetNextPick | -( | -TidyOption | -opt, | -
- | - | TidyIterator * | -pos | -
- | ) | -- |
Get next string value of Option "pick list"
- -ctmbstr TIDY_CALL tidyOptGetValue | -( | -TidyDoc | -tdoc, | -
- | - | TidyOptionId | -optId | -
- | ) | -- |
Get current Option value as a string
- -Bool TIDY_CALL tidyOptSetValue | -( | -TidyDoc | -tdoc, | -
- | - | TidyOptionId | -optId, | -
- | - | ctmbstr | -val | -
- | ) | -- |
Set Option value as a string
- -Bool TIDY_CALL tidyOptParseValue | -( | -TidyDoc | -tdoc, | -
- | - | ctmbstr | -optnam, | -
- | - | ctmbstr | -val | -
- | ) | -- |
Set named Option value as a string. Good if not sure of type.
- -ulong TIDY_CALL tidyOptGetInt | -( | -TidyDoc | -tdoc, | -
- | - | TidyOptionId | -optId | -
- | ) | -- |
Get current Option value as an integer
- -Bool TIDY_CALL tidyOptSetInt | -( | -TidyDoc | -tdoc, | -
- | - | TidyOptionId | -optId, | -
- | - | ulong | -val | -
- | ) | -- |
Set Option value as an integer
- -Bool TIDY_CALL tidyOptGetBool | -( | -TidyDoc | -tdoc, | -
- | - | TidyOptionId | -optId | -
- | ) | -- |
Get current Option value as a Boolean flag
- -Bool TIDY_CALL tidyOptSetBool | -( | -TidyDoc | -tdoc, | -
- | - | TidyOptionId | -optId, | -
- | - | Bool | -val | -
- | ) | -- |
Set Option value as a Boolean flag
- -Bool TIDY_CALL tidyOptResetToDefault | -( | -TidyDoc | -tdoc, | -
- | - | TidyOptionId | -opt | -
- | ) | -- |
Reset option to default value by ID
- -Bool TIDY_CALL tidyOptResetAllToDefault | -( | -TidyDoc | -tdoc | ) | -- |
Reset all options to their default values
- -Bool TIDY_CALL tidyOptSnapshot | -( | -TidyDoc | -tdoc | ) | -- |
Take a snapshot of current config settings
- -Bool TIDY_CALL tidyOptResetToSnapshot | -( | -TidyDoc | -tdoc | ) | -- |
Reset config settings to snapshot (after document processing)
- -Bool TIDY_CALL tidyOptDiffThanDefault | -( | -TidyDoc | -tdoc | ) | -- |
Any settings different than default?
- -Bool TIDY_CALL tidyOptDiffThanSnapshot | -( | -TidyDoc | -tdoc | ) | -- |
Any settings different than snapshot?
- -Bool TIDY_CALL tidyOptCopyConfig | -( | -TidyDoc | -tdocTo, | -
- | - | TidyDoc | -tdocFrom | -
- | ) | -- |
Copy current configuration settings from one document to another
- -ctmbstr TIDY_CALL tidyOptGetEncName | -( | -TidyDoc | -tdoc, | -
- | - | TidyOptionId | -optId | -
- | ) | -- |
Get character encoding name. Used with TidyCharEncoding, TidyOutCharEncoding, TidyInCharEncoding
- -ctmbstr TIDY_CALL tidyOptGetCurrPick | -( | -TidyDoc | -tdoc, | -
- | - | TidyOptionId | -optId | -
- | ) | -- |
Get current pick list value for option by ID. Useful for enum types.
- -TidyIterator TIDY_CALL tidyOptGetDeclTagList | -( | -TidyDoc | -tdoc | ) | -- |
Iterate over user declared tags
- -ctmbstr TIDY_CALL tidyOptGetNextDeclTag | -( | -TidyDoc | -tdoc, | -
- | - | TidyOptionId | -optId, | -
- | - | TidyIterator * | -iter | -
- | ) | -- |
Get next declared tag of specified type: TidyInlineTags, TidyBlockTags, TidyEmptyTags, TidyPreTags
- -ctmbstr TIDY_CALL tidyOptGetDoc | -( | -TidyDoc | -tdoc, | -
- | - | TidyOption | -opt | -
- | ) | -- |
Get option description
- -TidyIterator TIDY_CALL tidyOptGetDocLinksList | -( | -TidyDoc | -tdoc, | -
- | - | TidyOption | -opt | -
- | ) | -- |
Iterate over a list of related options
- -TidyOption TIDY_CALL tidyOptGetNextDocLinks | -( | -TidyDoc | -tdoc, | -
- | - | TidyIterator * | -pos | -
- | ) | -- |
Get next related option
- -
- HTML Tidy
- 0.1
-
-
- |
-
-
-
-
-
-
-Data Structures | |
struct | _TidyInputSource |
struct | _TidyOutputSink |
-Defines | |
#define | EndOfStream (~0u) |
-Typedefs | |
typedef int(TIDY_CALL * | TidyGetByteFunc )(void *sourceData) |
typedef void(TIDY_CALL * | TidyUngetByteFunc )(void *sourceData, byte bt) |
typedef Bool(TIDY_CALL * | TidyEOFFunc )(void *sourceData) |
typedef TIDY_STRUCT struct -_TidyInputSource | TidyInputSource |
typedef void(TIDY_CALL * | TidyPutByteFunc )(void *sinkData, byte bt) |
typedef TIDY_STRUCT struct -_TidyOutputSink | TidyOutputSink |
typedef Bool(TIDY_CALL * | TidyReportFilter )(TidyDoc tdoc, TidyReportLevel lvl, uint line, uint col, ctmbstr mssg) |
-Functions | |
Bool TIDY_CALL | tidyInitSource (TidyInputSource *source, void *srcData, TidyGetByteFunc gbFunc, TidyUngetByteFunc ugbFunc, TidyEOFFunc endFunc) |
uint TIDY_CALL | tidyGetByte (TidyInputSource *source) |
void TIDY_CALL | tidyUngetByte (TidyInputSource *source, uint byteValue) |
Bool TIDY_CALL | tidyIsEOF (TidyInputSource *source) |
Bool TIDY_CALL | tidyInitSink (TidyOutputSink *sink, void *snkData, TidyPutByteFunc pbFunc) |
void TIDY_CALL | tidyPutByte (TidyOutputSink *sink, uint byteValue) |
Bool TIDY_CALL | tidySetReportFilter (TidyDoc tdoc, TidyReportFilter filtCallback) |
FILE *TIDY_CALL | tidySetErrorFile (TidyDoc tdoc, ctmbstr errfilnam) |
int TIDY_CALL | tidySetErrorBuffer (TidyDoc tdoc, TidyBuffer *errbuf) |
int TIDY_CALL | tidySetErrorSink (TidyDoc tdoc, TidyOutputSink *sink) |
By default, Tidy will define, create and use instances of input and output handlers for standard C buffered I/O (i.e. FILE* stdin, FILE* stdout and FILE* stderr for content input, content output and diagnostic output, respectively. A FILE* cfgFile input handler will be used for config files. Command line options will just be set directly.
-#define EndOfStream (~0u) | -
End of input "character"
- -typedef int(TIDY_CALL * TidyGetByteFunc)(void *sourceData) | -
Input Callback: get next byte of input
- -typedef void(TIDY_CALL * TidyUngetByteFunc)(void *sourceData, byte bt) | -
Input Callback: unget a byte of input
- -typedef Bool(TIDY_CALL * TidyEOFFunc)(void *sourceData) | -
Input Callback: is end of input?
- -typedef TIDY_STRUCT struct _TidyInputSource TidyInputSource | -
TidyInputSource - Delivers raw bytes of input
- -typedef void(TIDY_CALL * TidyPutByteFunc)(void *sinkData, byte bt) | -
Output callback: send a byte to output
- -typedef TIDY_STRUCT struct _TidyOutputSink TidyOutputSink | -
TidyOutputSink - accepts raw bytes of output
- -typedef Bool(TIDY_CALL * TidyReportFilter)(TidyDoc tdoc, TidyReportLevel lvl, uint line, uint col, ctmbstr mssg) | -
Callback to filter messages by diagnostic level: info, warning, etc. Just set diagnostic output handler to redirect all diagnostics output. Return true to proceed with output, false to cancel.
- -Bool TIDY_CALL tidyInitSource | -( | -TidyInputSource * | -source, | -
- | - | void * | -srcData, | -
- | - | TidyGetByteFunc | -gbFunc, | -
- | - | TidyUngetByteFunc | -ugbFunc, | -
- | - | TidyEOFFunc | -endFunc | -
- | ) | -- |
Facilitates user defined source by providing an entry point to marshal pointers-to-functions. Needed by .NET and possibly other language bindings.
- -uint TIDY_CALL tidyGetByte | -( | -TidyInputSource * | -source | ) | -- |
Helper: get next byte from input source
- -void TIDY_CALL tidyUngetByte | -( | -TidyInputSource * | -source, | -
- | - | uint | -byteValue | -
- | ) | -- |
Helper: unget byte back to input source
- -Bool TIDY_CALL tidyIsEOF | -( | -TidyInputSource * | -source | ) | -- |
Helper: check if input source at end
- -Bool TIDY_CALL tidyInitSink | -( | -TidyOutputSink * | -sink, | -
- | - | void * | -snkData, | -
- | - | TidyPutByteFunc | -pbFunc | -
- | ) | -- |
Facilitates user defined sinks by providing an entry point to marshal pointers-to-functions. Needed by .NET and possibly other language bindings.
- -void TIDY_CALL tidyPutByte | -( | -TidyOutputSink * | -sink, | -
- | - | uint | -byteValue | -
- | ) | -- |
Helper: send a byte to output
- -Bool TIDY_CALL tidySetReportFilter | -( | -TidyDoc | -tdoc, | -
- | - | TidyReportFilter | -filtCallback | -
- | ) | -- |
Give Tidy a filter callback to use
- -FILE* TIDY_CALL tidySetErrorFile | -( | -TidyDoc | -tdoc, | -
- | - | ctmbstr | -errfilnam | -
- | ) | -- |
Set error sink to named file
- -int TIDY_CALL tidySetErrorBuffer | -( | -TidyDoc | -tdoc, | -
- | - | TidyBuffer * | -errbuf | -
- | ) | -- |
Set error sink to given buffer
- -int TIDY_CALL tidySetErrorSink | -( | -TidyDoc | -tdoc, | -
- | - | TidyOutputSink * | -sink | -
- | ) | -- |
Set error sink to given generic sink
- -
- HTML Tidy
- 0.1
-
-
- |
-
-
-
-
-
-
-Data Structures | |
struct | _TidyAllocatorVtbl |
struct | _TidyAllocator |
-Typedefs | |
typedef struct _TidyAllocatorVtbl | TidyAllocatorVtbl |
typedef struct _TidyAllocator | TidyAllocator |
typedef void *(TIDY_CALL * | TidyMalloc )(size_t len) |
typedef void *(TIDY_CALL * | TidyRealloc )(void *buf, size_t len) |
typedef void(TIDY_CALL * | TidyFree )(void *buf) |
typedef void(TIDY_CALL * | TidyPanic )(ctmbstr mssg) |
-Functions | |
Bool TIDY_CALL | tidySetMallocCall (TidyMalloc fmalloc) |
Bool TIDY_CALL | tidySetReallocCall (TidyRealloc frealloc) |
Bool TIDY_CALL | tidySetFreeCall (TidyFree ffree) |
Bool TIDY_CALL | tidySetPanicCall (TidyPanic fpanic) |
Tidy uses a user provided allocator for all memory allocations. If this allocator is not provided, then a default allocator is used which simply wraps standard C malloc/free calls. These wrappers call the panic function upon any failure. The default panic function prints an out of memory message to stderr, and calls exit(2).
-For applications in which it is unacceptable to abort in the case of memory allocation, then the panic function can be replaced with one which longjmps() out of the tidy code. For this to clean up completely, you should be careful not to use any tidy methods that open files as these will not be closed before panic() is called.
-TODO: associate file handles with tidyDoc and ensure that tidyDocRelease() can close them all.
-Calling the withAllocator() family ( tidyCreateWithAllocator, tidyBufInitWithAllocator, tidyBufAllocWithAllocator) allow settings custom allocators).
-All parts of the document use the same allocator. Calls that require a user provided buffer can optionally use a different allocator.
-For reference in designing a plug-in allocator, most allocations made by tidy are less than 100 bytes, corresponding to attribute names/values, etc.
-There is also an additional class of much larger allocations which are where most of the data from the lexer is stored. (It is not currently possible to use a separate allocator for the lexer, this would be a useful extension).
-In general, approximately 1/3rd of the memory used by tidy is freed during the parse, so if memory usage is an issue then an allocator that can reuse this memory is a good idea.
-typedef struct _TidyAllocatorVtbl TidyAllocatorVtbl | -
The allocators function table
- -typedef struct _TidyAllocator TidyAllocator | -
The allocator
- -typedef void*(TIDY_CALL * TidyMalloc)(size_t len) | -
Callback for "malloc" replacement
- -typedef void*(TIDY_CALL * TidyRealloc)(void *buf, size_t len) | -
Callback for "realloc" replacement
- -typedef void(TIDY_CALL * TidyFree)(void *buf) | -
Callback for "free" replacement
- -typedef void(TIDY_CALL * TidyPanic)(ctmbstr mssg) | -
Callback for "out of memory" panic state
- -Bool TIDY_CALL tidySetMallocCall | -( | -TidyMalloc | -fmalloc | ) | -- |
Give Tidy a malloc() replacement
- -Bool TIDY_CALL tidySetReallocCall | -( | -TidyRealloc | -frealloc | ) | -- |
Give Tidy a realloc() replacement
- -Bool TIDY_CALL tidySetFreeCall | -( | -TidyFree | -ffree | ) | -- |
Give Tidy a free() replacement
- -Bool TIDY_CALL tidySetPanicCall | -( | -TidyPanic | -fpanic | ) | -- |
Give Tidy an "out of memory" handler
- -
- HTML Tidy
- 0.1
-
-
- |
-
-
-
-
-
-
-Modules | |
Deprecated node interrogation per TagId | |
-Functions | |
-TidyNodeType TIDY_CALL | tidyNodeGetType (TidyNode tnod) |
-ctmbstr TIDY_CALL | tidyNodeGetName (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsText (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsProp (TidyDoc tdoc, TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsHeader (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeHasText (TidyDoc tdoc, TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeGetText (TidyDoc tdoc, TidyNode tnod, TidyBuffer *buf) |
-Bool TIDY_CALL | tidyNodeGetValue (TidyDoc tdoc, TidyNode tnod, TidyBuffer *buf) |
-TidyTagId TIDY_CALL | tidyNodeGetId (TidyNode tnod) |
-uint TIDY_CALL | tidyNodeLine (TidyNode tnod) |
-uint TIDY_CALL | tidyNodeColumn (TidyNode tnod) |
Get information about any givent node.
-
- HTML Tidy
- 0.1
-
-
- |
-
-
-
-
-
-
-Functions | |
-Bool TIDY_CALL | tidyNodeIsHTML (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsHEAD (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsTITLE (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsBASE (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsMETA (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsBODY (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsFRAMESET (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsFRAME (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsIFRAME (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsNOFRAMES (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsHR (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsH1 (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsH2 (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsPRE (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsLISTING (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsP (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsUL (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsOL (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsDL (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsDIR (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsLI (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsDT (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsDD (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsTABLE (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsCAPTION (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsTD (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsTH (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsTR (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsCOL (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsCOLGROUP (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsBR (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsA (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsLINK (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsB (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsI (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsSTRONG (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsEM (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsBIG (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsSMALL (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsPARAM (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsOPTION (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsOPTGROUP (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsIMG (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsMAP (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsAREA (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsNOBR (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsWBR (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsFONT (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsLAYER (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsSPACER (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsCENTER (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsSTYLE (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsSCRIPT (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsNOSCRIPT (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsFORM (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsTEXTAREA (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsBLOCKQUOTE (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsAPPLET (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsOBJECT (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsDIV (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsSPAN (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsINPUT (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsQ (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsLABEL (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsH3 (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsH4 (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsH5 (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsH6 (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsADDRESS (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsXMP (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsSELECT (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsBLINK (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsMARQUEE (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsEMBED (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsBASEFONT (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsISINDEX (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsS (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsSTRIKE (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsU (TidyNode tnod) |
-Bool TIDY_CALL | tidyNodeIsMENU (TidyNode tnod) |
- HTML Tidy
- 0.1
-
-
- |
-
-
-
-
-
-
-Data Structures | |
struct | TidyDoc |
struct | TidyOption |
struct | TidyNode |
struct | TidyAttr |
-Functions | |
- | opaque_type (TidyDoc) |
- | opaque_type (TidyOption) |
- | opaque_type (TidyNode) |
- | opaque_type (TidyAttr) |
Cast to implementation types within lib. Reduces inter-dependencies/conflicts w/ application code.
-
- HTML Tidy
- 0.1
-
-
- |
-
-
-
-
-
-
-Functions | |
int TIDY_CALL | tidyParseFile (TidyDoc tdoc, ctmbstr filename) |
int TIDY_CALL | tidyParseStdin (TidyDoc tdoc) |
int TIDY_CALL | tidyParseString (TidyDoc tdoc, ctmbstr content) |
int TIDY_CALL | tidyParseBuffer (TidyDoc tdoc, TidyBuffer *buf) |
int TIDY_CALL | tidyParseSource (TidyDoc tdoc, TidyInputSource *source) |
Parse markup from a given input source. String and filename functions added for convenience. HTML/XHTML version determined from input.
-int TIDY_CALL tidyParseFile | -( | -TidyDoc | -tdoc, | -
- | - | ctmbstr | -filename | -
- | ) | -- |
Parse markup in named file
- -int TIDY_CALL tidyParseStdin | -( | -TidyDoc | -tdoc | ) | -- |
Parse markup from the standard input
- -int TIDY_CALL tidyParseString | -( | -TidyDoc | -tdoc, | -
- | - | ctmbstr | -content | -
- | ) | -- |
Parse markup in given string
- -int TIDY_CALL tidyParseBuffer | -( | -TidyDoc | -tdoc, | -
- | - | TidyBuffer * | -buf | -
- | ) | -- |
Parse markup in given buffer
- -int TIDY_CALL tidyParseSource | -( | -TidyDoc | -tdoc, | -
- | - | TidyInputSource * | -source | -
- | ) | -- |
Parse markup in given generic input source
- -
- HTML Tidy
- 0.1
-
-
- |
-
-
-
-
-
-
-Functions | |
int TIDY_CALL | tidySaveFile (TidyDoc tdoc, ctmbstr filename) |
int TIDY_CALL | tidySaveStdout (TidyDoc tdoc) |
int TIDY_CALL | tidySaveBuffer (TidyDoc tdoc, TidyBuffer *buf) |
int TIDY_CALL | tidySaveString (TidyDoc tdoc, tmbstr buffer, uint *buflen) |
int TIDY_CALL | tidySaveSink (TidyDoc tdoc, TidyOutputSink *sink) |
Save currently parsed document to the given output sink. File name and string/buffer functions provided for convenience.
-int TIDY_CALL tidySaveFile | -( | -TidyDoc | -tdoc, | -
- | - | ctmbstr | -filename | -
- | ) | -- |
Save to named file
- -int TIDY_CALL tidySaveStdout | -( | -TidyDoc | -tdoc | ) | -- |
Save to standard output (FILE*)
- -int TIDY_CALL tidySaveBuffer | -( | -TidyDoc | -tdoc, | -
- | - | TidyBuffer * | -buf | -
- | ) | -- |
Save to given TidyBuffer object
- -int TIDY_CALL tidySaveString | -( | -TidyDoc | -tdoc, | -
- | - | tmbstr | -buffer, | -
- | - | uint * | -buflen | -
- | ) | -- |
Save document to application buffer. If buffer is not big enough, ENOMEM will be returned and the necessary buffer size will be placed in *buflen.
- -int TIDY_CALL tidySaveSink | -( | -TidyDoc | -tdoc, | -
- | - | TidyOutputSink * | -sink | -
- | ) | -- |
Save to given generic output sink
- -
- HTML Tidy
- 0.1
-
-
- |
-
-
-
-
-
-
-Functions | |
-TidyNode TIDY_CALL | tidyGetRoot (TidyDoc tdoc) |
-TidyNode TIDY_CALL | tidyGetHtml (TidyDoc tdoc) |
-TidyNode TIDY_CALL | tidyGetHead (TidyDoc tdoc) |
-TidyNode TIDY_CALL | tidyGetBody (TidyDoc tdoc) |
-TidyNode TIDY_CALL | tidyGetParent (TidyNode tnod) |
-TidyNode TIDY_CALL | tidyGetChild (TidyNode tnod) |
-TidyNode TIDY_CALL | tidyGetNext (TidyNode tnod) |
-TidyNode TIDY_CALL | tidyGetPrev (TidyNode tnod) |
-TidyAttr TIDY_CALL | tidyAttrFirst (TidyNode tnod) |
-TidyAttr TIDY_CALL | tidyAttrNext (TidyAttr tattr) |
-ctmbstr TIDY_CALL | tidyAttrName (TidyAttr tattr) |
-ctmbstr TIDY_CALL | tidyAttrValue (TidyAttr tattr) |
A parsed and, optionally, repaired document is represented by Tidy as a Tree, much like a W3C DOM. This tree may be traversed using these functions. The following snippet gives a basic idea how these functions can be used.
--void dumpNode( TidyNode tnod, int indent ) -{ - TidyNode child;
for ( child = tidyGetChild(tnod); child; child = tidyGetNext(child) ) - { - ctmbstr name; - switch ( tidyNodeGetType(child) ) - { - case TidyNode_Root: name = "Root"; break; - case TidyNode_DocType: name = "DOCTYPE"; break; - case TidyNode_Comment: name = "Comment"; break; - case TidyNode_ProcIns: name = "Processing Instruction"; break; - case TidyNode_Text: name = "Text"; break; - case TidyNode_CDATA: name = "CDATA"; break; - case TidyNode_Section: name = "XML Section"; break; - case TidyNode_Asp: name = "ASP"; break; - case TidyNode_Jste: name = "JSTE"; break; - case TidyNode_Php: name = "PHP"; break; - case TidyNode_XmlDecl: name = "XML Declaration"; break;
case TidyNode_Start: - case TidyNode_End: - case TidyNode_StartEnd: - default: - name = tidyNodeGetName( child ); - break; - } - assert( name != NULL ); - printf( "\%*.*sNode: \%s\\n", indent, indent, " ", name ); - dumpNode( child, indent + 4 ); - } -}
void dumpDoc( TidyDoc tdoc ) -{ - dumpNode( tidyGetRoot(tdoc), 0 ); -}
void dumpBody( TidyDoc tdoc ) -{ - dumpNode( tidyGetBody(tdoc), 0 ); -} -
- HTML Tidy
- 0.1
-
-
- |
-
-
-
-
-
-
- HTML Tidy
- 0.1
-
-
- |
-
-
-
-
-
-