HTML Tidy  5.2.0
The HTACG Tidy HTML Project
tidy.h
Go to the documentation of this file.
1 #ifndef __TIDY_H__
2 #define __TIDY_H__
3 
4 /** @file tidy.h - Defines HTML Tidy API implemented by tidy library.
5 
6  Public interface is const-correct and doesn't explicitly depend
7  on any globals. Thus, thread-safety may be introduced w/out
8  changing the interface.
9 
10  Looking ahead to a C++ wrapper, C functions always pass
11  this-equivalent as 1st arg.
12 
13 
14  Copyright (c) 1998-2008 World Wide Web Consortium
15  (Massachusetts Institute of Technology, European Research
16  Consortium for Informatics and Mathematics, Keio University).
17  All Rights Reserved.
18 
19  Contributing Author(s):
20 
21  Dave Raggett <dsr@w3.org>
22 
23  The contributing author(s) would like to thank all those who
24  helped with testing, bug fixes and suggestions for improvements.
25  This wouldn't have been possible without your help.
26 
27  COPYRIGHT NOTICE:
28 
29  This software and documentation is provided "as is," and
30  the copyright holders and contributing author(s) make no
31  representations or warranties, express or implied, including
32  but not limited to, warranties of merchantability or fitness
33  for any particular purpose or that the use of the software or
34  documentation will not infringe any third party patents,
35  copyrights, trademarks or other rights.
36 
37  The copyright holders and contributing author(s) will not be held
38  liable for any direct, indirect, special or consequential damages
39  arising out of any use of the software or documentation, even if
40  advised of the possibility of such damage.
41 
42  Permission is hereby granted to use, copy, modify, and distribute
43  this source code, or portions hereof, documentation and executables,
44  for any purpose, without fee, subject to the following restrictions:
45 
46  1. The origin of this source code must not be misrepresented.
47  2. Altered versions must be plainly marked as such and must
48  not be misrepresented as being the original source.
49  3. This Copyright notice may not be removed or altered from any
50  source or altered source distribution.
51 
52  The copyright holders and contributing author(s) specifically
53  permit, without fee, and encourage the use of this source code
54  as a component for supporting the Hypertext Markup Language in
55  commercial products. If you use this source code in a product,
56  acknowledgment is not required but would be appreciated.
57 
58 
59  Created 2001-05-20 by Charles Reitzel
60  Updated 2002-07-01 by Charles Reitzel - 1st Implementation
61  Updated 2015-06-09 by Geoff R. McLane - Add more doxygen syntax
62 
63 */
64 
65 #include "tidyplatform.h"
66 #include "tidyenum.h"
67 
68 #ifdef __cplusplus
69 extern "C" {
70 #endif
71 
72 /** @defgroup Opaque Opaque Types
73 **
74 ** Cast to implementation types within lib.
75 ** Reduces inter-dependencies/conflicts w/ application code.
76 ** @{
77 */
78 
79 /** @struct TidyDoc
80 ** Opaque document datatype
81 */
83 
84 /** @struct TidyOption
85 ** Opaque option datatype
86 */
88 
89 /** @struct TidyNode
90 ** Opaque node datatype
91 */
93 
94 /** @struct TidyAttr
95 ** Opaque attribute datatype
96 */
98 
99 /** @} end Opaque group */
100 
101 TIDY_STRUCT struct _TidyBuffer;
102 typedef struct _TidyBuffer TidyBuffer;
103 
104 
105 /** @defgroup Memory Memory Allocation
106 **
107 ** Tidy uses a user provided allocator for all
108 ** memory allocations. If this allocator is
109 ** not provided, then a default allocator is
110 ** used which simply wraps standard C malloc/free
111 ** calls. These wrappers call the panic function
112 ** upon any failure. The default panic function
113 ** prints an out of memory message to stderr, and
114 ** calls exit(2).
115 **
116 ** For applications in which it is unacceptable to
117 ** abort in the case of memory allocation, then the
118 ** panic function can be replaced with one which
119 ** longjmps() out of the tidy code. For this to
120 ** clean up completely, you should be careful not
121 ** to use any tidy methods that open files as these
122 ** will not be closed before panic() is called.
123 **
124 ** TODO: associate file handles with tidyDoc and
125 ** ensure that tidyDocRelease() can close them all.
126 **
127 ** Calling the withAllocator() family (
128 ** tidyCreateWithAllocator, tidyBufInitWithAllocator,
129 ** tidyBufAllocWithAllocator) allow settings custom
130 ** allocators).
131 **
132 ** All parts of the document use the same allocator.
133 ** Calls that require a user provided buffer can
134 ** optionally use a different allocator.
135 **
136 ** For reference in designing a plug-in allocator,
137 ** most allocations made by tidy are less than 100
138 ** bytes, corresponding to attribute names/values, etc.
139 **
140 ** There is also an additional class of much larger
141 ** allocations which are where most of the data from
142 ** the lexer is stored. (It is not currently possible
143 ** to use a separate allocator for the lexer, this
144 ** would be a useful extension).
145 **
146 ** In general, approximately 1/3rd of the memory
147 ** used by tidy is freed during the parse, so if
148 ** memory usage is an issue then an allocator that
149 ** can reuse this memory is a good idea.
150 **
151 ** @{
152 */
153 
154 /** Prototype for the allocator's function table */
155 struct _TidyAllocatorVtbl;
156 /** The allocators function table */
158 
159 /** Prototype for the allocator */
160 struct _TidyAllocator;
161 /** The allocator **/
163 
164 /** An allocator's function table. All functions here must
165  be provided.
166  */
168  /** Called to allocate a block of nBytes of memory */
169  void* (TIDY_CALL *alloc)( TidyAllocator *self, size_t nBytes );
170  /** Called to resize (grow, in general) a block of memory.
171  Must support being called with NULL.
172  */
173  void* (TIDY_CALL *realloc)( TidyAllocator *self, void *block, size_t nBytes );
174  /** Called to free a previously allocated block of memory */
175  void (TIDY_CALL *free)( TidyAllocator *self, void *block);
176  /** Called when a panic condition is detected. Must support
177  block == NULL. This function is not called if either alloc
178  or realloc fails; it is up to the allocator to do this.
179  Currently this function can only be called if an error is
180  detected in the tree integrity via the internal function
181  CheckNodeIntegrity(). This is a situation that can
182  only arise in the case of a programming error in tidylib.
183  You can turn off node integrity checking by defining
184  the constant NO_NODE_INTEGRITY_CHECK during the build.
185  **/
186  void (TIDY_CALL *panic)( TidyAllocator *self, ctmbstr msg );
187 };
188 
189 /** An allocator. To create your own allocator, do something like
190  the following:
191  \code
192  typedef struct _MyAllocator {
193  TidyAllocator base;
194  ...other custom allocator state...
195  } MyAllocator;
196 
197  void* MyAllocator_alloc(TidyAllocator *base, void *block, size_t nBytes)
198  {
199  MyAllocator *self = (MyAllocator*)base;
200  ...
201  }
202  (etc)
203 
204  static const TidyAllocatorVtbl MyAllocatorVtbl = {
205  MyAllocator_alloc,
206  MyAllocator_realloc,
207  MyAllocator_free,
208  MyAllocator_panic
209  };
210 
211  myAllocator allocator;
212  TidyDoc doc;
213 
214  allocator.base.vtbl = &amp;MyAllocatorVtbl;
215  ...initialise allocator specific state...
216  doc = tidyCreateWithAllocator(&allocator);
217  \endcode
218 
219  Although this looks slightly long winded, the advantage is that to create
220  a custom allocator you simply need to set the vtbl pointer correctly.
221  The vtbl itself can reside in static/global data, and hence does not
222  need to be initialised each time an allocator is created, and furthermore
223  the memory is shared amongst all created allocators.
224 */
227 };
228 
229 /** Callback for "malloc" replacement */
230 typedef void* (TIDY_CALL *TidyMalloc)( size_t len );
231 /** Callback for "realloc" replacement */
232 typedef void* (TIDY_CALL *TidyRealloc)( void* buf, size_t len );
233 /** Callback for "free" replacement */
234 typedef void (TIDY_CALL *TidyFree)( void* buf );
235 /** Callback for "out of memory" panic state */
236 typedef void (TIDY_CALL *TidyPanic)( ctmbstr mssg );
237 
238 
239 /** Give Tidy a malloc() replacement */
240 TIDY_EXPORT Bool TIDY_CALL tidySetMallocCall( TidyMalloc fmalloc );
241 /** Give Tidy a realloc() replacement */
242 TIDY_EXPORT Bool TIDY_CALL tidySetReallocCall( TidyRealloc frealloc );
243 /** Give Tidy a free() replacement */
244 TIDY_EXPORT Bool TIDY_CALL tidySetFreeCall( TidyFree ffree );
245 /** Give Tidy an "out of memory" handler */
246 TIDY_EXPORT Bool TIDY_CALL tidySetPanicCall( TidyPanic fpanic );
247 
248 /** @} end Memory group */
249 
250 /** @defgroup Basic Basic Operations
251 **
252 ** Tidy public interface
253 **
254 ** Several functions return an integer document status:
255 **
256 ** <pre>
257 ** 0 -> SUCCESS
258 ** >0 -> 1 == TIDY WARNING, 2 == TIDY ERROR
259 ** <0 -> SEVERE ERROR
260 ** </pre>
261 **
262 The following is a short example program.
263 
264 <pre>
265 \#include &lt;tidy.h&gt;
266 \#include &lt;tidybuffio.h&gt;
267 \#include &lt;stdio.h&gt;
268 \#include &lt;errno.h&gt;
269 
270 
271 int main(int argc, char **argv )
272 {
273  const char* input = "&lt;title&gt;Foo&lt;/title&gt;&lt;p&gt;Foo!";
274  TidyBuffer output;
275  TidyBuffer errbuf;
276  int rc = -1;
277  Bool ok;
278 
279  TidyDoc tdoc = tidyCreate(); // Initialize "document"
280  tidyBufInit( &amp;output );
281  tidyBufInit( &amp;errbuf );
282  printf( "Tidying:\t\%s\\n", input );
283 
284  ok = tidyOptSetBool( tdoc, TidyXhtmlOut, yes ); // Convert to XHTML
285  if ( ok )
286  rc = tidySetErrorBuffer( tdoc, &amp;errbuf ); // Capture diagnostics
287  if ( rc &gt;= 0 )
288  rc = tidyParseString( tdoc, input ); // Parse the input
289  if ( rc &gt;= 0 )
290  rc = tidyCleanAndRepair( tdoc ); // Tidy it up!
291  if ( rc &gt;= 0 )
292  rc = tidyRunDiagnostics( tdoc ); // Kvetch
293  if ( rc &gt; 1 ) // If error, force output.
294  rc = ( tidyOptSetBool(tdoc, TidyForceOutput, yes) ? rc : -1 );
295  if ( rc &gt;= 0 )
296  rc = tidySaveBuffer( tdoc, &amp;output ); // Pretty Print
297 
298  if ( rc &gt;= 0 )
299  {
300  if ( rc &gt; 0 )
301  printf( "\\nDiagnostics:\\n\\n\%s", errbuf.bp );
302  printf( "\\nAnd here is the result:\\n\\n\%s", output.bp );
303  }
304  else
305  printf( "A severe error (\%d) occurred.\\n", rc );
306 
307  tidyBufFree( &amp;output );
308  tidyBufFree( &amp;errbuf );
309  tidyRelease( tdoc );
310  return rc;
311 }
312 </pre>
313 ** @{
314 */
315 
316 /** The primary creation of a TidyDoc.
317  ** This must be the first call before most of the Tidy API which require the TidyDoc parameter.
318  ** When completed tidyRelease( TidyDoc tdoc ); should be called to release all memory
319  */
320 TIDY_EXPORT TidyDoc TIDY_CALL tidyCreate(void);
321 
322 /** Create a Tidoc supplying the TidyAllocator.
323  ** See the TidyAllocator structure for creating an allocator
324  */
325 TIDY_EXPORT TidyDoc TIDY_CALL tidyCreateWithAllocator( TidyAllocator *allocator );
326 
327 /** Free all memory and release the TidyDoc.
328  ** TidyDoc can not be used after this call.
329  */
330 TIDY_EXPORT void TIDY_CALL tidyRelease( TidyDoc tdoc );
331 
332 /** Let application store a chunk of data w/ each Tidy instance.
333 ** Useful for callbacks.
334 */
335 TIDY_EXPORT void TIDY_CALL tidySetAppData( TidyDoc tdoc, void* appData );
336 
337 /** Get application data set previously */
338 TIDY_EXPORT void* TIDY_CALL tidyGetAppData( TidyDoc tdoc );
339 
340 /** Get release date (version) for current library
341  ** @deprecated tidyReleaseDate() is deprecated in favor of semantic
342  ** versioning and should be replaced with tidyLibraryVersion().
343  */
344 
345 TIDY_EXPORT ctmbstr TIDY_CALL tidyReleaseDate(void);
346 
347 /** Get version number for the current library */
348 TIDY_EXPORT ctmbstr TIDY_CALL tidyLibraryVersion(void);
349 
350 /* Diagnostics and Repair
351 */
352 
353 /** Get status of current document. */
354 TIDY_EXPORT int TIDY_CALL tidyStatus( TidyDoc tdoc );
355 
356 /** Detected HTML version: 0, 2, 3 or 4 */
357 TIDY_EXPORT int TIDY_CALL tidyDetectedHtmlVersion( TidyDoc tdoc );
358 
359 /** Input is XHTML? */
360 TIDY_EXPORT Bool TIDY_CALL tidyDetectedXhtml( TidyDoc tdoc );
361 
362 /** Input is generic XML (not HTML or XHTML)? */
363 TIDY_EXPORT Bool TIDY_CALL tidyDetectedGenericXml( TidyDoc tdoc );
364 
365 /** Number of Tidy errors encountered. If > 0, output is suppressed
366 ** unless TidyForceOutput is set.
367 */
368 TIDY_EXPORT uint TIDY_CALL tidyErrorCount( TidyDoc tdoc );
369 
370 /** Number of Tidy warnings encountered. */
371 TIDY_EXPORT uint TIDY_CALL tidyWarningCount( TidyDoc tdoc );
372 
373 /** Number of Tidy accessibility warnings encountered. */
374 TIDY_EXPORT uint TIDY_CALL tidyAccessWarningCount( TidyDoc tdoc );
375 
376 /** Number of Tidy configuration errors encountered. */
377 TIDY_EXPORT uint TIDY_CALL tidyConfigErrorCount( TidyDoc tdoc );
378 
379 /* Get/Set configuration options
380 */
381 /** Load an ASCII Tidy configuration file */
382 TIDY_EXPORT int TIDY_CALL tidyLoadConfig( TidyDoc tdoc, ctmbstr configFile );
383 
384 /** Load a Tidy configuration file with the specified character encoding */
385 TIDY_EXPORT int TIDY_CALL tidyLoadConfigEnc( TidyDoc tdoc, ctmbstr configFile,
386  ctmbstr charenc );
387 
388 TIDY_EXPORT Bool TIDY_CALL tidyFileExists( TidyDoc tdoc, ctmbstr filename );
389 
390 
391 /** Set the input/output character encoding for parsing markup.
392 ** Values include: ascii, latin1, raw, utf8, iso2022, mac,
393 ** win1252, utf16le, utf16be, utf16, big5 and shiftjis. Case in-sensitive.
394 */
395 TIDY_EXPORT int TIDY_CALL tidySetCharEncoding( TidyDoc tdoc, ctmbstr encnam );
396 
397 /** Set the input encoding for parsing markup.
398 ** As for tidySetCharEncoding but only affects the input encoding
399 **/
400 TIDY_EXPORT int TIDY_CALL tidySetInCharEncoding( TidyDoc tdoc, ctmbstr encnam );
401 
402 /** Set the output encoding.
403 **/
404 TIDY_EXPORT int TIDY_CALL tidySetOutCharEncoding( TidyDoc tdoc, ctmbstr encnam );
405 
406 /** @} end Basic group */
407 
408 
409 /** @defgroup Configuration Configuration Options
410 **
411 ** Functions for getting and setting Tidy configuration options.
412 ** @{
413 */
414 
415 /** Applications using TidyLib may want to augment command-line and
416 ** configuration file options. Setting this callback allows an application
417 ** developer to examine command-line and configuration file options after
418 ** TidyLib has examined them and failed to recognize them.
419 **/
420 
421 typedef Bool (TIDY_CALL *TidyOptCallback)( ctmbstr option, ctmbstr value );
422 
423 TIDY_EXPORT Bool TIDY_CALL tidySetOptionCallback( TidyDoc tdoc, TidyOptCallback pOptCallback );
424 
425 /** Get option ID by name */
426 TIDY_EXPORT TidyOptionId TIDY_CALL tidyOptGetIdForName( ctmbstr optnam );
427 
428 /** Get iterator for list of option */
429 /**
430 Example:
431 <pre>
432 TidyIterator itOpt = tidyGetOptionList( tdoc );
433 while ( itOpt )
434 {
435  TidyOption opt = tidyGetNextOption( tdoc, &itOpt );
436  .. get/set option values ..
437 }
438 </pre>
439 */
440 
441 TIDY_EXPORT TidyIterator TIDY_CALL tidyGetOptionList( TidyDoc tdoc );
442 /** Get next Option */
443 TIDY_EXPORT TidyOption TIDY_CALL tidyGetNextOption( TidyDoc tdoc, TidyIterator* pos );
444 
445 /** Lookup option by ID */
446 TIDY_EXPORT TidyOption TIDY_CALL tidyGetOption( TidyDoc tdoc, TidyOptionId optId );
447 /** Lookup option by name */
448 TIDY_EXPORT TidyOption TIDY_CALL tidyGetOptionByName( TidyDoc tdoc, ctmbstr optnam );
449 
450 /** Get ID of given Option */
451 TIDY_EXPORT TidyOptionId TIDY_CALL tidyOptGetId( TidyOption opt );
452 
453 /** Get name of given Option */
454 TIDY_EXPORT ctmbstr TIDY_CALL tidyOptGetName( TidyOption opt );
455 
456 /** Get datatype of given Option */
457 TIDY_EXPORT TidyOptionType TIDY_CALL tidyOptGetType( TidyOption opt );
458 
459 /** Is Option read-only? */
460 TIDY_EXPORT Bool TIDY_CALL tidyOptIsReadOnly( TidyOption opt );
461 
462 /** Get category of given Option */
463 TIDY_EXPORT TidyConfigCategory TIDY_CALL tidyOptGetCategory( TidyOption opt );
464 
465 /** Get default value of given Option as a string */
466 TIDY_EXPORT ctmbstr TIDY_CALL tidyOptGetDefault( TidyOption opt );
467 
468 /** Get default value of given Option as an unsigned integer */
469 TIDY_EXPORT ulong TIDY_CALL tidyOptGetDefaultInt( TidyOption opt );
470 
471 /** Get default value of given Option as a Boolean value */
472 TIDY_EXPORT Bool TIDY_CALL tidyOptGetDefaultBool( TidyOption opt );
473 
474 /** Iterate over Option "pick list" */
475 TIDY_EXPORT TidyIterator TIDY_CALL tidyOptGetPickList( TidyOption opt );
476 /** Get next string value of Option "pick list" */
477 TIDY_EXPORT ctmbstr TIDY_CALL tidyOptGetNextPick( TidyOption opt, TidyIterator* pos );
478 
479 /** Get current Option value as a string */
480 TIDY_EXPORT ctmbstr TIDY_CALL tidyOptGetValue( TidyDoc tdoc, TidyOptionId optId );
481 /** Set Option value as a string */
482 TIDY_EXPORT Bool TIDY_CALL tidyOptSetValue( TidyDoc tdoc, TidyOptionId optId, ctmbstr val );
483 /** Set named Option value as a string. Good if not sure of type. */
484 TIDY_EXPORT Bool TIDY_CALL tidyOptParseValue( TidyDoc tdoc, ctmbstr optnam, ctmbstr val );
485 
486 /** Get current Option value as an integer */
487 TIDY_EXPORT ulong TIDY_CALL tidyOptGetInt( TidyDoc tdoc, TidyOptionId optId );
488 /** Set Option value as an integer */
489 TIDY_EXPORT Bool TIDY_CALL tidyOptSetInt( TidyDoc tdoc, TidyOptionId optId, ulong val );
490 
491 /** Get current Option value as a Boolean flag */
492 TIDY_EXPORT Bool TIDY_CALL tidyOptGetBool( TidyDoc tdoc, TidyOptionId optId );
493 /** Set Option value as a Boolean flag */
494 TIDY_EXPORT Bool TIDY_CALL tidyOptSetBool( TidyDoc tdoc, TidyOptionId optId, Bool val );
495 
496 /** Reset option to default value by ID */
497 TIDY_EXPORT Bool TIDY_CALL tidyOptResetToDefault( TidyDoc tdoc, TidyOptionId opt );
498 /** Reset all options to their default values */
499 TIDY_EXPORT Bool TIDY_CALL tidyOptResetAllToDefault( TidyDoc tdoc );
500 
501 /** Take a snapshot of current config settings */
502 TIDY_EXPORT Bool TIDY_CALL tidyOptSnapshot( TidyDoc tdoc );
503 /** Reset config settings to snapshot (after document processing) */
504 TIDY_EXPORT Bool TIDY_CALL tidyOptResetToSnapshot( TidyDoc tdoc );
505 
506 /** Any settings different than default? */
507 TIDY_EXPORT Bool TIDY_CALL tidyOptDiffThanDefault( TidyDoc tdoc );
508 /** Any settings different than snapshot? */
509 TIDY_EXPORT Bool TIDY_CALL tidyOptDiffThanSnapshot( TidyDoc tdoc );
510 
511 /** Copy current configuration settings from one document to another */
512 TIDY_EXPORT Bool TIDY_CALL tidyOptCopyConfig( TidyDoc tdocTo, TidyDoc tdocFrom );
513 
514 /** Get character encoding name. Used with TidyCharEncoding,
515 ** TidyOutCharEncoding, TidyInCharEncoding */
516 TIDY_EXPORT ctmbstr TIDY_CALL tidyOptGetEncName( TidyDoc tdoc, TidyOptionId optId );
517 
518 /** Get current pick list value for option by ID. Useful for enum types. */
519 TIDY_EXPORT ctmbstr TIDY_CALL tidyOptGetCurrPick( TidyDoc tdoc, TidyOptionId optId);
520 
521 /** Iterate over user declared tags */
522 TIDY_EXPORT TidyIterator TIDY_CALL tidyOptGetDeclTagList( TidyDoc tdoc );
523 /** Get next declared tag of specified type: TidyInlineTags, TidyBlockTags,
524 ** TidyEmptyTags, TidyPreTags */
525 TIDY_EXPORT ctmbstr TIDY_CALL tidyOptGetNextDeclTag( TidyDoc tdoc,
526  TidyOptionId optId,
527  TidyIterator* iter );
528 /** Get option description */
529 TIDY_EXPORT ctmbstr TIDY_CALL tidyOptGetDoc( TidyDoc tdoc, TidyOption opt );
530 
531 /** Iterate over a list of related options */
532 TIDY_EXPORT TidyIterator TIDY_CALL tidyOptGetDocLinksList( TidyDoc tdoc,
533  TidyOption opt );
534 /** Get next related option */
535 TIDY_EXPORT TidyOption TIDY_CALL tidyOptGetNextDocLinks( TidyDoc tdoc,
536  TidyIterator* pos );
537 
538 /** @} end Configuration group */
539 
540 /** @defgroup IO I/O and Messages
541 **
542 ** By default, Tidy will define, create and use
543 ** instances of input and output handlers for
544 ** standard C buffered I/O (i.e. FILE* stdin,
545 ** FILE* stdout and FILE* stderr for content
546 ** input, content output and diagnostic output,
547 ** respectively. A FILE* cfgFile input handler
548 ** will be used for config files. Command line
549 ** options will just be set directly.
550 **
551 ** @{
552 */
553 
554 /*****************
555  Input Source
556 *****************/
557 /** Input Callback: get next byte of input */
558 typedef int (TIDY_CALL *TidyGetByteFunc)( void* sourceData );
559 
560 /** Input Callback: unget a byte of input */
561 typedef void (TIDY_CALL *TidyUngetByteFunc)( void* sourceData, byte bt );
562 
563 /** Input Callback: is end of input? */
564 typedef Bool (TIDY_CALL *TidyEOFFunc)( void* sourceData );
565 
566 /** End of input "character" */
567 #define EndOfStream (~0u)
568 
569 /** TidyInputSource - Delivers raw bytes of input
570 */
571 TIDY_STRUCT
572 typedef struct _TidyInputSource
573 {
574  /* Instance data */
575  void* sourceData; /**< Input context. Passed to callbacks */
576 
577  /* Methods */
578  TidyGetByteFunc getByte; /**< Pointer to "get byte" callback */
579  TidyUngetByteFunc ungetByte; /**< Pointer to "unget" callback */
580  TidyEOFFunc eof; /**< Pointer to "eof" callback */
582 
583 /** Facilitates user defined source by providing
584 ** an entry point to marshal pointers-to-functions.
585 ** Needed by .NET and possibly other language bindings.
586 */
587 TIDY_EXPORT Bool TIDY_CALL tidyInitSource( TidyInputSource* source,
588  void* srcData,
589  TidyGetByteFunc gbFunc,
590  TidyUngetByteFunc ugbFunc,
591  TidyEOFFunc endFunc );
592 
593 /** Helper: get next byte from input source */
594 TIDY_EXPORT uint TIDY_CALL tidyGetByte( TidyInputSource* source );
595 
596 /** Helper: unget byte back to input source */
597 TIDY_EXPORT void TIDY_CALL tidyUngetByte( TidyInputSource* source, uint byteValue );
598 
599 /** Helper: check if input source at end */
600 TIDY_EXPORT Bool TIDY_CALL tidyIsEOF( TidyInputSource* source );
601 
602 
603 /****************
604  Output Sink
605 ****************/
606 /** Output callback: send a byte to output */
607 typedef void (TIDY_CALL *TidyPutByteFunc)( void* sinkData, byte bt );
608 
609 
610 /** TidyOutputSink - accepts raw bytes of output
611 */
612 TIDY_STRUCT
613 typedef struct _TidyOutputSink
614 {
615  /* Instance data */
616  void* sinkData; /**< Output context. Passed to callbacks */
617 
618  /* Methods */
619  TidyPutByteFunc putByte; /**< Pointer to "put byte" callback */
621 
622 /** Facilitates user defined sinks by providing
623 ** an entry point to marshal pointers-to-functions.
624 ** Needed by .NET and possibly other language bindings.
625 */
626 TIDY_EXPORT Bool TIDY_CALL tidyInitSink( TidyOutputSink* sink,
627  void* snkData,
628  TidyPutByteFunc pbFunc );
629 
630 /** Helper: send a byte to output */
631 TIDY_EXPORT void TIDY_CALL tidyPutByte( TidyOutputSink* sink, uint byteValue );
632 
633 
634 /****************
635  Errors
636 ****************/
637 /** Callback to filter messages by diagnostic level:
638 ** info, warning, etc. Just set diagnostic output
639 ** handler to redirect all diagnostics output. Return true
640 ** to proceed with output, false to cancel.
641 */
642 typedef Bool (TIDY_CALL *TidyReportFilter)( TidyDoc tdoc, TidyReportLevel lvl,
643  uint line, uint col, ctmbstr mssg );
644 
645 typedef Bool (TIDY_CALL *TidyReportFilter2)( TidyDoc tdoc, TidyReportLevel lvl,
646  uint line, uint col, ctmbstr mssg, va_list args );
647 
648 typedef Bool (TIDY_CALL *TidyReportFilter3)( TidyDoc tdoc, TidyReportLevel lvl,
649  uint line, uint col, ctmbstr code, va_list args );
650 
651 /** Give Tidy a filter callback to use */
652 TIDY_EXPORT Bool TIDY_CALL tidySetReportFilter( TidyDoc tdoc,
653  TidyReportFilter filtCallback );
654 
655 TIDY_EXPORT Bool TIDY_CALL tidySetReportFilter2( TidyDoc tdoc,
656  TidyReportFilter2 filtCallback );
657 
658 TIDY_EXPORT Bool TIDY_CALL tidySetReportFilter3( TidyDoc tdoc,
659  TidyReportFilter3 filtCallback );
660 
661 /** Set error sink to named file */
662 TIDY_EXPORT FILE* TIDY_CALL tidySetErrorFile( TidyDoc tdoc, ctmbstr errfilnam );
663 /** Set error sink to given buffer */
664 TIDY_EXPORT int TIDY_CALL tidySetErrorBuffer( TidyDoc tdoc, TidyBuffer* errbuf );
665 /** Set error sink to given generic sink */
666 TIDY_EXPORT int TIDY_CALL tidySetErrorSink( TidyDoc tdoc, TidyOutputSink* sink );
667 
668 
669 /****************
670  Printing
671 ****************/
672 /** Callback to track the progress of the pretting printing process.
673 **
674 */
675 typedef void (TIDY_CALL *TidyPPProgress)( TidyDoc tdoc, uint line, uint col, uint destLine );
676 
677 TIDY_EXPORT Bool TIDY_CALL tidySetPrettyPrinterCallback( TidyDoc tdoc,
678  TidyPPProgress callback );
679 
680 /** @} end IO group */
681 
682 /* TODO: Catalog all messages for easy translation
683 TIDY_EXPORT ctmbstr tidyLookupMessage( int errorNo );
684 */
685 
686 
687 
688 /** @defgroup Parse Document Parse
689 **
690 ** Parse markup from a given input source. String and filename
691 ** functions added for convenience. HTML/XHTML version determined
692 ** from input.
693 ** @{
694 */
695 
696 /** Parse markup in named file */
697 TIDY_EXPORT int TIDY_CALL tidyParseFile( TidyDoc tdoc, ctmbstr filename );
698 
699 /** Parse markup from the standard input */
700 TIDY_EXPORT int TIDY_CALL tidyParseStdin( TidyDoc tdoc );
701 
702 /** Parse markup in given string */
703 TIDY_EXPORT int TIDY_CALL tidyParseString( TidyDoc tdoc, ctmbstr content );
704 
705 /** Parse markup in given buffer */
706 TIDY_EXPORT int TIDY_CALL tidyParseBuffer( TidyDoc tdoc, TidyBuffer* buf );
707 
708 /** Parse markup in given generic input source */
709 TIDY_EXPORT int TIDY_CALL tidyParseSource( TidyDoc tdoc, TidyInputSource* source);
710 
711 /** @} End Parse group */
712 
713 
714 /** @defgroup Clean Diagnostics and Repair
715 **
716 ** @{
717 */
718 /** Execute configured cleanup and repair operations on parsed markup */
719 TIDY_EXPORT int TIDY_CALL tidyCleanAndRepair( TidyDoc tdoc );
720 
721 /** Run configured diagnostics on parsed and repaired markup.
722 ** Must call tidyCleanAndRepair() first.
723 */
724 TIDY_EXPORT int TIDY_CALL tidyRunDiagnostics( TidyDoc tdoc );
725 
726 TIDY_EXPORT int TIDY_CALL tidyReportDoctype( TidyDoc tdoc );
727 
728 /** @} end Clean group */
729 
730 
731 /** @defgroup Save Document Save Functions
732 **
733 ** Save currently parsed document to the given output sink. File name
734 ** and string/buffer functions provided for convenience.
735 ** @{
736 */
737 
738 /** Save to named file */
739 TIDY_EXPORT int TIDY_CALL tidySaveFile( TidyDoc tdoc, ctmbstr filename );
740 
741 /** Save to standard output (FILE*) */
742 TIDY_EXPORT int TIDY_CALL tidySaveStdout( TidyDoc tdoc );
743 
744 /** Save to given TidyBuffer object */
745 TIDY_EXPORT int TIDY_CALL tidySaveBuffer( TidyDoc tdoc, TidyBuffer* buf );
746 
747 /** Save document to application buffer. If TidyShowMarkup and
748 ** the document has no errors, or TidyForceOutput, the current
749 ** document, per the current configuration, will be Pretty Printed
750 ** to the application buffer. The document byte length,
751 ** not character length, will be placed in *buflen. The document
752 ** will not be null terminated. If the buffer is not big enough,
753 ** ENOMEM will be returned, else the actual document status.
754 */
755 TIDY_EXPORT int TIDY_CALL tidySaveString( TidyDoc tdoc,
756  tmbstr buffer, uint* buflen );
757 
758 /** Save to given generic output sink */
759 TIDY_EXPORT int TIDY_CALL tidySaveSink( TidyDoc tdoc, TidyOutputSink* sink );
760 
761 /** @} end Save group */
762 
763 
764 /** @addtogroup Basic
765 ** @{
766 */
767 /** Save current settings to named file.
768  Only non-default values are written. */
769 TIDY_EXPORT int TIDY_CALL tidyOptSaveFile( TidyDoc tdoc, ctmbstr cfgfil );
770 
771 /** Save current settings to given output sink.
772  Only non-default values are written. */
773 TIDY_EXPORT int TIDY_CALL tidyOptSaveSink( TidyDoc tdoc, TidyOutputSink* sink );
774 
775 
776 /* Error reporting functions
777 */
778 
779 /** Write more complete information about errors to current error sink. */
780 TIDY_EXPORT void TIDY_CALL tidyErrorSummary( TidyDoc tdoc );
781 
782 /** Write more general information about markup to current error sink. */
783 TIDY_EXPORT void TIDY_CALL tidyGeneralInfo( TidyDoc tdoc );
784 
785 /** @} end Basic group (again) */
786 
787 
788 /** @defgroup Tree Document Tree
789 **
790 ** A parsed and, optionally, repaired document is
791 ** represented by Tidy as a Tree, much like a W3C DOM.
792 ** This tree may be traversed using these functions.
793 ** The following snippet gives a basic idea how these
794 ** functions can be used.
795 **
796 <pre>
797 void dumpNode( TidyNode tnod, int indent )
798 {
799  TidyNode child;
800 
801  for ( child = tidyGetChild(tnod); child; child = tidyGetNext(child) )
802  {
803  ctmbstr name;
804  switch ( tidyNodeGetType(child) )
805  {
806  case TidyNode_Root: name = "Root"; break;
807  case TidyNode_DocType: name = "DOCTYPE"; break;
808  case TidyNode_Comment: name = "Comment"; break;
809  case TidyNode_ProcIns: name = "Processing Instruction"; break;
810  case TidyNode_Text: name = "Text"; break;
811  case TidyNode_CDATA: name = "CDATA"; break;
812  case TidyNode_Section: name = "XML Section"; break;
813  case TidyNode_Asp: name = "ASP"; break;
814  case TidyNode_Jste: name = "JSTE"; break;
815  case TidyNode_Php: name = "PHP"; break;
816  case TidyNode_XmlDecl: name = "XML Declaration"; break;
817 
818  case TidyNode_Start:
819  case TidyNode_End:
820  case TidyNode_StartEnd:
821  default:
822  name = tidyNodeGetName( child );
823  break;
824  }
825  assert( name != NULL );
826  printf( "\%*.*sNode: \%s\\n", indent, indent, " ", name );
827  dumpNode( child, indent + 4 );
828  }
829 }
830 
831 void dumpDoc( TidyDoc tdoc )
832 {
833  dumpNode( tidyGetRoot(tdoc), 0 );
834 }
835 
836 void dumpBody( TidyDoc tdoc )
837 {
838  dumpNode( tidyGetBody(tdoc), 0 );
839 }
840 </pre>
841 
842 @{
843 
844 */
845 
846 TIDY_EXPORT TidyNode TIDY_CALL tidyGetRoot( TidyDoc tdoc );
847 TIDY_EXPORT TidyNode TIDY_CALL tidyGetHtml( TidyDoc tdoc );
848 TIDY_EXPORT TidyNode TIDY_CALL tidyGetHead( TidyDoc tdoc );
849 TIDY_EXPORT TidyNode TIDY_CALL tidyGetBody( TidyDoc tdoc );
850 
851 /* remove a node */
852 TIDY_EXPORT TidyNode TIDY_CALL tidyDiscardElement( TidyDoc tdoc, TidyNode tnod );
853 
854 /* parent / child */
855 TIDY_EXPORT TidyNode TIDY_CALL tidyGetParent( TidyNode tnod );
856 TIDY_EXPORT TidyNode TIDY_CALL tidyGetChild( TidyNode tnod );
857 
858 /* siblings */
859 TIDY_EXPORT TidyNode TIDY_CALL tidyGetNext( TidyNode tnod );
860 TIDY_EXPORT TidyNode TIDY_CALL tidyGetPrev( TidyNode tnod );
861 
862 /* Null for non-element nodes and all pure HTML
863 TIDY_EXPORT ctmbstr tidyNodeNsLocal( TidyNode tnod );
864 TIDY_EXPORT ctmbstr tidyNodeNsPrefix( TidyNode tnod );
865 TIDY_EXPORT ctmbstr tidyNodeNsUri( TidyNode tnod );
866 */
867 
868 /* Iterate over attribute values */
869 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrFirst( TidyNode tnod );
870 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrNext( TidyAttr tattr );
871 
872 TIDY_EXPORT ctmbstr TIDY_CALL tidyAttrName( TidyAttr tattr );
873 TIDY_EXPORT ctmbstr TIDY_CALL tidyAttrValue( TidyAttr tattr );
874 
875 TIDY_EXPORT void TIDY_CALL tidyAttrDiscard( TidyDoc itdoc, TidyNode tnod, TidyAttr tattr );
876 
877 /* Null for pure HTML
878 TIDY_EXPORT ctmbstr tidyAttrNsLocal( TidyAttr tattr );
879 TIDY_EXPORT ctmbstr tidyAttrNsPrefix( TidyAttr tattr );
880 TIDY_EXPORT ctmbstr tidyAttrNsUri( TidyAttr tattr );
881 */
882 
883 /** @} end Tree group */
884 
885 
886 /** @defgroup NodeAsk Node Interrogation
887 **
888 ** Get information about any givent node.
889 ** @{
890 */
891 
892 /* Node info */
893 TIDY_EXPORT TidyNodeType TIDY_CALL tidyNodeGetType( TidyNode tnod );
894 TIDY_EXPORT ctmbstr TIDY_CALL tidyNodeGetName( TidyNode tnod );
895 
896 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsText( TidyNode tnod );
897 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsProp( TidyDoc tdoc, TidyNode tnod );
898 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsHeader( TidyNode tnod ); /* h1, h2, ... */
899 
900 TIDY_EXPORT Bool TIDY_CALL tidyNodeHasText( TidyDoc tdoc, TidyNode tnod );
901 TIDY_EXPORT Bool TIDY_CALL tidyNodeGetText( TidyDoc tdoc, TidyNode tnod, TidyBuffer* buf );
902 
903 /* Copy the unescaped value of this node into the given TidyBuffer as UTF-8 */
904 TIDY_EXPORT Bool TIDY_CALL tidyNodeGetValue( TidyDoc tdoc, TidyNode tnod, TidyBuffer* buf );
905 
906 TIDY_EXPORT TidyTagId TIDY_CALL tidyNodeGetId( TidyNode tnod );
907 
908 TIDY_EXPORT uint TIDY_CALL tidyNodeLine( TidyNode tnod );
909 TIDY_EXPORT uint TIDY_CALL tidyNodeColumn( TidyNode tnod );
910 
911 /** @defgroup NodeIsElementName Deprecated node interrogation per TagId
912 **
913 ** @deprecated The functions tidyNodeIs{ElementName} are deprecated and
914 ** should be replaced by tidyNodeGetId.
915 ** @{
916 */
917 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsHTML( TidyNode tnod );
918 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsHEAD( TidyNode tnod );
919 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsTITLE( TidyNode tnod );
920 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsBASE( TidyNode tnod );
921 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsMETA( TidyNode tnod );
922 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsBODY( TidyNode tnod );
923 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsFRAMESET( TidyNode tnod );
924 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsFRAME( TidyNode tnod );
925 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsIFRAME( TidyNode tnod );
926 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsNOFRAMES( TidyNode tnod );
927 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsHR( TidyNode tnod );
928 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsH1( TidyNode tnod );
929 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsH2( TidyNode tnod );
930 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsPRE( TidyNode tnod );
931 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsLISTING( TidyNode tnod );
932 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsP( TidyNode tnod );
933 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsUL( TidyNode tnod );
934 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsOL( TidyNode tnod );
935 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsDL( TidyNode tnod );
936 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsDIR( TidyNode tnod );
937 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsLI( TidyNode tnod );
938 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsDT( TidyNode tnod );
939 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsDD( TidyNode tnod );
940 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsTABLE( TidyNode tnod );
941 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsCAPTION( TidyNode tnod );
942 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsTD( TidyNode tnod );
943 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsTH( TidyNode tnod );
944 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsTR( TidyNode tnod );
945 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsCOL( TidyNode tnod );
946 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsCOLGROUP( TidyNode tnod );
947 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsBR( TidyNode tnod );
948 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsA( TidyNode tnod );
949 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsLINK( TidyNode tnod );
950 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsB( TidyNode tnod );
951 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsI( TidyNode tnod );
952 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsSTRONG( TidyNode tnod );
953 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsEM( TidyNode tnod );
954 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsBIG( TidyNode tnod );
955 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsSMALL( TidyNode tnod );
956 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsPARAM( TidyNode tnod );
957 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsOPTION( TidyNode tnod );
958 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsOPTGROUP( TidyNode tnod );
959 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsIMG( TidyNode tnod );
960 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsMAP( TidyNode tnod );
961 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsAREA( TidyNode tnod );
962 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsNOBR( TidyNode tnod );
963 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsWBR( TidyNode tnod );
964 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsFONT( TidyNode tnod );
965 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsLAYER( TidyNode tnod );
966 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsSPACER( TidyNode tnod );
967 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsCENTER( TidyNode tnod );
968 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsSTYLE( TidyNode tnod );
969 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsSCRIPT( TidyNode tnod );
970 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsNOSCRIPT( TidyNode tnod );
971 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsFORM( TidyNode tnod );
972 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsTEXTAREA( TidyNode tnod );
973 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsBLOCKQUOTE( TidyNode tnod );
974 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsAPPLET( TidyNode tnod );
975 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsOBJECT( TidyNode tnod );
976 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsDIV( TidyNode tnod );
977 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsSPAN( TidyNode tnod );
978 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsINPUT( TidyNode tnod );
979 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsQ( TidyNode tnod );
980 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsLABEL( TidyNode tnod );
981 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsH3( TidyNode tnod );
982 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsH4( TidyNode tnod );
983 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsH5( TidyNode tnod );
984 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsH6( TidyNode tnod );
985 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsADDRESS( TidyNode tnod );
986 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsXMP( TidyNode tnod );
987 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsSELECT( TidyNode tnod );
988 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsBLINK( TidyNode tnod );
989 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsMARQUEE( TidyNode tnod );
990 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsEMBED( TidyNode tnod );
991 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsBASEFONT( TidyNode tnod );
992 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsISINDEX( TidyNode tnod );
993 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsS( TidyNode tnod );
994 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsSTRIKE( TidyNode tnod );
995 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsU( TidyNode tnod );
996 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsMENU( TidyNode tnod );
997 
998 /* HTML5 */
999 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsDATALIST( TidyNode tnod ); // bit like OPTIONS
1000 
1001 
1002 /** @} End NodeIsElementName group */
1003 
1004 /** @} End NodeAsk group */
1005 
1006 
1007 /** @defgroup Attribute Attribute Interrogation
1008 **
1009 ** Get information about any given attribute.
1010 ** @{
1011 */
1012 
1013 TIDY_EXPORT TidyAttrId TIDY_CALL tidyAttrGetId( TidyAttr tattr );
1014 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsEvent( TidyAttr tattr );
1015 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsProp( TidyAttr tattr );
1016 
1017 /** @defgroup AttrIsAttributeName Deprecated attribute interrogation per AttrId
1018 **
1019 ** @deprecated The functions tidyAttrIs{AttributeName} are deprecated and
1020 ** should be replaced by tidyAttrGetId.
1021 ** @{
1022 */
1023 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsHREF( TidyAttr tattr );
1024 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsSRC( TidyAttr tattr );
1025 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsID( TidyAttr tattr );
1026 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsNAME( TidyAttr tattr );
1027 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsSUMMARY( TidyAttr tattr );
1028 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsALT( TidyAttr tattr );
1029 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsLONGDESC( TidyAttr tattr );
1030 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsUSEMAP( TidyAttr tattr );
1031 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsISMAP( TidyAttr tattr );
1032 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsLANGUAGE( TidyAttr tattr );
1033 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsTYPE( TidyAttr tattr );
1034 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsVALUE( TidyAttr tattr );
1035 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsCONTENT( TidyAttr tattr );
1036 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsTITLE( TidyAttr tattr );
1037 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsXMLNS( TidyAttr tattr );
1038 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsDATAFLD( TidyAttr tattr );
1039 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsWIDTH( TidyAttr tattr );
1040 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsHEIGHT( TidyAttr tattr );
1041 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsFOR( TidyAttr tattr );
1042 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsSELECTED( TidyAttr tattr );
1043 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsCHECKED( TidyAttr tattr );
1044 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsLANG( TidyAttr tattr );
1045 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsTARGET( TidyAttr tattr );
1046 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsHTTP_EQUIV( TidyAttr tattr );
1047 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsREL( TidyAttr tattr );
1048 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsOnMOUSEMOVE( TidyAttr tattr );
1049 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsOnMOUSEDOWN( TidyAttr tattr );
1050 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsOnMOUSEUP( TidyAttr tattr );
1051 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsOnCLICK( TidyAttr tattr );
1052 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsOnMOUSEOVER( TidyAttr tattr );
1053 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsOnMOUSEOUT( TidyAttr tattr );
1054 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsOnKEYDOWN( TidyAttr tattr );
1055 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsOnKEYUP( TidyAttr tattr );
1056 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsOnKEYPRESS( TidyAttr tattr );
1057 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsOnFOCUS( TidyAttr tattr );
1058 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsOnBLUR( TidyAttr tattr );
1059 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsBGCOLOR( TidyAttr tattr );
1060 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsLINK( TidyAttr tattr );
1061 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsALINK( TidyAttr tattr );
1062 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsVLINK( TidyAttr tattr );
1063 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsTEXT( TidyAttr tattr );
1064 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsSTYLE( TidyAttr tattr );
1065 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsABBR( TidyAttr tattr );
1066 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsCOLSPAN( TidyAttr tattr );
1067 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsROWSPAN( TidyAttr tattr );
1068 
1069 /** @} End AttrIsAttributeName group */
1070 
1071 /** @} end AttrAsk group */
1072 
1073 
1074 /** @defgroup AttrGet Attribute Retrieval
1075 **
1076 ** Lookup an attribute from a given node
1077 ** @{
1078 */
1079 
1080 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetById( TidyNode tnod, TidyAttrId attId );
1081 
1082 /** @defgroup AttrGetAttributeName Deprecated attribute retrieval per AttrId
1083 **
1084 ** @deprecated The functions tidyAttrGet{AttributeName} are deprecated and
1085 ** should be replaced by tidyAttrGetById.
1086 ** For instance, tidyAttrGetID( TidyNode tnod ) can be replaced by
1087 ** tidyAttrGetById( TidyNode tnod, TidyAttr_ID ). This avoids a potential
1088 ** name clash with tidyAttrGetId for case-insensitive languages.
1089 ** @{
1090 */
1091 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetHREF( TidyNode tnod );
1092 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetSRC( TidyNode tnod );
1093 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetID( TidyNode tnod );
1094 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetNAME( TidyNode tnod );
1095 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetSUMMARY( TidyNode tnod );
1096 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetALT( TidyNode tnod );
1097 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetLONGDESC( TidyNode tnod );
1098 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetUSEMAP( TidyNode tnod );
1099 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetISMAP( TidyNode tnod );
1100 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetLANGUAGE( TidyNode tnod );
1101 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetTYPE( TidyNode tnod );
1102 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetVALUE( TidyNode tnod );
1103 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetCONTENT( TidyNode tnod );
1104 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetTITLE( TidyNode tnod );
1105 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetXMLNS( TidyNode tnod );
1106 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetDATAFLD( TidyNode tnod );
1107 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetWIDTH( TidyNode tnod );
1108 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetHEIGHT( TidyNode tnod );
1109 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetFOR( TidyNode tnod );
1110 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetSELECTED( TidyNode tnod );
1111 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetCHECKED( TidyNode tnod );
1112 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetLANG( TidyNode tnod );
1113 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetTARGET( TidyNode tnod );
1114 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetHTTP_EQUIV( TidyNode tnod );
1115 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetREL( TidyNode tnod );
1116 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetOnMOUSEMOVE( TidyNode tnod );
1117 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetOnMOUSEDOWN( TidyNode tnod );
1118 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetOnMOUSEUP( TidyNode tnod );
1119 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetOnCLICK( TidyNode tnod );
1120 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetOnMOUSEOVER( TidyNode tnod );
1121 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetOnMOUSEOUT( TidyNode tnod );
1122 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetOnKEYDOWN( TidyNode tnod );
1123 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetOnKEYUP( TidyNode tnod );
1124 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetOnKEYPRESS( TidyNode tnod );
1125 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetOnFOCUS( TidyNode tnod );
1126 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetOnBLUR( TidyNode tnod );
1127 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetBGCOLOR( TidyNode tnod );
1128 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetLINK( TidyNode tnod );
1129 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetALINK( TidyNode tnod );
1130 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetVLINK( TidyNode tnod );
1131 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetTEXT( TidyNode tnod );
1132 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetSTYLE( TidyNode tnod );
1133 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetABBR( TidyNode tnod );
1134 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetCOLSPAN( TidyNode tnod );
1135 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetROWSPAN( TidyNode tnod );
1136 
1137 /** @} End AttrGetAttributeName group */
1138 
1139 /** @} end AttrGet group */
1140 
1141 #ifdef __cplusplus
1142 } /* extern "C" */
1143 #endif
1144 #endif /* __TIDY_H__ */
1145 
1146 /*
1147  * local variables:
1148  * mode: c
1149  * indent-tabs-mode: nil
1150  * c-basic-offset: 4
1151  * eval: (c-set-offset 'substatement-open 0)
1152  * end:
1153  */
TidyAttrId TIDY_CALL tidyAttrGetId(TidyAttr tattr)
int TIDY_CALL tidyParseSource(TidyDoc tdoc, TidyInputSource *source)
Parse markup in given generic input source.
TidyIterator TIDY_CALL tidyOptGetDeclTagList(TidyDoc tdoc)
Iterate over user declared tags.
TidyNode TIDY_CALL tidyGetHtml(TidyDoc tdoc)
Bool TIDY_CALL tidyAttrIsID(TidyAttr tattr)
Bool TIDY_CALL tidyNodeIsDT(TidyNode tnod)
Bool TIDY_CALL tidyOptResetToDefault(TidyDoc tdoc, TidyOptionId opt)
Reset option to default value by ID.
TidyAttr TIDY_CALL tidyAttrGetTEXT(TidyNode tnod)
uint TIDY_CALL tidyAccessWarningCount(TidyDoc tdoc)
Number of Tidy accessibility warnings encountered.
Bool TIDY_CALL tidyNodeIsCAPTION(TidyNode tnod)
TidyAttr TIDY_CALL tidyAttrGetOnKEYDOWN(TidyNode tnod)
Bool(TIDY_CALL * TidyReportFilter2)(TidyDoc tdoc, TidyReportLevel lvl, uint line, uint col, ctmbstr mssg, va_list args)
Definition: tidy.h:645
TidyAttr TIDY_CALL tidyAttrGetHEIGHT(TidyNode tnod)
TidyOptionType TIDY_CALL tidyOptGetType(TidyOption opt)
Get datatype of given Option.
Bool TIDY_CALL tidyAttrIsABBR(TidyAttr tattr)
int TIDY_CALL tidyRunDiagnostics(TidyDoc tdoc)
Run configured diagnostics on parsed and repaired markup.
Bool TIDY_CALL tidyNodeIsH2(TidyNode tnod)
opaque_type(TidyDoc)
TidyAttr TIDY_CALL tidyAttrGetOnMOUSEOUT(TidyNode tnod)
Bool TIDY_CALL tidyNodeIsDIV(TidyNode tnod)
Bool TIDY_CALL tidyNodeIsHeader(TidyNode tnod)
Bool TIDY_CALL tidyNodeIsS(TidyNode tnod)
TidyAttr TIDY_CALL tidyAttrGetSTYLE(TidyNode tnod)
Bool TIDY_CALL tidyNodeIsSCRIPT(TidyNode tnod)
Bool TIDY_CALL tidyAttrIsHTTP_EQUIV(TidyAttr tattr)
TidyAttr TIDY_CALL tidyAttrGetABBR(TidyNode tnod)
Bool TIDY_CALL tidyNodeIsIFRAME(TidyNode tnod)
Bool TIDY_CALL tidyNodeIsBLOCKQUOTE(TidyNode tnod)
void TIDY_CALL tidyUngetByte(TidyInputSource *source, uint byteValue)
Helper: unget byte back to input source.
Bool TIDY_CALL tidyAttrIsSRC(TidyAttr tattr)
TidyReportLevel
Message severity level These TidyReportLevel are used throughout libtidy, but don't have associated l...
Definition: tidyenum.h:299
Bool TIDY_CALL tidyNodeIsCOL(TidyNode tnod)
int TIDY_CALL tidyDetectedHtmlVersion(TidyDoc tdoc)
Detected HTML version: 0, 2, 3 or 4.
Bool TIDY_CALL tidyAttrIsTITLE(TidyAttr tattr)
ctmbstr TIDY_CALL tidyOptGetDefault(TidyOption opt)
Get default value of given Option as a string.
void * sinkData
Output context.
Definition: tidy.h:616
TidyAttrId
Known HTML attributes.
Definition: tidyenum.h:516
TidyNode TIDY_CALL tidyGetBody(TidyDoc tdoc)
TidyNode TIDY_CALL tidyGetNext(TidyNode tnod)
TidyNodeType
Node types.
Definition: tidyenum.h:332
Bool TIDY_CALL tidyAttrIsVLINK(TidyAttr tattr)
Bool TIDY_CALL tidyNodeIsBIG(TidyNode tnod)
Bool(TIDY_CALL * TidyReportFilter)(TidyDoc tdoc, TidyReportLevel lvl, uint line, uint col, ctmbstr mssg)
Callback to filter messages by diagnostic level: info, warning, etc.
Definition: tidy.h:642
Bool TIDY_CALL tidyNodeIsSMALL(TidyNode tnod)
int TIDY_CALL tidySaveString(TidyDoc tdoc, tmbstr buffer, uint *buflen)
Save document to application buffer.
TidyAttr TIDY_CALL tidyAttrGetOnMOUSEMOVE(TidyNode tnod)
Bool TIDY_CALL tidyNodeIsAPPLET(TidyNode tnod)
Bool TIDY_CALL tidyNodeIsPRE(TidyNode tnod)
Bool TIDY_CALL tidyAttrIsCONTENT(TidyAttr tattr)
Bool TIDY_CALL tidyNodeIsHTML(TidyNode tnod)
void *TIDY_CALL * alloc(TidyAllocator *self, size_t nBytes)
Called to allocate a block of nBytes of memory.
int TIDY_CALL tidySaveSink(TidyDoc tdoc, TidyOutputSink *sink)
Save to given generic output sink.
Bool TIDY_CALL tidyNodeIsH1(TidyNode tnod)
TidyOption TIDY_CALL tidyGetNextOption(TidyDoc tdoc, TidyIterator *pos)
Get next Option.
int TIDY_CALL tidySetErrorSink(TidyDoc tdoc, TidyOutputSink *sink)
Set error sink to given generic sink.
TidyAttr TIDY_CALL tidyAttrGetISMAP(TidyNode tnod)
TidyAttr TIDY_CALL tidyAttrGetBGCOLOR(TidyNode tnod)
Bool TIDY_CALL tidyNodeIsSTYLE(TidyNode tnod)
TidyAttr TIDY_CALL tidyAttrGetSUMMARY(TidyNode tnod)
TidyAttr TIDY_CALL tidyAttrGetCONTENT(TidyNode tnod)
TidyTagId
Known HTML element types.
Definition: tidyenum.h:353
int TIDY_CALL tidySaveStdout(TidyDoc tdoc)
Save to standard output (FILE*)
Bool TIDY_CALL tidyAttrIsROWSPAN(TidyAttr tattr)
Bool TIDY_CALL tidyDetectedXhtml(TidyDoc tdoc)
Input is XHTML?
Bool TIDY_CALL tidyNodeIsLABEL(TidyNode tnod)
uint TIDY_CALL tidyGetByte(TidyInputSource *source)
Helper: get next byte from input source.
Bool TIDY_CALL tidyAttrIsXMLNS(TidyAttr tattr)
TidyIterator TIDY_CALL tidyOptGetDocLinksList(TidyDoc tdoc, TidyOption opt)
Iterate over a list of related options.
Bool TIDY_CALL tidySetPrettyPrinterCallback(TidyDoc tdoc, TidyPPProgress callback)
TidyAttr TIDY_CALL tidyAttrGetID(TidyNode tnod)
void TIDY_CALL tidySetAppData(TidyDoc tdoc, void *appData)
Let application store a chunk of data w/ each Tidy instance.
Bool TIDY_CALL tidyAttrIsOnCLICK(TidyAttr tattr)
TidyIterator TIDY_CALL tidyOptGetPickList(TidyOption opt)
Iterate over Option "pick list".
Bool TIDY_CALL tidyNodeIsFRAME(TidyNode tnod)
ctmbstr msg
Definition: tidy.h:186
Bool TIDY_CALL tidyAttrIsSUMMARY(TidyAttr tattr)
TidyDoc TIDY_CALL tidyCreateWithAllocator(TidyAllocator *allocator)
Create a Tidoc supplying the TidyAllocator.
Bool TIDY_CALL tidyNodeIsLI(TidyNode tnod)
Bool TIDY_CALL tidyAttrIsUSEMAP(TidyAttr tattr)
TidyAttr TIDY_CALL tidyAttrGetSRC(TidyNode tnod)
TidyPutByteFunc putByte
Pointer to "put byte" callback.
Definition: tidy.h:619
Bool TIDY_CALL tidyNodeHasText(TidyDoc tdoc, TidyNode tnod)
Bool TIDY_CALL tidySetReportFilter2(TidyDoc tdoc, TidyReportFilter2 filtCallback)
TidyAttr TIDY_CALL tidyAttrGetDATAFLD(TidyNode tnod)
TidyOutputSink - accepts raw bytes of output.
Definition: tidy.h:613
TidyAttr TIDY_CALL tidyAttrGetLONGDESC(TidyNode tnod)
Bool TIDY_CALL tidyAttrIsLINK(TidyAttr tattr)
Bool TIDY_CALL tidySetReportFilter(TidyDoc tdoc, TidyReportFilter filtCallback)
Give Tidy a filter callback to use.
int TIDY_CALL tidyStatus(TidyDoc tdoc)
Get status of current document.
Bool TIDY_CALL tidyNodeIsINPUT(TidyNode tnod)
Bool TIDY_CALL tidyNodeIsQ(TidyNode tnod)
TidyTagId TIDY_CALL tidyNodeGetId(TidyNode tnod)
Bool TIDY_CALL tidyOptSetBool(TidyDoc tdoc, TidyOptionId optId, Bool val)
Set Option value as a Boolean flag.
TidyOption TIDY_CALL tidyGetOptionByName(TidyDoc tdoc, ctmbstr optnam)
Lookup option by name.
int TIDY_CALL tidySetInCharEncoding(TidyDoc tdoc, ctmbstr encnam)
Set the input encoding for parsing markup.
void(TIDY_CALL *free)(TidyAllocator *self
Called to free a previously allocated block of memory.
Bool TIDY_CALL tidyAttrIsOnKEYPRESS(TidyAttr tattr)
ctmbstr TIDY_CALL tidyOptGetEncName(TidyDoc tdoc, TidyOptionId optId)
Get character encoding name.
Bool TIDY_CALL tidyAttrIsALINK(TidyAttr tattr)
TidyAttr TIDY_CALL tidyAttrGetCOLSPAN(TidyNode tnod)
Bool TIDY_CALL tidyOptDiffThanSnapshot(TidyDoc tdoc)
Any settings different than snapshot?
Bool TIDY_CALL tidyNodeIsText(TidyNode tnod)
Bool TIDY_CALL tidyNodeIsMETA(TidyNode tnod)
TidyAttr TIDY_CALL tidyAttrGetLANGUAGE(TidyNode tnod)
Bool TIDY_CALL tidyOptResetToSnapshot(TidyDoc tdoc)
Reset config settings to snapshot (after document processing)
TidyOptionId
Option IDs Used to get/set option values.
Definition: tidyenum.h:86
Bool TIDY_CALL tidyNodeIsI(TidyNode tnod)
int(TIDY_CALL * TidyGetByteFunc)(void *sourceData)
Input Callback: get next byte of input.
Definition: tidy.h:558
Bool TIDY_CALL tidyNodeIsXMP(TidyNode tnod)
void *TIDY_CALL tidyGetAppData(TidyDoc tdoc)
Get application data set previously.
Bool TIDY_CALL tidyAttrIsHREF(TidyAttr tattr)
TidyAttr TIDY_CALL tidyAttrGetFOR(TidyNode tnod)
void *(TIDY_CALL * TidyRealloc)(void *buf, size_t len)
Callback for "realloc" replacement.
Definition: tidy.h:232
TidyAttr TIDY_CALL tidyAttrGetHTTP_EQUIV(TidyNode tnod)
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.
void TIDY_CALL tidyRelease(TidyDoc tdoc)
Free all memory and release the TidyDoc.
TidyAttr TIDY_CALL tidyAttrGetNAME(TidyNode tnod)
void *TIDY_CALL * realloc(TidyAllocator *self, void *block, size_t nBytes)
Called to resize (grow, in general) a block of memory.
Bool TIDY_CALL tidyAttrIsProp(TidyAttr tattr)
int TIDY_CALL tidyParseString(TidyDoc tdoc, ctmbstr content)
Parse markup in given string.
void *(TIDY_CALL * TidyMalloc)(size_t len)
Callback for "malloc" replacement.
Definition: tidy.h:230
Bool TIDY_CALL tidyOptSnapshot(TidyDoc tdoc)
Take a snapshot of current config settings.
TidyOptionId TIDY_CALL tidyOptGetIdForName(ctmbstr optnam)
Get option ID by name.
TidyAttr TIDY_CALL tidyAttrGetOnCLICK(TidyNode tnod)
Bool TIDY_CALL tidyNodeIsNOFRAMES(TidyNode tnod)
Bool TIDY_CALL tidySetReportFilter3(TidyDoc tdoc, TidyReportFilter3 filtCallback)
FILE *TIDY_CALL tidySetErrorFile(TidyDoc tdoc, ctmbstr errfilnam)
Set error sink to named file.
Bool TIDY_CALL tidyAttrIsSELECTED(TidyAttr tattr)
Bool TIDY_CALL tidyOptGetDefaultBool(TidyOption opt)
Get default value of given Option as a Boolean value.
TidyAttr TIDY_CALL tidyAttrGetOnMOUSEOVER(TidyNode tnod)
Bool TIDY_CALL tidySetReallocCall(TidyRealloc frealloc)
Give Tidy a realloc() replacement.
Bool TIDY_CALL tidyFileExists(TidyDoc tdoc, ctmbstr filename)
Bool TIDY_CALL tidyAttrIsSTYLE(TidyAttr tattr)
TidyAttr TIDY_CALL tidyAttrGetCHECKED(TidyNode tnod)
Bool TIDY_CALL tidyAttrIsVALUE(TidyAttr tattr)
ctmbstr TIDY_CALL tidyOptGetNextPick(TidyOption opt, TidyIterator *pos)
Get next string value of Option "pick list".
Bool TIDY_CALL tidyAttrIsNAME(TidyAttr tattr)
TidyAttr TIDY_CALL tidyAttrGetVALUE(TidyNode tnod)
TidyAttr TIDY_CALL tidyAttrGetOnBLUR(TidyNode tnod)
Bool TIDY_CALL tidyAttrIsREL(TidyAttr tattr)
Bool TIDY_CALL tidyAttrIsTARGET(TidyAttr tattr)
Bool TIDY_CALL tidyDetectedGenericXml(TidyDoc tdoc)
Input is generic XML (not HTML or XHTML)?
TidyAttr TIDY_CALL tidyAttrGetOnFOCUS(TidyNode tnod)
void TIDY_CALL tidyAttrDiscard(TidyDoc itdoc, TidyNode tnod, TidyAttr tattr)
TidyAttr TIDY_CALL tidyAttrGetById(TidyNode tnod, TidyAttrId attId)
TidyNode TIDY_CALL tidyDiscardElement(TidyDoc tdoc, TidyNode tnod)
Bool TIDY_CALL tidyNodeIsISINDEX(TidyNode tnod)
Bool TIDY_CALL tidyNodeIsU(TidyNode tnod)
int TIDY_CALL tidySetErrorBuffer(TidyDoc tdoc, TidyBuffer *errbuf)
Set error sink to given buffer.
Bool TIDY_CALL tidyNodeIsNOBR(TidyNode tnod)
Bool TIDY_CALL tidyNodeIsDD(TidyNode tnod)
Bool TIDY_CALL tidyOptResetAllToDefault(TidyDoc tdoc)
Reset all options to their default values.
Bool TIDY_CALL tidyNodeIsHEAD(TidyNode tnod)
TidyNode TIDY_CALL tidyGetPrev(TidyNode tnod)
ctmbstr TIDY_CALL tidyOptGetNextDeclTag(TidyDoc tdoc, TidyOptionId optId, TidyIterator *iter)
Get next declared tag of specified type: TidyInlineTags, TidyBlockTags, TidyEmptyTags, TidyPreTags.
Bool TIDY_CALL tidyNodeIsPARAM(TidyNode tnod)
int TIDY_CALL tidyParseBuffer(TidyDoc tdoc, TidyBuffer *buf)
Parse markup in given buffer.
TidyAttr TIDY_CALL tidyAttrGetVLINK(TidyNode tnod)
Bool TIDY_CALL tidyOptGetBool(TidyDoc tdoc, TidyOptionId optId)
Get current Option value as a Boolean flag.
ulong TIDY_CALL tidyOptGetDefaultInt(TidyOption opt)
Get default value of given Option as an unsigned integer.
int TIDY_CALL tidySetOutCharEncoding(TidyDoc tdoc, ctmbstr encnam)
Set the output encoding.
Bool TIDY_CALL tidyNodeIsBASE(TidyNode tnod)
Bool TIDY_CALL tidyAttrIsHEIGHT(TidyAttr tattr)
void * sourceData
Input context.
Definition: tidy.h:575
Bool TIDY_CALL tidyNodeIsH6(TidyNode tnod)
Bool TIDY_CALL tidyNodeIsProp(TidyDoc tdoc, TidyNode tnod)
Bool TIDY_CALL tidyOptIsReadOnly(TidyOption opt)
Is Option read-only?
Bool TIDY_CALL tidyNodeIsEMBED(TidyNode tnod)
uint TIDY_CALL tidyNodeColumn(TidyNode tnod)
TidyAttr TIDY_CALL tidyAttrGetLINK(TidyNode tnod)
Bool TIDY_CALL tidyNodeIsCENTER(TidyNode tnod)
TidyNodeType TIDY_CALL tidyNodeGetType(TidyNode tnod)
ctmbstr TIDY_CALL tidyLibraryVersion(void)
Get version number for the current library.
TidyOption TIDY_CALL tidyOptGetNextDocLinks(TidyDoc tdoc, TidyIterator *pos)
Get next related option.
TidyAttr TIDY_CALL tidyAttrGetTARGET(TidyNode tnod)
Bool TIDY_CALL tidyNodeIsDL(TidyNode tnod)
Bool TIDY_CALL tidyAttrIsCOLSPAN(TidyAttr tattr)
Bool TIDY_CALL tidyNodeGetText(TidyDoc tdoc, TidyNode tnod, TidyBuffer *buf)
int TIDY_CALL tidyLoadConfigEnc(TidyDoc tdoc, ctmbstr configFile, ctmbstr charenc)
Load a Tidy configuration file with the specified character encoding.
Bool TIDY_CALL tidyNodeIsTABLE(TidyNode tnod)
int TIDY_CALL tidyReportDoctype(TidyDoc tdoc)
void(TIDY_CALL * TidyUngetByteFunc)(void *sourceData, byte bt)
Input Callback: unget a byte of input.
Definition: tidy.h:561
Bool TIDY_CALL tidyNodeIsTITLE(TidyNode tnod)
Bool TIDY_CALL tidyAttrIsOnMOUSEDOWN(TidyAttr tattr)
TidyEOFFunc eof
Pointer to "eof" callback.
Definition: tidy.h:580
Bool TIDY_CALL tidyAttrIsOnMOUSEOVER(TidyAttr tattr)
TidyAttr TIDY_CALL tidyAttrGetXMLNS(TidyNode tnod)
Bool TIDY_CALL tidyOptDiffThanDefault(TidyDoc tdoc)
Any settings different than default?
Bool TIDY_CALL tidyAttrIsBGCOLOR(TidyAttr tattr)
void(TIDY_CALL * TidyFree)(void *buf)
Callback for "free" replacement.
Definition: tidy.h:234
Bool TIDY_CALL tidyNodeIsIMG(TidyNode tnod)
Bool TIDY_CALL tidyNodeIsFRAMESET(TidyNode tnod)
Bool TIDY_CALL tidyOptSetValue(TidyDoc tdoc, TidyOptionId optId, ctmbstr val)
Set Option value as a string.
ctmbstr TIDY_CALL tidyOptGetName(TidyOption opt)
Get name of given Option.
An allocator.
Definition: tidy.h:225
Bool TIDY_CALL tidyNodeIsTEXTAREA(TidyNode tnod)
Bool TIDY_CALL tidyNodeIsOL(TidyNode tnod)
Bool TIDY_CALL tidySetMallocCall(TidyMalloc fmalloc)
Give Tidy a malloc() replacement.
ctmbstr TIDY_CALL tidyAttrName(TidyAttr tattr)
Opaque node datatype.
Bool TIDY_CALL tidyIsEOF(TidyInputSource *source)
Helper: check if input source at end.
Bool TIDY_CALL tidySetOptionCallback(TidyDoc tdoc, TidyOptCallback pOptCallback)
Bool TIDY_CALL tidyAttrIsWIDTH(TidyAttr tattr)
Bool TIDY_CALL tidyAttrIsOnFOCUS(TidyAttr tattr)
TidyAttr TIDY_CALL tidyAttrGetLANG(TidyNode tnod)
TidyNode TIDY_CALL tidyGetParent(TidyNode tnod)
Bool TIDY_CALL tidyAttrIsCHECKED(TidyAttr tattr)
TidyAttr TIDY_CALL tidyAttrGetOnKEYPRESS(TidyNode tnod)
An allocator's function table.
Definition: tidy.h:167
int TIDY_CALL tidyLoadConfig(TidyDoc tdoc, ctmbstr configFile)
Load an ASCII Tidy configuration file.
Bool TIDY_CALL tidyNodeIsLAYER(TidyNode tnod)
Bool TIDY_CALL tidyNodeIsSTRONG(TidyNode tnod)
Bool(TIDY_CALL * TidyEOFFunc)(void *sourceData)
Input Callback: is end of input?
Definition: tidy.h:564
TidyGetByteFunc getByte
Pointer to "get byte" callback.
Definition: tidy.h:578
Bool TIDY_CALL tidyNodeIsFONT(TidyNode tnod)
TidyConfigCategory
Categories of Tidy configuration options.
Definition: tidyenum.h:68
Bool TIDY_CALL tidyNodeIsOPTION(TidyNode tnod)
ctmbstr TIDY_CALL tidyNodeGetName(TidyNode tnod)
Bool TIDY_CALL tidyAttrIsOnBLUR(TidyAttr tattr)
int TIDY_CALL tidyOptSaveSink(TidyDoc tdoc, TidyOutputSink *sink)
Save current settings to given output sink.
void(TIDY_CALL * TidyPanic)(ctmbstr mssg)
Callback for "out of memory" panic state.
Definition: tidy.h:236
Bool TIDY_CALL tidyNodeIsCOLGROUP(TidyNode tnod)
Bool TIDY_CALL tidyAttrIsOnMOUSEOUT(TidyAttr tattr)
int TIDY_CALL tidySaveBuffer(TidyDoc tdoc, TidyBuffer *buf)
Save to given TidyBuffer object.
TidyConfigCategory TIDY_CALL tidyOptGetCategory(TidyOption opt)
Get category of given Option.
Bool TIDY_CALL tidyAttrIsTEXT(TidyAttr tattr)
Bool TIDY_CALL tidyNodeIsMAP(TidyNode tnod)
Bool TIDY_CALL tidyNodeIsMARQUEE(TidyNode tnod)
Bool TIDY_CALL tidyNodeIsNOSCRIPT(TidyNode tnod)
Bool TIDY_CALL tidySetFreeCall(TidyFree ffree)
Give Tidy a free() replacement.
TidyAttr TIDY_CALL tidyAttrGetREL(TidyNode tnod)
ctmbstr TIDY_CALL tidyOptGetDoc(TidyDoc tdoc, TidyOption opt)
Get option description.
int TIDY_CALL tidyCleanAndRepair(TidyDoc tdoc)
Execute configured cleanup and repair operations on parsed markup.
Bool TIDY_CALL tidyNodeIsTD(TidyNode tnod)
Bool TIDY_CALL tidyNodeIsBODY(TidyNode tnod)
Bool TIDY_CALL tidyOptSetInt(TidyDoc tdoc, TidyOptionId optId, ulong val)
Set Option value as an integer.
int TIDY_CALL tidyParseFile(TidyDoc tdoc, ctmbstr filename)
Parse markup in named file.
Bool TIDY_CALL tidyAttrIsEvent(TidyAttr tattr)
uint TIDY_CALL tidyConfigErrorCount(TidyDoc tdoc)
Number of Tidy configuration errors encountered.
TidyAttr TIDY_CALL tidyAttrGetOnMOUSEUP(TidyNode tnod)
TidyNode TIDY_CALL tidyGetRoot(TidyDoc tdoc)
Bool TIDY_CALL tidyNodeIsBASEFONT(TidyNode tnod)
void(TIDY_CALL * TidyPutByteFunc)(void *sinkData, byte bt)
Output callback: send a byte to output.
Definition: tidy.h:607
Bool(TIDY_CALL * TidyReportFilter3)(TidyDoc tdoc, TidyReportLevel lvl, uint line, uint col, ctmbstr code, va_list args)
Definition: tidy.h:648
uint TIDY_CALL tidyErrorCount(TidyDoc tdoc)
Number of Tidy errors encountered.
TidyIterator TIDY_CALL tidyGetOptionList(TidyDoc tdoc)
Get iterator for list of option.
uint TIDY_CALL tidyWarningCount(TidyDoc tdoc)
Number of Tidy warnings encountered.
Bool TIDY_CALL tidyAttrIsOnKEYUP(TidyAttr tattr)
TidyNode TIDY_CALL tidyGetChild(TidyNode tnod)
Bool TIDY_CALL tidyAttrIsOnKEYDOWN(TidyAttr tattr)
const TidyAllocatorVtbl * vtbl
Definition: tidy.h:226
Bool TIDY_CALL tidyNodeIsBR(TidyNode tnod)
TidyAttr TIDY_CALL tidyAttrGetOnKEYUP(TidyNode tnod)
TidyDoc TIDY_CALL tidyCreate(void)
The primary creation of a TidyDoc.
int TIDY_CALL tidyParseStdin(TidyDoc tdoc)
Parse markup from the standard input.
ulong TIDY_CALL tidyOptGetInt(TidyDoc tdoc, TidyOptionId optId)
Get current Option value as an integer.
TidyUngetByteFunc ungetByte
Pointer to "unget" callback.
Definition: tidy.h:579
Bool TIDY_CALL tidyAttrIsLONGDESC(TidyAttr tattr)
TidyAttr TIDY_CALL tidyAttrGetHREF(TidyNode tnod)
Bool(TIDY_CALL * TidyOptCallback)(ctmbstr option, ctmbstr value)
Applications using TidyLib may want to augment command-line and configuration file options...
Definition: tidy.h:421
TIDY_STRUCT struct _TidyInputSource TidyInputSource
TidyInputSource - Delivers raw bytes of input.
ctmbstr TIDY_CALL tidyOptGetCurrPick(TidyDoc tdoc, TidyOptionId optId)
Get current pick list value for option by ID.
Bool TIDY_CALL tidyAttrIsOnMOUSEMOVE(TidyAttr tattr)
void TIDY_CALL tidyGeneralInfo(TidyDoc tdoc)
Write more general information about markup to current error sink.
TidyAttr TIDY_CALL tidyAttrGetUSEMAP(TidyNode tnod)
void TIDY_CALL tidyErrorSummary(TidyDoc tdoc)
Write more complete information about errors to current error sink.
Bool TIDY_CALL tidyOptCopyConfig(TidyDoc tdocTo, TidyDoc tdocFrom)
Copy current configuration settings from one document to another.
Bool TIDY_CALL tidyNodeIsH4(TidyNode tnod)
TidyAttr TIDY_CALL tidyAttrNext(TidyAttr tattr)
Opaque document datatype.
Bool TIDY_CALL tidyInitSink(TidyOutputSink *sink, void *snkData, TidyPutByteFunc pbFunc)
Facilitates user defined sinks by providing an entry point to marshal pointers-to-functions.
Bool TIDY_CALL tidyNodeIsSELECT(TidyNode tnod)
Bool TIDY_CALL tidyAttrIsDATAFLD(TidyAttr tattr)
TidyAttr TIDY_CALL tidyAttrGetWIDTH(TidyNode tnod)
Bool TIDY_CALL tidyNodeIsHR(TidyNode tnod)
TidyAttr TIDY_CALL tidyAttrGetALT(TidyNode tnod)
Bool TIDY_CALL tidyNodeIsOBJECT(TidyNode tnod)
TidyAttr TIDY_CALL tidyAttrGetTYPE(TidyNode tnod)
TidyAttr TIDY_CALL tidyAttrFirst(TidyNode tnod)
uint TIDY_CALL tidyNodeLine(TidyNode tnod)
Bool TIDY_CALL tidyNodeIsA(TidyNode tnod)
void * block
Definition: tidy.h:175
ctmbstr TIDY_CALL tidyReleaseDate(void)
Get release date (version) for current library.
Bool TIDY_CALL tidyAttrIsALT(TidyAttr tattr)
Bool TIDY_CALL tidyAttrIsTYPE(TidyAttr tattr)
Bool TIDY_CALL tidyNodeIsSPACER(TidyNode tnod)
int TIDY_CALL tidySaveFile(TidyDoc tdoc, ctmbstr filename)
Save to named file.
Bool TIDY_CALL tidySetPanicCall(TidyPanic fpanic)
Give Tidy an "out of memory" handler.
TidyOption TIDY_CALL tidyGetOption(TidyDoc tdoc, TidyOptionId optId)
Lookup option by ID.
Bool TIDY_CALL tidyNodeIsDATALIST(TidyNode tnod)
Bool TIDY_CALL tidyNodeIsADDRESS(TidyNode tnod)
void TIDY_CALL tidyPutByte(TidyOutputSink *sink, uint byteValue)
Helper: send a byte to output.
Bool TIDY_CALL tidyNodeIsLISTING(TidyNode tnod)
TidyAttr TIDY_CALL tidyAttrGetROWSPAN(TidyNode tnod)
Bool TIDY_CALL tidyNodeIsMENU(TidyNode tnod)
TidyAttr TIDY_CALL tidyAttrGetALINK(TidyNode tnod)
Bool TIDY_CALL tidyNodeIsOPTGROUP(TidyNode tnod)
Opaque option datatype.
Opaque attribute datatype.
TidyOptionId TIDY_CALL tidyOptGetId(TidyOption opt)
Get ID of given Option.
TidyAttr TIDY_CALL tidyAttrGetOnMOUSEDOWN(TidyNode tnod)
int TIDY_CALL tidySetCharEncoding(TidyDoc tdoc, ctmbstr encnam)
Set the input/output character encoding for parsing markup.
Bool TIDY_CALL tidyNodeGetValue(TidyDoc tdoc, TidyNode tnod, TidyBuffer *buf)
Bool TIDY_CALL tidyNodeIsFORM(TidyNode tnod)
Bool TIDY_CALL tidyNodeIsTR(TidyNode tnod)
TidyBuffer - A chunk of memory.
Definition: tidybuffio.h:23
void(TIDY_CALL * TidyPPProgress)(TidyDoc tdoc, uint line, uint col, uint destLine)
Callback to track the progress of the pretting printing process.
Definition: tidy.h:675
Bool TIDY_CALL tidyOptParseValue(TidyDoc tdoc, ctmbstr optnam, ctmbstr val)
Set named Option value as a string.
TidyAttr TIDY_CALL tidyAttrGetSELECTED(TidyNode tnod)
Bool TIDY_CALL tidyNodeIsB(TidyNode tnod)
TidyAttr TIDY_CALL tidyAttrGetTITLE(TidyNode tnod)
Bool TIDY_CALL tidyNodeIsSPAN(TidyNode tnod)
Bool TIDY_CALL tidyNodeIsUL(TidyNode tnod)
TidyNode TIDY_CALL tidyGetHead(TidyDoc tdoc)
Bool TIDY_CALL tidyAttrIsLANGUAGE(TidyAttr tattr)
int TIDY_CALL tidyOptSaveFile(TidyDoc tdoc, ctmbstr cfgfil)
Save current settings to named file.
Bool TIDY_CALL tidyNodeIsP(TidyNode tnod)
Bool TIDY_CALL tidyNodeIsAREA(TidyNode tnod)
TidyInputSource - Delivers raw bytes of input.
Definition: tidy.h:572
TIDY_STRUCT struct _TidyOutputSink TidyOutputSink
TidyOutputSink - accepts raw bytes of output.
Bool TIDY_CALL tidyNodeIsWBR(TidyNode tnod)
Bool TIDY_CALL tidyNodeIsH3(TidyNode tnod)
ctmbstr TIDY_CALL tidyAttrValue(TidyAttr tattr)
Bool TIDY_CALL tidyNodeIsBLINK(TidyNode tnod)
Bool TIDY_CALL tidyNodeIsH5(TidyNode tnod)
Bool TIDY_CALL tidyNodeIsSTRIKE(TidyNode tnod)
Bool TIDY_CALL tidyNodeIsLINK(TidyNode tnod)
Bool TIDY_CALL tidyAttrIsLANG(TidyAttr tattr)
ctmbstr TIDY_CALL tidyOptGetValue(TidyDoc tdoc, TidyOptionId optId)
Get current Option value as a string.
Bool TIDY_CALL tidyAttrIsFOR(TidyAttr tattr)
Bool TIDY_CALL tidyAttrIsISMAP(TidyAttr tattr)
Bool TIDY_CALL tidyNodeIsDIR(TidyNode tnod)
Bool TIDY_CALL tidyAttrIsOnMOUSEUP(TidyAttr tattr)
Bool TIDY_CALL tidyNodeIsTH(TidyNode tnod)
TidyOptionType
Option data types.
Definition: tidyenum.h:223
Bool TIDY_CALL tidyNodeIsEM(TidyNode tnod)