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