From d942983fb00f0e842d238987dc7ba8d0c60463cf Mon Sep 17 00:00:00 2001 From: Steven Le Date: Fri, 22 Jun 2012 10:35:43 -0700 Subject: [PATCH 1/4] Remove WbrToSpace since is HTML5 valid. --- src/tidylib.c | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/src/tidylib.c b/src/tidylib.c index 0ff8cd6..a1ce78f 100644 --- a/src/tidylib.c +++ b/src/tidylib.c @@ -5,19 +5,19 @@ CVS Info : - $Author: arnaud02 $ - $Date: 2008/06/18 20:18:54 $ - $Revision: 1.75 $ + $Author: arnaud02 $ + $Date: 2008/06/18 20:18:54 $ + $Revision: 1.75 $ Defines HTML Tidy API implemented by tidy library. - + Very rough initial cut for discussion purposes. Public interface is const-correct and doesn't explicitly depend on any globals. Thus, thread-safety may be introduced w/out changing the interface. - Looking ahead to a C++ wrapper, C functions always pass + Looking ahead to a C++ wrapper, C functions always pass this-equivalent as 1st arg. Created 2001-05-20 by Charles Reitzel @@ -117,7 +117,7 @@ TidyOption tidyImplToOption( const TidyOptionImpl* option ) ** 0 -> SUCCESS ** >0 -> WARNING ** <0 -> ERROR -** +** */ TidyDoc TIDY_CALL tidyCreate(void) @@ -628,8 +628,8 @@ Bool TIDY_CALL tidyOptCopyConfig( TidyDoc to, TidyDoc from ) /* I/O and Message handling interface ** -** By default, Tidy will define, create and use -** tdocances of input and output handlers for +** By default, Tidy will define, create and use +** tdocances of input and output handlers for ** standard C buffered I/O (i.e. FILE* stdin, ** FILE* stdout and FILE* stderr for content ** input, content output and diagnostic output, @@ -639,7 +639,7 @@ Bool TIDY_CALL tidyOptCopyConfig( TidyDoc to, TidyDoc from ) */ /* Use TidyReportFilter to filter messages by diagnostic level: -** info, warning, etc. Just set diagnostic output +** info, warning, etc. Just set diagnostic output ** handler to redirect all diagnostics output. Return true ** to proceed with output, false to cancel. */ @@ -798,7 +798,7 @@ uint TIDY_CALL tidyConfigErrorCount( TidyDoc tdoc ) } -/* Error reporting functions +/* Error reporting functions */ void TIDY_CALL tidyErrorSummary( TidyDoc tdoc ) { @@ -974,7 +974,7 @@ int tidyDocSaveFile( TidyDocImpl* doc, ctmbstr filnam ) if ( doc->errors > 0 && cfgBool(doc, TidyWriteBack) && !cfgBool(doc, TidyForceOutput) ) status = tidyDocStatus( doc ); - else + else fout = fopen( filnam, "wb" ); if ( fout ) @@ -1008,7 +1008,7 @@ int tidyDocSaveFile( TidyDocImpl* doc, ctmbstr filnam ) ** The code has been left in in case it works w/ other compilers ** or operating systems. If stdout is in Text mode, be aware that ** it will garble UTF16 documents. In text mode, when it encounters -** a single byte of value 10 (0xA), it will insert a single byte +** a single byte of value 10 (0xA), it will insert a single byte ** value 13 (0xD) just before it. This has the effect of garbling ** the entire document. */ @@ -1073,7 +1073,7 @@ int tidyDocSaveString( TidyDocImpl* doc, tmbstr buffer, uint* buflen ) TidyBuffer outbuf; StreamOut* out; int status; - + tidyBufInitWithAllocator( &outbuf, doc->allocator ); out = TY_(BufferOutput)( doc, &outbuf, outenc, nl ); status = tidyDocSaveStream( doc, out ); @@ -1097,7 +1097,7 @@ int tidyDocSaveBuffer( TidyDocImpl* doc, TidyBuffer* outbuf ) uint outenc = cfg( doc, TidyOutCharEncoding ); uint nl = cfg( doc, TidyNewline ); StreamOut* out = TY_(BufferOutput)( doc, outbuf, outenc, nl ); - + status = tidyDocSaveStream( doc, out ); TidyDocFree( doc, out ); } @@ -1144,7 +1144,7 @@ int TIDY_CALL tidyRunDiagnostics( TidyDoc tdoc ) /* Workhorse functions. ** -** Parse requires input source, all input config items +** Parse requires input source, all input config items ** and diagnostic sink to have all been set before calling. ** ** Emit likewise requires that document sink and all @@ -1226,7 +1226,7 @@ int tidyDocRunDiagnostics( TidyDocImpl* doc ) TY_(ReportMarkupVersion)( doc ); TY_(ReportNumWarnings)( doc ); } - + if ( doc->errors > 0 && !force ) TY_(NeedsAuthorIntervention)( doc ); @@ -1396,7 +1396,6 @@ int tidyDocSaveStream( TidyDocImpl* doc, StreamOut* out ) { /* noop */ TY_(DropFontElements)(doc, &doc->root, NULL); - TY_(WbrToSpace)(doc, &doc->root); } if ((makeClean && asciiChars) || makeBare) @@ -1447,8 +1446,8 @@ int tidyDocSaveStream( TidyDocImpl* doc, StreamOut* out ) ** ** The big issue here is the degree to which we should mimic ** a DOM and/or SAX nodes. -** -** Is it 100% possible (and, if so, how difficult is it) to +** +** Is it 100% possible (and, if so, how difficult is it) to ** emit SAX events from this API? If SAX events are possible, ** is that 100% of data needed to build a DOM? */ @@ -1579,7 +1578,7 @@ Bool TIDY_CALL tidyNodeGetText( TidyDoc tdoc, TidyNode tnod, TidyBuffer* outbuf TY_(PFlushLine)( doc, 0 ); doc->docOut = NULL; - + TidyDocFree( doc, out ); return yes; } From 046a40da34a02849730d44d3a7c2bed5962e1605 Mon Sep 17 00:00:00 2001 From: John Weldon Date: Tue, 3 Jul 2012 12:10:53 -0700 Subject: [PATCH 2/4] Fix tidylib.obj : error LNK2019: unresolved external symbol _prvTidyCleanGoogleDocument referenced in function _tidyDocCleanAndRepair --- src/tidylib.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/tidylib.c b/src/tidylib.c index 6e41410..6803b26 100644 --- a/src/tidylib.c +++ b/src/tidylib.c @@ -1281,8 +1281,10 @@ int tidyDocCleanAndRepair( TidyDocImpl* doc ) TY_(CleanDocument)( doc ); /* clean up html exported by Google Focs */ +#if 0 if ( gdoc ) TY_(CleanGoogleDocument)( doc ); +#endif /* Move terminating
tags from out of paragraphs */ /*! Do we want to do this for all block-level elements? */ From ca623c911683a6b5840447f24eb1b2b9fbed01f6 Mon Sep 17 00:00:00 2001 From: John Weldon Date: Tue, 3 Jul 2012 12:11:26 -0700 Subject: [PATCH 3/4] more msvc ignores --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 83177cb..8f086cb 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,8 @@ /build/msvc2010/Releasetidydll/ /build/msvc2010/Releasetidylib/ /build/msvc2010/Release/ +/build/msvc2010/ipch/ +/build/msvc2010/tidy.opensdf /htmldoc/tidy-config.xml /htmldoc/tidy-help.xml /htmldoc/tidy.1 From 46e8e9d2547e4da68d6a62597b71563a8755a7f5 Mon Sep 17 00:00:00 2001 From: John Weldon Date: Thu, 12 Jul 2012 10:41:05 -0700 Subject: [PATCH 4/4] Better fix than 0d41d42, the gdoc.(c|h) files weren't included in the msvc2010 project --- build/msvc2010/tidydll.vcxproj | 9 ++++++++- build/msvc2010/tidylib.vcxproj | 10 +++++++++- src/tidylib.c | 2 +- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/build/msvc2010/tidydll.vcxproj b/build/msvc2010/tidydll.vcxproj index 7dcaf64..7d77b5c 100644 --- a/build/msvc2010/tidydll.vcxproj +++ b/build/msvc2010/tidydll.vcxproj @@ -273,6 +273,12 @@ %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + @@ -302,8 +308,9 @@ + - \ No newline at end of file + diff --git a/build/msvc2010/tidylib.vcxproj b/build/msvc2010/tidylib.vcxproj index f855c05..7116907 100644 --- a/build/msvc2010/tidylib.vcxproj +++ b/build/msvc2010/tidylib.vcxproj @@ -270,6 +270,13 @@ %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(UndefinePreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + @@ -296,8 +303,9 @@ + - \ No newline at end of file + diff --git a/src/tidylib.c b/src/tidylib.c index 6803b26..2140ca6 100644 --- a/src/tidylib.c +++ b/src/tidylib.c @@ -1281,7 +1281,7 @@ int tidyDocCleanAndRepair( TidyDocImpl* doc ) TY_(CleanDocument)( doc ); /* clean up html exported by Google Focs */ -#if 0 +#if 1 if ( gdoc ) TY_(CleanGoogleDocument)( doc ); #endif