@@ -157,7 +157,6 @@ static ParseProperty ParseList;
157157static ParseProperty ParseName ;
158158static ParseProperty ParseCSS1Selector ;
159159static ParseProperty ParseString ;
160- static ParseProperty ParseTagNames ;
161160static ParseProperty ParseCharEnc ;
162161static ParseProperty ParseDocType ;
163162static ParseProperty ParseTabs ;
@@ -173,13 +172,13 @@ static const TidyOptionImpl option_defs[] =
173172 { TidyAltText , MR , "alt-text" , ST , 0 , ParseString , NULL },
174173 { TidyAnchorAsName , MR , "anchor-as-name" , BL , yes , ParsePickList , & boolPicks },
175174 { TidyAsciiChars , ME , "ascii-chars" , BL , no , ParsePickList , & boolPicks },
176- { TidyBlockTags , MT , "new-blocklevel-tags" , ST , 0 , ParseTagNames , NULL },
175+ { TidyBlockTags , MT , "new-blocklevel-tags" , ST , 0 , ParseList , NULL },
177176 { TidyBodyOnly , DD , "show-body-only" , IN , no , ParsePickList , & autoBoolPicks },
178177 { TidyBreakBeforeBR , PP , "break-before-br" , BL , no , ParsePickList , & boolPicks },
179178 { TidyCharEncoding , CE , "char-encoding" , IN , UTF8 , ParseCharEnc , & charEncPicks },
180179 { TidyCoerceEndTags , MR , "coerce-endtags" , BL , yes , ParsePickList , & boolPicks },
181180 { TidyCSSPrefix , MR , "css-prefix" , ST , 0 , ParseCSS1Selector , NULL , "c" },
182- { TidyCustomTags , IR , "new-custom-tags" , ST , 0 , ParseTagNames , NULL }, /* 20170309 - Issue #119 */
181+ { TidyCustomTags , IR , "new-custom-tags" , ST , 0 , ParseList , NULL }, /* 20170309 - Issue #119 */
183182 { TidyDecorateInferredUL , MX , "decorate-inferred-ul" , BL , no , ParsePickList , & boolPicks },
184183 { TidyDoctype , DT , "doctype" , ST , 0 , ParseDocType , & doctypePicks },
185184#ifndef DOXYGEN_SHOULD_SKIP_THIS
@@ -193,7 +192,7 @@ static const TidyOptionImpl option_defs[] =
193192#ifndef DOXYGEN_SHOULD_SKIP_THIS
194193 { TidyEmacsFile , IR , "gnu-emacs-file" , ST , 0 , ParseString , NULL },
195194#endif
196- { TidyEmptyTags , MT , "new-empty-tags" , ST , 0 , ParseTagNames , NULL },
195+ { TidyEmptyTags , MT , "new-empty-tags" , ST , 0 , ParseList , NULL },
197196 { TidyEncloseBlockText , MR , "enclose-block-text" , BL , no , ParsePickList , & boolPicks },
198197 { TidyEncloseBodyText , MR , "enclose-text" , BL , no , ParsePickList , & boolPicks },
199198 { TidyErrFile , IO , "error-file" , ST , 0 , ParseString , NULL },
@@ -211,7 +210,7 @@ static const TidyOptionImpl option_defs[] =
211210 { TidyIndentCdata , PP , "indent-cdata" , BL , no , ParsePickList , & boolPicks },
212211 { TidyIndentContent , PP , "indent" , IN , TidyNoState , ParsePickList , & autoBoolPicks },
213212 { TidyIndentSpaces , PP , "indent-spaces" , IN , 2 , ParseInt , NULL },
214- { TidyInlineTags , MT , "new-inline-tags" , ST , 0 , ParseTagNames , NULL },
213+ { TidyInlineTags , MT , "new-inline-tags" , ST , 0 , ParseList , NULL },
215214 { TidyJoinClasses , MX , "join-classes" , BL , no , ParsePickList , & boolPicks },
216215 { TidyJoinStyles , MX , "join-styles" , BL , yes , ParsePickList , & boolPicks },
217216 { TidyKeepFileTimes , IO , "keep-time" , BL , no , ParsePickList , & boolPicks },
@@ -234,7 +233,7 @@ static const TidyOptionImpl option_defs[] =
234233 { TidyOutputBOM , CE , "output-bom" , IN , TidyAutoState , ParsePickList , & autoBoolPicks },
235234 { TidyPPrintTabs , PP , "indent-with-tabs" , BL , no , ParseTabs , & boolPicks }, /* 20150515 - Issue #108 */
236235 { TidyPreserveEntities , ME , "preserve-entities" , BL , no , ParsePickList , & boolPicks },
237- { TidyPreTags , MT , "new-pre-tags" , ST , 0 , ParseTagNames , NULL },
236+ { TidyPreTags , MT , "new-pre-tags" , ST , 0 , ParseList , NULL },
238237 { TidyPriorityAttributes , PP , "priority-attributes" , ST , 0 , ParseList , NULL },
239238 { TidyPunctWrap , PP , "punctuation-wrap" , BL , no , ParsePickList , & boolPicks },
240239 { TidyQuiet , DD , "quiet" , BL , no , ParsePickList , & boolPicks },
@@ -292,7 +291,7 @@ static const struct {
292291 ctmbstr name ; /**< name of the deprecated option */
293292 TidyOptionId replacementId ; /**< Id of the replacement option, or 0 if none. */
294293} deprecatedOptions [] = {
295- // { "show-body-only", TidyBodyOnly },
294+ /* { "show-body-only", TidyBodyOnly }, */
296295 { NULL }
297296};
298297
@@ -980,7 +979,7 @@ Bool TY_(ParseConfigOption)( TidyDocImpl* doc, ctmbstr optnam, ctmbstr optval )
980979 if (NULL != doc -> pOptCallback )
981980 status = (* doc -> pOptCallback )( optnam , optval );
982981 if (NULL != doc -> pConfigCallback )
983- status = status && (* doc -> pConfigCallback )( tidyImplToDoc (doc ), optnam , optval );
982+ status = status || (* doc -> pConfigCallback )( tidyImplToDoc (doc ), optnam , optval );
984983 if (!status && isDeprecated )
985984 status = subDeprecatedOption ( doc , optnam , optval );
986985 if (!status )
@@ -1195,6 +1194,14 @@ void TY_(DeclareListItem)( TidyDocImpl* doc, const TidyOptionImpl* opt, ctmbstr
11951194 TY_ (DefineMutedMessage )( doc , opt , name );
11961195 break ;
11971196
1197+ case TidyInlineTags :
1198+ case TidyBlockTags :
1199+ case TidyEmptyTags :
1200+ case TidyPreTags :
1201+ case TidyCustomTags :
1202+ TY_ (DeclareUserTag )( doc , opt , name );
1203+ break ;
1204+
11981205 default :
11991206 break ;
12001207 }
@@ -1438,115 +1445,6 @@ Bool ParseTabs( TidyDocImpl* doc, const TidyOptionImpl* entry )
14381445}
14391446
14401447
1441- /* Coordinates Config update and Tags data */
1442- void TY_ (DeclareUserTag )( TidyDocImpl * doc , TidyOptionId optId ,
1443- UserTagType tagType , ctmbstr name )
1444- {
1445- ctmbstr prvval = cfgStr ( doc , optId );
1446- tmbstr catval = NULL ;
1447- ctmbstr theval = name ;
1448- if ( prvval )
1449- {
1450- uint len = TY_ (tmbstrlen )(name ) + TY_ (tmbstrlen )(prvval ) + 3 ;
1451- catval = TY_ (tmbstrndup )( doc -> allocator , prvval , len );
1452- TY_ (tmbstrcat )( catval , ", " );
1453- TY_ (tmbstrcat )( catval , name );
1454- theval = catval ;
1455- }
1456- TY_ (DefineTag )( doc , tagType , name );
1457- SetOptionValue ( doc , optId , theval );
1458- if ( catval )
1459- TidyDocFree ( doc , catval );
1460- }
1461-
1462-
1463- /* a space or comma separated list of tag names */
1464- Bool ParseTagNames ( TidyDocImpl * doc , const TidyOptionImpl * option )
1465- {
1466- TidyConfigImpl * cfg = & doc -> config ;
1467- tmbchar buf [1024 ];
1468- uint i = 0 , nTags = 0 ;
1469- uint c = SkipWhite ( cfg );
1470- UserTagType ttyp = tagtype_null ;
1471-
1472- switch ( option -> id )
1473- {
1474- case TidyInlineTags : ttyp = tagtype_inline ; break ;
1475- case TidyBlockTags : ttyp = tagtype_block ; break ;
1476- case TidyEmptyTags : ttyp = tagtype_empty ; break ;
1477- case TidyPreTags : ttyp = tagtype_pre ; break ;
1478- case TidyCustomTags : ttyp = cfg (doc , TidyUseCustomTags ); break ;
1479- default :
1480- TY_ (ReportUnknownOption )( doc , option -> name );
1481- return no ;
1482- }
1483-
1484- SetOptionValue ( doc , option -> id , NULL );
1485- TY_ (FreeDeclaredTags )( doc , ttyp );
1486- cfg -> defined_tags |= ttyp ;
1487-
1488- do
1489- {
1490- if (c == ' ' || c == '\t' || c == ',' )
1491- {
1492- c = AdvanceChar ( cfg );
1493- continue ;
1494- }
1495-
1496- if ( c == '\r' || c == '\n' )
1497- {
1498- uint c2 = AdvanceChar ( cfg );
1499- if ( c == '\r' && c2 == '\n' )
1500- c = AdvanceChar ( cfg );
1501- else
1502- c = c2 ;
1503-
1504- if ( !TY_ (IsWhite )(c ) )
1505- {
1506- buf [i ] = 0 ;
1507- TY_ (UngetChar )( c , cfg -> cfgIn );
1508- TY_ (UngetChar )( '\n' , cfg -> cfgIn );
1509- break ;
1510- }
1511- }
1512-
1513- /*
1514- if ( c == '\n' )
1515- {
1516- c = AdvanceChar( cfg );
1517- if ( !TY_(IsWhite)(c) )
1518- {
1519- buf[i] = 0;
1520- TY_(UngetChar)( c, cfg->cfgIn );
1521- TY_(UngetChar)( '\n', cfg->cfgIn );
1522- break;
1523- }
1524- }
1525- */
1526-
1527- while ( i < sizeof (buf )- 2 && c != EndOfStream && !TY_ (IsWhite )(c ) && c != ',' )
1528- {
1529- buf [i ++ ] = (tmbchar ) c ;
1530- c = AdvanceChar ( cfg );
1531- }
1532-
1533- buf [i ] = '\0' ;
1534- if (i == 0 ) /* Skip empty tag definition. Possible when */
1535- continue ; /* there is a trailing space on the line. */
1536-
1537- /* add tag to dictionary */
1538- TY_ (DeclareUserTag )( doc , option -> id , ttyp , buf );
1539- i = 0 ;
1540- ++ nTags ;
1541- }
1542- while ( c != EndOfStream );
1543-
1544- if ( i > 0 )
1545- TY_ (DeclareUserTag )( doc , option -> id , ttyp , buf );
1546- return ( nTags > 0 );
1547- }
1548-
1549-
15501448/* a string including whitespace */
15511449/* munges whitespace sequences */
15521450Bool ParseString ( TidyDocImpl * doc , const TidyOptionImpl * option )
0 commit comments