Commit graph

277 commits

Author SHA1 Message Date
Geoff McLane ae620a63a2 merge @camoy fix #158 to this branch 2015-07-17 19:00:16 +02:00
Geoff McLane d26cd72084 Add macros to get TidyVertSpace config, and implement 2015-07-15 20:58:00 +02:00
Geoff McLane 154a61543b Expand xml TidyVertSpace text to include tri-state 2015-07-15 20:56:22 +02:00
Geoff McLane 16580e0926 Revert TidyVertSpace to 'no', and make AutoBool option 2015-07-15 20:54:50 +02:00
Geoff McLane 4246c2c462 Issue #230: Need to KEEP this newline char sometimes.
This is a case where the lexer, in GetTokenfromStream, does NOT eat any
trailing newline after a LEX_STARTTAG: case...

So far have identified pre, script, style as NEEDING this user newline
character for later pprint output. Any others?
2015-07-15 19:41:02 +02:00
Cameron Moy d50391a984 Fix #158 - remove inserted newlines in pre 2015-07-13 16:31:52 -04:00
Geoff McLane cb2543efac Merge branch 'master' of https://github.com/stencila/tidy-html5 into issue-228 2015-07-13 19:11:30 +02:00
Nokome Bentley 991630e523 Changes default for vertical-space to yes
Makes this more similar (but not the same) as the previous default
behaviour.
2015-07-13 15:56:15 +12:00
Nokome Bentley b6bcf0408c Applies "smart" new lines to start of script like tags 2015-07-13 15:49:07 +12:00
Nokome Bentley f6979787d1 Adds "smart" line flushing functions.
See in-code comments for more details
2015-07-13 15:40:59 +12:00
Folkert van Heusden 784c7d7f79 Added methods for deleteing nodes and/or attributes.
This is useful when e.g. writing an HTML cleaner.
2015-07-12 18:34:35 +00:00
Geoff McLane 1e70fc6f15 Rename two headers. Issues #224 #223 #221
But this seemed a good time to release 5.0.0.RC1...
2015-06-30 20:06:02 +02:00
Geoff McLane 3a524f1710 Issue #207 - deal with 2 cases of an unambiguous ampersand.
html5 allows a naked ampersand unquoted, and now tidy will not issue a
warning. This only deals with a & b, and P&<li>O</li>

More may need to be done for other cases.
2015-06-24 13:10:27 +02:00
Geoff McLane 3aa50740da Issue #215 - only issue warning if NOT HTML5 mode 2015-06-21 19:49:44 +02:00
Geoff McLane e71bda718f Add TIDY_CALL to tidyLibraryVersion func. 2015-06-09 20:04:49 +02:00
Geoff McLane 18880eab55 Issue #218 - Do NOT allocate a 1 byte null String buffer.
This is when setting a String config value through say tidyOptSetValue
using say tidyOptSetValue(tdoc,id,"").

If the length of the new string is zero then do not allocate a 1 byte
buffer, set it to 0, for the option. Any previous buffer has already been
released.

This means API functions like tidyOptSaveSink will not return erroneous
null String values!
2015-06-08 13:52:00 +02:00
Geoff McLane 3f72b6e335 Issue #210 - Add new warning for summary attr in table if HTML5.
This new warning will only be seen if the document remains in HTML5 mode,
where the summary attribute is obsolete. The W3C validator flags this as
an error, and suggests 'Consider describing the structure of the table in
a caption element or in a figure element containing the table; or simplify
the structure of the table so that no description is needed'.

At the same time this patch also restored the old warning if the document
is HTML4--, if the table element lacks a summary attribute. This has been
a tidy warning since the beginning of time, although the W3C validator
does not presently flag this.
2015-06-06 11:20:35 +02:00
Geoff McLane 326f2414fd Issue #212 - Further fix to set MixedContent in some cases.
In certain circumstances a leading space has to be preverved to allow it
to be used to create a text space node to insert before this element to
preserve the view in a browser.

And added a note asking why is ParseTag called with a hardcoded
IgnoreWhitespace when some effort above has set the mode variable to
MixedContent in certain cases, but need to think about this 2nd change.

Also added some MSVC Debug output when this leading text is used to insert
such a created text node before the element just to be reminded of this
special event.
2015-06-04 13:12:05 +02:00
Geoff McLane a278b04a19 Add debug display of text modes.
Note this ONLY effects a MSVC Debug build!
2015-06-04 12:59:02 +02:00
Geoff McLane c18f27a587 Issue #217 - avoid len going negative, ever... 2015-06-03 20:26:03 +02:00
Geoff McLane 0fb7ccdfc6 Add some mem alloc and free debug to chase Issue #217
Such debug is OFF by default, and only added by defining DEBUG_MEMORY. And
is only available for the Debug configuration compiled with MSVC, but this
could be easily extended...
2015-06-03 20:24:41 +02:00
Geoff McLane 944b412fe6 Need extra include if UNICODE is defines 2015-06-02 20:44:00 +02:00
Geoff McLane b8bc88522c small fix for indent-with-tabs to have a default xml value 2015-05-25 16:48:39 +02:00
Denis Denisov 5a28d5f010 5.0.0
htacg/tidy-html5#190
2015-05-24 23:49:00 +03:00
Geoff McLane d923dd7b2d Issue #108 - first cut new option --indent-with-tabs yes. 2015-05-22 16:06:12 +02:00
Geoff McLane 5d5e689f1a For issue #212, retain mixed mode block parsing.
This is particularly for the anchor tag which in html5 mode is parsed in
ParseBlock. That is retain a leading space, in case it needs to be
moved to in front of the block to keep space rendering.
2015-05-13 12:35:06 +02:00
Geoff McLane 963caf0741 add counter for in ParseBlock 2015-05-12 17:14:09 +02:00
Geoff McLane c1a3100cb9 add conveninet break point based on row and column 2015-05-12 17:13:23 +02:00
Geoff McLane b2b9f1d6f2 spelling error noted in exploration of #207 in localize.c 2015-04-26 19:19:55 +02:00
Dmitry Ivanov 9a3f85d44c Support build with MinGW 4.9.1 2015-04-26 13:18:46 +03:00
Geoff McLane 2f6b3d49b6 Merge pull request #202 from aerilon/master
Please pull fix for #198 and #199
2015-04-22 21:24:12 +02:00
Geoff McLane f5eb2cf26a Issue #196 - expand comment and bump version.
Thanks to @willydee for this PR.
2015-04-11 15:25:07 +02:00
willydee 253a7e54c3 Fix for #196: HTML5 allows block elements in <CAPTION> 2015-04-11 15:06:35 +02:00
Arnaud Lacombe c05661df11 Issue #199 - Add support for html5's template tag 2015-04-10 15:50:07 -07:00
Geoff McLane e78c0105d3 Indicated by #191, why show doctype warning if omitted in output 2015-04-08 18:45:31 +02:00
Geoff McLane 5cbd3ee95b From issue #191, saw need to revert to 'master' branch 2015-04-08 17:55:12 +02:00
Geoff McLane 3585d4c31a Issue #186 - Move FreeLexer() to near last 2015-03-19 19:14:27 +01:00
Geoff McLane 79ac8b2554 Issue #185 - Treat elements ids as case-sensitive if in HTML5 mode 2015-03-13 19:47:28 +01:00
Geoff McLane 66a597f5b7 related to issue #180 - remove additional line unless 'classic' 2015-03-10 12:27:29 +01:00
Geoff McLane 9caab688f1 debug - avoid duplicae output if to stdout 2015-03-09 16:12:59 +01:00
Geoff McLane fd7b4f8589 just some more DEBUG on text nodes 2015-03-06 19:28:52 +01:00
Geoff McLane c0cad3aeba Issue #167 - further fixes for HTML5 mode 2015-03-06 19:13:06 +01:00
Geoff McLane 389ce17814 add attr to dbg_show_node 2015-03-06 18:36:01 +01:00
Geoff McLane 0dc68d6cb1 Issue #167 & #169 - default to HTML5 mode.
Revert TidyTag_A to HTML5 mode, but allow the table to be modified if the
DOCTYPE given is found to NOT be HTML5, through a service TY_(AdjustTags).
Care is taken to clear any previous hash cached tags.

At present this only effects the anchor tag, but could be applied to
others that need to change their parsing due to an identified DOCTYPE.
2015-03-06 12:55:24 +01:00
Geoff McLane 606ffebd47 Issue #168 - Fix for access test 5.2.1.2 2015-03-04 19:38:59 +01:00
Geoff McLane 86f626cd67 Issue #167 - revert anchor tag to inline only 2015-02-28 20:30:56 +01:00
Geoff McLane 4b2943edb3 Issue #162 - fix for this while hopefully maintaining #111 fix.
The fix for #111 added an end tag for all StartEnd tags, when outputting
HTML5, but there should be some exceptions to this.

Added a new service, isVoidElement(node) for the void elements. Perhaps
this service could be further optimised.
2015-02-24 17:51:59 +01:00
Geoff McLane cfffe7765f Issue #166 - repeated main element.
With this fix introduced two new services, FindNodeById and
FindNodeWithId. The former does a total tree search for a TidyTagId.

Maybe there is a way to optimise this search...

Also change the uint badForm from an on/off to a bit field, so could be
extended to other document format errors.
2015-02-24 15:04:19 +01:00
Geoff McLane a5629443e6 Just improve some debug output 2015-02-24 13:20:26 +01:00
Geoff McLane 70d7e58d8d Add macro nodeIsMAIN(n) 2015-02-22 20:53:14 +01:00
Geoff McLane 0aa81eb256 Issue #130 - MathML attr and entity fix!
This is a set of kludgy fixes for MathML attribute and entities support.

It is intended that a full HTML5 entity table be added at some time, but
at present ALL entities are accepted as written when within the math
element.

Likewise all attributes are accepted on MathML elements without any check
of their name or value, even if they match attributes outside MathML.

And in the pprinter such entities are written as is from the lexer, using
a new PPrintMathML service added, using the new mode OtherNameSpace.

It is hoped all these fixes will NOT effect tidy outside the math element.

ALL fixes in the set a clearly marked '#130 - MathML attr and entity fix!'
for easy searching, and improving if possible.
2015-02-22 18:58:55 +01:00
Frédéric Wang fe51244d4a Use HTML5 mapping for entities &lang; and &rang; (http://www.w3.org/TR/xml-entity-names/#diff-xhtml1). #130 2015-02-21 19:33:24 +01:00
Geoff McLane b144b834cd Add a show_all_nodes debug service 2015-02-19 19:14:40 +01:00
Geoff McLane 6e3b293985 Issue #130 - Add TidyAttr_DISPLAY for math tag 2015-02-13 18:37:07 +01:00
Jim Derry 04f68a032f Changed text to point to html-tidy.org 2015-02-13 19:17:25 +08:00
Geoff McLane cff3fdd308 Issue #133 - hopefully a better fix.
As predicted the previous fix had adverse consequences on say script text,
which then lost the indent, and was reverted.

This introduces a new service, nodeIsTextLike, which naturally returns yes
if it is text, but also is an AspTag.

Maybe other text like nodes need to be added.
2015-02-12 15:24:38 +01:00
Geoff McLane 5d2cbd10dc Revert "Issue #133 - ever increasing indent!"
This reverts commit 0f80c08355.

This commit had other BAD consequences
2015-02-12 14:56:51 +01:00
Geoff McLane ea50bd30e7 add comment only for potential fix of Issue #8 2015-02-10 15:32:05 +01:00
Geoff McLane 279c29bf8d Issue #20 - revert to 880221e fix this issue 2015-02-10 15:28:56 +01:00
Geoff McLane cbd9eb7903 Issue #155 - issue warnings unless --show-body-only yes 2015-02-07 13:56:13 +01:00
Geoff McLane b26291ec6b Issue #151 - Initial implementation of picture element.
TODO: check, verify the picture attribute list.
2015-02-07 13:42:22 +01:00
Geoff McLane d72e681d32 Issue #152 - add srcset and sizes to img tag 2015-02-06 19:24:04 +01:00
Geoff McLane 2172a498f6 Issue #153 - fix for endif section no conforming to what tidy expects 2015-02-05 19:01:34 +01:00
Geoff McLane 66951a562a add row/col to DEBUG output 2015-02-05 18:24:02 +01:00
Geoff McLane 1be5ccbb63 Issue #130 - initial MathML support 2015-02-05 12:21:08 +01:00
Geoff McLane 698396eaa0 Issue #149 - avoid crash on null attr value 2015-02-03 13:38:20 +01:00
Geoff McLane 885c7caab7 Issue #70 - Initial implmentation of SVG support.
An immense thanks to Ger Hobbelt who had already done this
in his github.com/GerHobbelt/htmltidy fork.

The two sources have diverges so was not a simple cut
an paste. But again thanks Ger for this.
2015-02-02 17:36:27 +01:00
Geoff McLane 63c6671f59 Issue #126 - partial fix for indenting style 2015-02-01 18:35:28 +01:00
Geoff McLane 7a3afd41ca Issue #132 - avoid warning if configured to omit-optional-tags.
Difficult decision to avoid head warning.
2015-02-01 16:05:39 +01:00
Geoff McLane 3e0cfbb88d Merge branch 'develop-500' of github.com:htacg/tidy-html5 into develop-500 2015-02-01 14:40:30 +01:00
Geoff McLane 0f80c08355 Issue #133 - ever increasing indent!
This is a simple but profound change in pprint.c.
Since leading space is preserved on script code, after tidy indents
the code once, a second run on that tidied file would add more indent
to already indented code. This fix should be carefully checked,
and removed if there are other bad consequences.
Bump the version point to 4 for this change.
2015-02-01 14:34:22 +01:00
Jim Derry 3c721d8bf8 #72, avoid showing some warnings when show-body-only. 2015-02-01 21:16:17 +08:00
Jim Derry e6930feb02 Fixes #78 by treating canvas as a block level tag. 2015-02-01 19:28:38 +08:00
Jim Derry 6f9dc2327e Fix for #103 - don't drop empty dd tags. 2015-02-01 18:46:31 +08:00
Jim Derry 5897b66e1e Fixed #42. 2015-02-01 18:09:17 +08:00
Jim Derry de97628f8f Deprecated tidyReleaseDate(). Returns epoch time (tdb). Removed dates from help, manpage, output, cmake, etc. 2015-02-01 14:20:41 +08:00
Geoff McLane 0eb1407818 Issue #102 - fix this regression bug 2015-01-29 18:25:19 +01:00
Geoff McLane 85070acd8c fix windows DLL build 2015-01-28 17:15:44 +01:00
Geoff McLane 59974e0bb0 When adding meta element for Tidy prefer library version over date 2015-01-28 12:15:27 +01:00
Geoff McLane ec4d4cd1f1 Issue #92 - OLD problem of ins and del
These are marked as CM_INLINE, but also CM_BLOCK,
so should not be stacked for insertion
2015-01-28 11:50:06 +01:00
Geoff McLane f83c604ad0 add some more messy debug output 2015-01-27 18:07:56 +01:00
Geoff McLane 9fb90f55d4 Oops, that fix should be after a potential new line in head 2015-01-26 12:23:41 +01:00
Geoff McLane 813f1c8a13 Issue #56 - long outstanding bug on script tag
Added a PCondFlushLine before emitting the script tag
Certainly looks better, but need to check for any regression
2015-01-25 21:03:16 +01:00
Geoff McLane f1297f718c remove a msvc warning 2015-01-25 20:18:36 +01:00
Geoff McLane 60d8271ecf Issue #132 - no warning when inserting a BODY tag 2015-01-25 20:10:41 +01:00
Geoff McLane 27bc767325 Fix some more info messages 2015-01-24 16:39:57 +01:00
Geoff McLane 4a3f5ecf07 make this version 5.0.0 2015-01-22 13:40:50 +01:00
Geoff McLane ce7c70532c Remove what seems like a regression 2015-01-20 18:10:57 +01:00
Geoff McLane f884da577d Small fix for TidyAttr_ASYNC to CH_BOOL 2015-01-20 18:10:13 +01:00
Geoff McLane 3f46000197 add allowfullscreen attribute exception 2015-01-18 20:59:27 +01:00
Geoff McLane 82fc656863 exception attr tabindex can begin with '-' 2015-01-18 14:46:12 +01:00
Jim Derry b8608380a2 Add support for 'role' attribute. #115 2014-11-22 20:44:38 +08:00
Jim Derry 08d490f406 Print end tag for self-closing tag #113 2014-11-22 20:08:00 +08:00
Jim Derry edb185a308 Use a hash table for anchors #64 2014-11-22 19:39:06 +08:00
Jim Derry 9a0b05cb69 Added HTML Microdata (itemprop, etc.) support. 2014-11-22 19:32:30 +08:00
Jim Derry 7754802884 Updated Aria attributes to geoffmcl's added tags; added missing aria-orientation. 2014-11-22 17:39:17 +08:00
Jim Derry e4f7aa0748 Merged changes from andrewle, #96, support Aria attributes. 2014-11-22 17:38:22 +08:00
Jim Derry e279302eaf Added TidyReportFilter2 2014-11-22 15:43:11 +08:00
Jim Derry 6aaf826476 Restart with geoffmcl's fork 2014-11-22 15:42:28 +08:00
Jim Derry 3bcf49cfde Preserve for both filters. 2014-04-27 18:16:13 +08:00
Jim Derry f3cc89d234 Correctly use a copy of args so both filters can work. 2014-04-27 18:11:50 +08:00
Jim Derry 5786a5afb5 Implement TidyReportFilter2 using raw strings to support library localization. 2014-04-27 16:07:20 +08:00
Eberhard Beilharz 3d4c4021ae Print end tag for self-closing tag
When we output HTML5 and we encounter a self-closing tag we have to
output an end tag to be standard conform.

This fixes issue #111.
2014-01-09 17:38:41 +01:00
Andrew Le 27d8ca6a69 Add support for aria attributes
Reference: http://dev.w3.org/html5/markup/aria/aria.html#aria-attrs-all
2013-06-28 16:50:54 -07:00
Peter Kelly 7fc3255542 Applied hash table optimisation to RemoveAnchorByNode. This function now takes
the anchor name as a parameter, so it can look in the correct bin.

In the case of FreeAttrs, we have the name already (since we found a name or
id attribute). In the case of FixAnchors, the anchor name could come from
either the name or id attribute, so we call the function separately for each
case, passing the appropriate attribute value.
2012-08-20 10:06:30 +07:00
Peter Kelly 11a8648818 Use a hash table for anchors 2012-08-20 00:29:16 +07:00
Craig Barnes ce27a729dc Remove CVS info blocks 2012-08-08 17:27:29 +01:00
Michael[tm] Smith 1b4dcd0e43 Update version. 2012-07-21 14:23:38 +09:00
Michael[tm] Smith c63cc3924b Allow block content in address. Fixes #55.
Thanks Craig Barnes.
2012-07-21 14:17:13 +09:00
Michael[tm] Smith fad2769449 Minor cleanup. 2012-07-21 13:37:07 +09:00
John Weldon 46e8e9d254 Better fix than 0d41d42, the gdoc.(c|h) files weren't included in the msvc2010 project 2012-07-12 10:41:05 -07:00
John Weldon 379a54c49d Merge branch 'master' of https://github.com/w3c/tidy-html5 2012-07-12 10:18:55 -07:00
John Weldon 0d41d4247e Fix tidylib.obj : error LNK2019: unresolved external symbol _prvTidyCleanGoogleDocument referenced in function _tidyDocCleanAndRepair
Signed-off-by: Michael[tm] Smith <mike@w3.org>
2012-07-06 15:47:24 +09:00
Michael[tm] Smith 6ef8d92b0f Bring docs up to date with code. Fixes #41.
Thanks ralfjunker.
2012-07-04 16:35:34 +09:00
John Weldon 046a40da34 Fix tidylib.obj : error LNK2019: unresolved external symbol _prvTidyCleanGoogleDocument referenced in function _tidyDocCleanAndRepair 2012-07-03 12:10:53 -07:00
Michael[tm] Smith a61504c57a Merge pull request #40 from stevenle/master
Remove WbrToSpace from being cleaned
2012-06-26 20:01:02 -07:00
Steven Le d942983fb0 Remove WbrToSpace since <wbr> is HTML5 valid. 2012-06-22 10:35:43 -07:00
Michael[tm] Smith 5220d8fe2e Minor quickref formatting problem. 2012-06-20 17:08:44 +09:00
Michael[tm] Smith 68a9e741a1 Merge pull request #39 from stevenle/master
Remove <wbr> as a proprietary tag.
2012-06-20 01:05:42 -07:00
Michael[tm] Smith 664f95ba5b Update the generated API docs. 2012-06-20 16:58:34 +09:00
Michael[tm] Smith a772bbb17f Let's actually commit the -gdoc feature this time. 2012-06-20 16:55:42 +09:00
Michael[tm] Smith 45fce5e3c2 Merge branch 'master' of github.com:w3c/tidy-html5
Forgot to pull.
2012-06-20 16:51:43 +09:00
Michael[tm] Smith 09e310b50c -gdoc opt, clean Google Docs HTML; fr Dave Raggett 2012-06-20 16:48:12 +09:00
Steven Le 57a98b97b6 Changed W3CAttrsFor_VIDEO -> W3CAttrsFor_WBR 2012-06-19 15:42:48 -07:00
Steven Le e8013a74b8 Remove <wbr> as a proprietary tag. 2012-06-19 09:39:06 -07:00
Joaquin Cuenca Abela f91a020894 Accept HTML5 input types. 2012-06-07 16:54:04 +02:00
Michael[tm] Smith f212c3f380 Update version. 2012-04-26 00:31:18 +09:00
Ryan Kistner 8025154e30 Check for NULL pointer before calling strcasecmp in GetVersFromFPI 2012-04-23 11:51:58 +09:00
Michael[tm] Smith 869ab4a4e5 Fix C90 compatibility issue. 2012-04-10 14:57:15 +09:00
Michael[tm] Smith 666d5bb1f4 Another minor editorial change. 2012-04-07 16:49:19 +09:00
Michael[tm] Smith d193420729 Minor editorial update. 2012-04-07 16:41:06 +09:00
Michael[tm] Smith 4408516c32 Clarify doc for wrap-attributes option. 2012-04-07 16:33:10 +09:00
Michael[tm] Smith c66f165f00 Don't line-wrap title attr. Thx Oliver Prygotzki.
Fixes #28.
2012-04-07 15:58:28 +09:00
Michael[tm] Smith d194e8726e Added show-info option. Fixes #6. 2012-04-02 16:41:05 +09:00
Michael[tm] Smith 880221e26d Don't eat whitespace after CM_MIXED end tags.
Fixes #20.
2012-03-29 14:00:24 +09:00
Michael[tm] Smith 1f2162553a Back out fix for #20. 2012-03-29 12:17:13 +09:00
Michael[tm] Smith 895fbb13f0 Minor rewording. 2012-03-24 19:08:04 +09:00
Michael[tm] Smith 2cd21a6693 Added omit-optional-tags option. Fixes #22.
Thanks towolf.
2012-03-24 19:04:46 +09:00
Michael[tm] Smith f5c273910c Merge branch 'master' of github.com:w3c/tidy-html5 2012-03-23 23:52:01 +09:00
Michael[tm] Smith 87d8cb5281 Don't hoist style into head. Relates to #23. 2012-03-23 23:50:41 +09:00
Thies C. Arntzen a3d49a7143 fix <a>hallo</a> world WS destruction 2012-03-23 22:08:11 +09:00
Michael[tm] Smith 4ff3234431 List new options on the index page. 2012-03-17 17:24:01 +09:00
Michael[tm] Smith ddb5702a08 Point to http://w3c.github.com/tidy-html5/ where appropriate. 2012-03-17 17:07:48 +09:00
Michael[tm] Smith 1052c2b81e New merge-emphasis & coerce-endtags options added.
Fixes #19.
2012-03-17 16:26:41 +09:00
Michael[tm] Smith 3ed33a1823 Merge in TidyAttr_XML_LANG change. 2012-03-16 20:55:59 +09:00
Michael[tm] Smith 3a9a794d8b Minor formatting edit. 2012-03-15 14:12:41 +09:00
Michael[tm] Smith 0c8b587067 Added --doctype=html5 option value. Fixes #17. 2012-03-15 14:11:01 +09:00
Michael[tm] Smith a1bb2d24b1 Updated version and quickref. 2012-03-15 11:15:11 +09:00
Michael[tm] Smith bf1c2f67a9 Added drop-empty-elements options. Fixes #19. 2012-03-15 10:58:10 +09:00
Michael[tm] Smith 5b9d25dcf9 source in video. Fixes #8. Fixes #9. 2012-03-15 10:30:11 +09:00