Merge branch 'master' into attrdict_phase1
Bump version to 5.1.38
This commit is contained in:
commit
3431dd05a4
|
@ -336,6 +336,9 @@ set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "http://www.html-tidy.org/")
|
||||||
#set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc")
|
#set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc")
|
||||||
set(CPACK_DEBIAN_PACKAGE_SECTION "Libraries")
|
set(CPACK_DEBIAN_PACKAGE_SECTION "Libraries")
|
||||||
|
|
||||||
|
## RPM config
|
||||||
|
set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/usr/share/man" "/usr/share/man/man1")
|
||||||
|
|
||||||
set(CPACK_SOURCE_IGNORE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/test/;${CMAKE_CURRENT_SOURCE_DIR}/build/;${CMAKE_CURRENT_SOURCE_DIR}/.git/")
|
set(CPACK_SOURCE_IGNORE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/test/;${CMAKE_CURRENT_SOURCE_DIR}/build/;${CMAKE_CURRENT_SOURCE_DIR}/.git/")
|
||||||
|
|
||||||
if (NOT WIN32 AND NOT APPLE)
|
if (NOT WIN32 AND NOT APPLE)
|
||||||
|
|
|
@ -744,9 +744,13 @@ TIDY_EXPORT int TIDY_CALL tidySaveStdout( TidyDoc tdoc );
|
||||||
/** Save to given TidyBuffer object */
|
/** Save to given TidyBuffer object */
|
||||||
TIDY_EXPORT int TIDY_CALL tidySaveBuffer( TidyDoc tdoc, TidyBuffer* buf );
|
TIDY_EXPORT int TIDY_CALL tidySaveBuffer( TidyDoc tdoc, TidyBuffer* buf );
|
||||||
|
|
||||||
/** Save document to application buffer. If buffer is not big enough,
|
/** Save document to application buffer. If TidyShowMarkup and
|
||||||
** ENOMEM will be returned and the necessary buffer size will be placed
|
** the document has no errors, or TidyForceOutput, the current
|
||||||
** in *buflen.
|
** document, per the current configuration, will be Pretty Printed
|
||||||
|
** to the application buffer. The document byte length,
|
||||||
|
** not character length, will be placed in *buflen. The document
|
||||||
|
** will not be null terminated. If the buffer is not big enough,
|
||||||
|
** ENOMEM will be returned, else the actual document status.
|
||||||
*/
|
*/
|
||||||
TIDY_EXPORT int TIDY_CALL tidySaveString( TidyDoc tdoc,
|
TIDY_EXPORT int TIDY_CALL tidySaveString( TidyDoc tdoc,
|
||||||
tmbstr buffer, uint* buflen );
|
tmbstr buffer, uint* buflen );
|
||||||
|
|
11
src/istack.c
11
src/istack.c
|
@ -10,6 +10,9 @@
|
||||||
#include "attrs.h"
|
#include "attrs.h"
|
||||||
#include "streamio.h"
|
#include "streamio.h"
|
||||||
#include "tmbstr.h"
|
#include "tmbstr.h"
|
||||||
|
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||||
|
#include "sprtf.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
/* duplicate attributes */
|
/* duplicate attributes */
|
||||||
AttVal *TY_(DupAttrs)( TidyDocImpl* doc, AttVal *attrs)
|
AttVal *TY_(DupAttrs)( TidyDocImpl* doc, AttVal *attrs)
|
||||||
|
@ -115,6 +118,7 @@ static void PopIStack( TidyDocImpl* doc )
|
||||||
TY_(FreeAttribute)( doc, av );
|
TY_(FreeAttribute)( doc, av );
|
||||||
}
|
}
|
||||||
TidyDocFree(doc, istack->element);
|
TidyDocFree(doc, istack->element);
|
||||||
|
istack->element = NULL; /* remove the freed element */
|
||||||
}
|
}
|
||||||
|
|
||||||
static void PopIStackUntil( TidyDocImpl* doc, TidyTagId tid )
|
static void PopIStackUntil( TidyDocImpl* doc, TidyTagId tid )
|
||||||
|
@ -267,9 +271,12 @@ Node *TY_(InsertedToken)( TidyDocImpl* doc )
|
||||||
node->end = lexer->txtend; /* was : lexer->txtstart; */
|
node->end = lexer->txtend; /* was : lexer->txtstart; */
|
||||||
istack = lexer->insert;
|
istack = lexer->insert;
|
||||||
|
|
||||||
#if 0 && defined(_DEBUG)
|
/* #if 0 && defined(_DEBUG) */
|
||||||
|
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||||
if ( lexer->istacksize == 0 )
|
if ( lexer->istacksize == 0 )
|
||||||
fprintf( stderr, "0-size istack!\n" );
|
{
|
||||||
|
SPRTF( "WARNING: ZERO sized istack!\n" );
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
node->element = TY_(tmbstrdup)(doc->allocator, istack->element);
|
node->element = TY_(tmbstrdup)(doc->allocator, istack->element);
|
||||||
|
|
70
src/lexer.c
70
src/lexer.c
|
@ -52,7 +52,7 @@
|
||||||
static void check_me(char *name);
|
static void check_me(char *name);
|
||||||
static Bool show_attrs = yes;
|
static Bool show_attrs = yes;
|
||||||
#define MX_TXT 8
|
#define MX_TXT 8
|
||||||
static char buffer[MX_TXT+8]; /* NOTE extra for '...'\0 tail */
|
static char buffer[(MX_TXT*4)+8]; /* NOTE extra for '...'\0 tail */
|
||||||
static tmbstr get_text_string(Lexer* lexer, Node *node)
|
static tmbstr get_text_string(Lexer* lexer, Node *node)
|
||||||
{
|
{
|
||||||
uint len = node->end - node->start;
|
uint len = node->end - node->start;
|
||||||
|
@ -61,13 +61,14 @@ static tmbstr get_text_string(Lexer* lexer, Node *node)
|
||||||
unsigned char c;
|
unsigned char c;
|
||||||
uint i = 0;
|
uint i = 0;
|
||||||
Bool insp = no;
|
Bool insp = no;
|
||||||
buffer[0] = (char)0;
|
if (len <= ((MX_TXT * 2) + 3)) {
|
||||||
|
buffer[0] = 0;
|
||||||
while (cp < end) {
|
while (cp < end) {
|
||||||
c = *cp;
|
c = *cp;
|
||||||
|
cp++;
|
||||||
if (c == '\n') {
|
if (c == '\n') {
|
||||||
buffer[i++] = '\\';
|
buffer[i++] = '\\';
|
||||||
buffer[i++] = 'n';
|
buffer[i++] = 'n';
|
||||||
insp = yes;
|
|
||||||
} else if ( c == ' ' ) {
|
} else if ( c == ' ' ) {
|
||||||
if (!insp)
|
if (!insp)
|
||||||
buffer[i++] = c;
|
buffer[i++] = c;
|
||||||
|
@ -76,16 +77,58 @@ static tmbstr get_text_string(Lexer* lexer, Node *node)
|
||||||
buffer[i++] = c;
|
buffer[i++] = c;
|
||||||
insp = no;
|
insp = no;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
char *end1 = cp + MX_TXT;
|
||||||
|
char *bgn = cp + (len - MX_TXT);
|
||||||
|
buffer[0] = 0;
|
||||||
|
if (bgn < end1)
|
||||||
|
bgn = end1;
|
||||||
|
while (cp < end1) {
|
||||||
|
c = *cp;
|
||||||
cp++;
|
cp++;
|
||||||
|
if (c == '\n') {
|
||||||
|
buffer[i++] = '\\';
|
||||||
|
buffer[i++] = 'n';
|
||||||
|
} else if ( c == ' ' ) {
|
||||||
|
if (!insp)
|
||||||
|
buffer[i++] = c;
|
||||||
|
insp = yes;
|
||||||
|
} else {
|
||||||
|
buffer[i++] = c;
|
||||||
|
insp = no;
|
||||||
|
}
|
||||||
if (i >= MX_TXT)
|
if (i >= MX_TXT)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (i < len) {
|
c = '.';
|
||||||
buffer[i++] = '.';
|
if ((i < len)&&(cp < bgn)) {
|
||||||
if (i < len) {
|
buffer[i++] = c;
|
||||||
buffer[i++] = '.';
|
cp++;
|
||||||
if (i < len) {
|
if ((i < len)&&(cp < bgn)) {
|
||||||
buffer[i++] = '.';
|
buffer[i++] = c;
|
||||||
|
cp++;
|
||||||
|
if ((i < len)&&(cp < bgn)) {
|
||||||
|
buffer[i++] = c;
|
||||||
|
cp++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cp = bgn;
|
||||||
|
insp = no;
|
||||||
|
while (cp < end) {
|
||||||
|
c = *cp;
|
||||||
|
cp++;
|
||||||
|
if (c == '\n') {
|
||||||
|
buffer[i++] = '\\';
|
||||||
|
buffer[i++] = 'n';
|
||||||
|
} else if ( c == ' ' ) {
|
||||||
|
if (!insp)
|
||||||
|
buffer[i++] = c;
|
||||||
|
insp = yes;
|
||||||
|
} else {
|
||||||
|
buffer[i++] = c;
|
||||||
|
insp = no;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -101,7 +144,7 @@ static void Show_Node( TidyDocImpl* doc, const char *msg, Node *node )
|
||||||
tmbstr src = lex ? "lexer" : "stream";
|
tmbstr src = lex ? "lexer" : "stream";
|
||||||
SPRTF("R=%d C=%d: ", line, col );
|
SPRTF("R=%d C=%d: ", line, col );
|
||||||
// DEBUG: Be able to set a TRAP on a SPECIFIC row,col
|
// DEBUG: Be able to set a TRAP on a SPECIFIC row,col
|
||||||
if ((line == 8) && (col == 36)) {
|
if ((line == 67) && (col == 95)) {
|
||||||
check_me("Show_Node"); // just a debug trap
|
check_me("Show_Node"); // just a debug trap
|
||||||
}
|
}
|
||||||
if (lexer && lexer->token &&
|
if (lexer && lexer->token &&
|
||||||
|
@ -2265,8 +2308,11 @@ Node* TY_(GetToken)( TidyDocImpl* doc, GetTokenMode mode )
|
||||||
assert( !(lexer->pushed || lexer->itoken) );
|
assert( !(lexer->pushed || lexer->itoken) );
|
||||||
|
|
||||||
/* at start of block elements, unclosed inline
|
/* at start of block elements, unclosed inline
|
||||||
elements are inserted into the token stream */
|
elements are inserted into the token stream
|
||||||
if (lexer->insert || lexer->inode) {
|
Issue #341 - Can NOT insert a token if NO istacksize
|
||||||
|
*/
|
||||||
|
if ((lexer->insert || lexer->inode) && lexer->istacksize)
|
||||||
|
{
|
||||||
/*\ Issue #92: could fix by the following, but instead chose not to stack these 2
|
/*\ Issue #92: could fix by the following, but instead chose not to stack these 2
|
||||||
* if ( !(lexer->insert && (nodeIsINS(lexer->insert) || nodeIsDEL(lexer->insert))) ) {
|
* if ( !(lexer->insert && (nodeIsINS(lexer->insert) || nodeIsDEL(lexer->insert))) ) {
|
||||||
\*/
|
\*/
|
||||||
|
|
Loading…
Reference in a new issue