Skip to content

Commit 66de84b

Browse files
committed
- Add support for the is attribute.
- Add support for autonomous custom elements.
1 parent 96bb670 commit 66de84b

21 files changed

+734
-210
lines changed

console/tidy.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -610,12 +610,10 @@ void GetOption( TidyDoc tdoc, TidyOption topt, OptionDesc *d )
610610
case TidySortAttributes:
611611
case TidyNewline:
612612
case TidyAccessibilityCheckLevel:
613+
case TidyUseCustomTags:
613614
d->type = "enum";
614615
d->vals = NULL;
615-
d->def =
616-
optId==TidyNewline ?
617-
"<em>Platform dependent</em>"
618-
:tidyOptGetCurrPick( tdoc, optId );
616+
d->def = tidyOptGetCurrPick( tdoc, optId );
619617
break;
620618

621619
case TidyDoctype:
@@ -648,7 +646,7 @@ void GetOption( TidyDoc tdoc, TidyOption topt, OptionDesc *d )
648646
d->def = "?";
649647
d->vals = NULL;
650648
break;
651-
649+
652650
/* General case will handle remaining */
653651
default:
654652
switch ( optTyp )
@@ -1376,9 +1374,6 @@ static void printOptionValues( TidyDoc ARG_UNUSED(tdoc), TidyOption topt,
13761374
}
13771375
}
13781376
break;
1379-
case TidyNewline:
1380-
d->def = tidyOptGetCurrPick( tdoc, optId );
1381-
break;
13821377
default:
13831378
break;
13841379
}

include/tidy.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -463,10 +463,16 @@ TIDY_EXPORT ctmbstr TIDY_CALL tidyOptGetEncName( TidyDoc tdoc, TidyOptionI
463463
/** Get current pick list value for option by ID. Useful for enum types. */
464464
TIDY_EXPORT ctmbstr TIDY_CALL tidyOptGetCurrPick( TidyDoc tdoc, TidyOptionId optId);
465465

466-
/** Iterate over user declared tags */
466+
/** Iterate over user declared tags as configured. If `custom-tags` is not
467+
** **no**, then autonomous custom tags will be included in the results.
468+
*/
467469
TIDY_EXPORT TidyIterator TIDY_CALL tidyOptGetDeclTagList( TidyDoc tdoc );
468470
/** Get next declared tag of specified type: TidyInlineTags, TidyBlockTags,
469-
** TidyEmptyTags, TidyPreTags */
471+
** TidyEmptyTags, TidyPreTags. Note that even when using `custom-tags`,
472+
** TidyCustomTags is not an option here, as autonomous custom tags are
473+
** added to one of the existing types, and TidyCustomTags is defined as
474+
** internal API.
475+
*/
470476
TIDY_EXPORT ctmbstr TIDY_CALL tidyOptGetNextDeclTag( TidyDoc tdoc,
471477
TidyOptionId optId,
472478
TidyIterator* iter );

include/tidyenum.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ typedef enum
7070
TidyCharEncoding, /**< In/out character encoding */
7171
TidyCoerceEndTags, /**< Coerce end tags from start tags where probably intended */
7272
TidyCSSPrefix, /**< CSS class naming for clean option */
73+
TidyCustomTags, /**< Enable Tidy to use autonomous custom tags */
7374
TidyDecorateInferredUL, /**< Mark inferred UL elements with no indent CSS */
7475
TidyDoctype, /**< User specified doctype */
7576
#ifndef DOXYGEN_SHOULD_SKIP_THIS
@@ -154,6 +155,9 @@ typedef enum
154155
TidyTabSize, /**< Expand tabs to n spaces */
155156
TidyUpperCaseAttrs, /**< Output attributes in upper not lower case */
156157
TidyUpperCaseTags, /**< Output tags in upper not lower case */
158+
#ifndef DOXYGEN_SHOULD_SKIP_THIS
159+
TidyUseCustomTags, /**< Internal use ONLY */
160+
#endif
157161
TidyVertSpace, /**< degree to which markup is spread out vertically */
158162
TidyWord2000, /**< Draconian cleaning for Word2000 */
159163
TidyWrapAsp, /**< Wrap within ASP pseudo elements */
@@ -193,6 +197,19 @@ typedef enum
193197
TidyAutoState /**< Automatic */
194198
} TidyTriState;
195199

200+
/** Integer values used by ParseUseCustomTags. These are used throughout
201+
* LibTidy to indicate the how Tidy treats custom tags, and also have
202+
* associated localized strings to describe them.
203+
*/
204+
typedef enum
205+
{
206+
TidyCustomNo = 300,
207+
TidyCustomBlocklevel,
208+
TidyCustomEmpty,
209+
TidyCustomInline,
210+
TidyCustomPre
211+
} TidyUseCustomTagsState;
212+
196213
/** TidyNewline option values to control output line endings.
197214
*/
198215
typedef enum
@@ -531,6 +548,7 @@ typedef enum
531548
TidyAttr_HSPACE, /**< HSPACE= */
532549
TidyAttr_HTTP_EQUIV, /**< HTTP_EQUIV= */
533550
TidyAttr_ID, /**< ID= */
551+
TidyAttr_IS, /**< IS= */
534552
TidyAttr_ISMAP, /**< ISMAP= */
535553
TidyAttr_ITEMID, /**< ITEMID= */
536554
TidyAttr_ITEMPROP, /**< ITEMPROP= */
@@ -889,6 +907,7 @@ typedef enum
889907
FN(OBSOLETE_ELEMENT) \
890908
FN(PROPRIETARY_ELEMENT) \
891909
FN(REPLACING_ELEMENT) \
910+
FN(CUSTOM_TAG_DETECTED) \
892911
FN(REPLACING_UNEX_ELEMENT) \
893912
FN(SPACE_PRECEDING_XMLDECL) \
894913
FN(SUSPECTED_MISSING_QUOTE) \
@@ -922,6 +941,7 @@ typedef enum
922941
FN(JOINING_ATTRIBUTE) \
923942
FN(MISMATCHED_ATTRIBUTE_ERROR) \
924943
FN(MISMATCHED_ATTRIBUTE_WARN) \
944+
FN(ATTRIBUTE_IS_NOT_ALLOWED) \
925945
FN(MISSING_ATTR_VALUE) \
926946
FN(MISSING_ATTRIBUTE) \
927947
FN(MISSING_IMAGEMAP) \

0 commit comments

Comments
 (0)